meson - make modules with helper binaries simpelr to build
this makes modules with a binary helper simpler to build using the parent module build harness as much as possible. i probably could simplify this down to a single binary only and it is either setuid or not... define the deps and flags ... it could be a bit simpler. not much. i also removed the if's in the build for battery and ifdefs in src handle it instead (imho simpler to maintain in src). sysinfo still uses the if's there.
This commit is contained in:
parent
fe7c39fa18
commit
16a702ac73
|
@ -818,7 +818,7 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
|||
|
||||
#ifdef HAVE_EEZE
|
||||
_battery_udev_stop();
|
||||
#elif defined __OpenBSD__ || defined __DragonFly__ || defined __FreeBSD__ || defined __NetBSD__
|
||||
#elif defined (__OpenBSD__) || defined (__DragonFly__) || defined (__FreeBSD__) || defined (__NetBSD__)
|
||||
_battery_sysctl_stop();
|
||||
#else
|
||||
_battery_upower_stop();
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
|
||||
#include <err.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/sensors.h>
|
||||
#endif
|
||||
|
||||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# include <err.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/param.h>
|
||||
# include <sys/sensors.h>
|
||||
|
||||
static Eina_Bool _battery_sysctl_battery_update_poll(void *data EINA_UNUSED);
|
||||
static int _battery_sysctl_battery_update();
|
||||
|
||||
|
@ -24,16 +21,16 @@ static Battery *bat = NULL;
|
|||
int
|
||||
_battery_sysctl_start(void)
|
||||
{
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
int mib[] = {CTL_HW, HW_SENSORS, 0, 0, 0};
|
||||
int devn;
|
||||
struct sensordev snsrdev;
|
||||
size_t sdlen = sizeof(struct sensordev);
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
size_t len;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
for (devn = 0;; devn++) {
|
||||
mib[2] = devn;
|
||||
if (sysctl(mib, 3, &snsrdev, &sdlen, NULL, 0) == -1)
|
||||
|
@ -75,7 +72,7 @@ _battery_sysctl_start(void)
|
|||
device_ac_adapters = eina_list_append(device_ac_adapters, ac);
|
||||
}
|
||||
}
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
if ((sysctlbyname("hw.acpi.battery.life", NULL, &len, NULL, 0)) != -1)
|
||||
{
|
||||
if (!(bat = E_NEW(Battery, 1)))
|
||||
|
@ -103,7 +100,7 @@ _battery_sysctl_start(void)
|
|||
bat->vendor = eina_stringshare_add("Unknown");
|
||||
|
||||
bat->poll = ecore_poller_add(ECORE_POLLER_CORE,
|
||||
battery_config->poll_interval,
|
||||
battery_config->poll_interval,
|
||||
_battery_sysctl_battery_update_poll, NULL);
|
||||
|
||||
device_batteries = eina_list_append(device_batteries, bat);
|
||||
|
@ -123,7 +120,7 @@ _battery_sysctl_start(void)
|
|||
|
||||
device_ac_adapters = eina_list_append(device_ac_adapters, ac);
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
_battery_sysctl_battery_update();
|
||||
|
||||
bat->last_update = ecore_time_get();
|
||||
|
@ -148,11 +145,11 @@ _battery_sysctl_stop(void)
|
|||
eina_stringshare_del(bat->model);
|
||||
eina_stringshare_del(bat->vendor);
|
||||
ecore_poller_del(bat->poll);
|
||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
E_FREE(bat->mib_state);
|
||||
E_FREE(bat->mib_time);
|
||||
E_FREE(bat->mib_units);
|
||||
#endif
|
||||
# endif
|
||||
E_FREE(bat->mib);
|
||||
E_FREE(bat);
|
||||
}
|
||||
|
@ -169,21 +166,21 @@ static int
|
|||
_battery_sysctl_battery_update()
|
||||
{
|
||||
double _time;
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
double charge;
|
||||
struct sensor s;
|
||||
size_t slen = sizeof(struct sensor);
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
int value;
|
||||
size_t len;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (bat)
|
||||
{
|
||||
/* update the poller interval */
|
||||
ecore_poller_poller_interval_set(bat->poll,
|
||||
battery_config->poll_interval);
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
/* last full capacity */
|
||||
bat->mib[3] = 7;
|
||||
bat->mib[4] = 0;
|
||||
|
@ -267,7 +264,7 @@ _battery_sysctl_battery_update()
|
|||
bat->charging = 0;
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
len = sizeof(value);
|
||||
if ((sysctl(bat->mib, 4, &value, &len, NULL, 0)) == -1)
|
||||
{
|
||||
|
@ -305,12 +302,12 @@ _battery_sysctl_battery_update()
|
|||
|
||||
if (bat->time_min >= 0) bat->time_left = bat->time_min * 60;
|
||||
if (bat->batteries == 1) bat->time_left = -1;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
if (ac)
|
||||
{
|
||||
#if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# if defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
/* AC State */
|
||||
ac->mib[3] = 9;
|
||||
ac->mib[4] = 0;
|
||||
|
@ -321,13 +318,13 @@ _battery_sysctl_battery_update()
|
|||
else
|
||||
ac->present = 0;
|
||||
}
|
||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
# elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
len = sizeof(value);
|
||||
if ((sysctl(ac->mib, 3, &value, &len, NULL, 0)) != -1)
|
||||
{
|
||||
ac->present = value;
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
if (bat)
|
||||
|
@ -338,6 +335,7 @@ _battery_sysctl_battery_update()
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
#ifdef HAVE_EEZE
|
||||
|
||||
static void _battery_udev_event_battery(const char *syspath, Eeze_Udev_Event event, void *data, Eeze_Udev_Watch *watch);
|
||||
static void _battery_udev_event_ac(const char *syspath, Eeze_Udev_Event event, void *data, Eeze_Udev_Watch *watch);
|
||||
static void _battery_udev_battery_add(const char *syspath);
|
||||
|
@ -110,8 +112,8 @@ _battery_udev_battery_add(const char *syspath)
|
|||
bat->last_update = ecore_time_get();
|
||||
bat->udi = eina_stringshare_add(syspath);
|
||||
bat->poll = ecore_poller_add(ECORE_POLLER_CORE,
|
||||
battery_config->poll_interval,
|
||||
_battery_udev_battery_update_poll, bat);
|
||||
battery_config->poll_interval,
|
||||
_battery_udev_battery_update_poll, bat);
|
||||
device_batteries = eina_list_append(device_batteries, bat);
|
||||
_battery_udev_battery_update(syspath, bat);
|
||||
}
|
||||
|
@ -184,7 +186,7 @@ _battery_udev_battery_update_poll(void *data)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
#define GET_NUM(TYPE, VALUE, PROP) \
|
||||
# define GET_NUM(TYPE, VALUE, PROP) \
|
||||
do \
|
||||
{ \
|
||||
test = eeze_udev_syspath_get_property(TYPE->udi, #PROP); \
|
||||
|
@ -196,7 +198,7 @@ _battery_udev_battery_update_poll(void *data)
|
|||
} \
|
||||
while (0)
|
||||
|
||||
#define GET_STR(TYPE, VALUE, PROP) TYPE->VALUE = eeze_udev_syspath_get_property(TYPE->udi, #PROP)
|
||||
# define GET_STR(TYPE, VALUE, PROP) TYPE->VALUE = eeze_udev_syspath_get_property(TYPE->udi, #PROP)
|
||||
|
||||
static void
|
||||
_battery_udev_battery_update(const char *syspath, Battery *bat)
|
||||
|
@ -219,7 +221,7 @@ _battery_udev_battery_update(const char *syspath, Battery *bat)
|
|||
if (!bat->got_prop) /* only need to get these once */
|
||||
{
|
||||
GET_STR(bat, technology, POWER_SUPPLY_TECHNOLOGY);
|
||||
GET_STR(bat, model, POWER_SUPPLY_MODEL_NAME);
|
||||
GET_STR(bat, model, POWER_SUPPLY_MODEL_NAME);
|
||||
GET_STR(bat, vendor, POWER_SUPPLY_MANUFACTURER);
|
||||
GET_NUM(bat, design_charge, POWER_SUPPLY_ENERGY_FULL_DESIGN);
|
||||
if (eina_dbl_exact(bat->design_charge, 0))
|
||||
|
@ -310,4 +312,4 @@ _battery_udev_ac_update(const char *syspath, Ac_Adapter *ac)
|
|||
|
||||
_battery_device_update();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
#define BUS "org.freedesktop.UPower"
|
||||
#define PATH "/org/freedesktop/UPower"
|
||||
#define IFACE "org.freedesktop.UPower"
|
||||
#if !(defined(HAVE_EEZE) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__))
|
||||
|
||||
# define BUS "org.freedesktop.UPower"
|
||||
# define PATH "/org/freedesktop/UPower"
|
||||
# define IFACE "org.freedesktop.UPower"
|
||||
|
||||
extern Eina_List *device_batteries;
|
||||
extern Eina_List *device_ac_adapters;
|
||||
|
@ -348,3 +350,4 @@ _battery_upower_stop(void)
|
|||
eldbus_object_unref(obj);
|
||||
eldbus_connection_unref(conn);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,45 +1,18 @@
|
|||
battery_dist = [
|
||||
'e-module-battery.edj',
|
||||
'module.desktop',
|
||||
]
|
||||
src = files(
|
||||
'e_mod_main.c',
|
||||
'e_mod_config.c',
|
||||
'e_mod_sysctl.c',
|
||||
'e_mod_udev.c',
|
||||
'e_mod_upower.c',
|
||||
'e_mod_main.h'
|
||||
)
|
||||
|
||||
battery_src = [
|
||||
'e_mod_config.c',
|
||||
'e_mod_main.c',
|
||||
'e_mod_main.h',
|
||||
]
|
||||
|
||||
if config_h.has('HAVE_EEZE') == true
|
||||
battery_src += 'e_mod_udev.c'
|
||||
elif host_machine.system().contains('bsd') == true
|
||||
battery_src += 'e_mod_sysctl.c'
|
||||
else
|
||||
battery_src += 'e_mod_upower.c'
|
||||
endif
|
||||
|
||||
battery_dir = join_paths(dir_module_e, 'battery', module_arch)
|
||||
if get_option('battery') == true
|
||||
config_h.set('USE_MODULE_BATTERY', '1')
|
||||
|
||||
install_data(battery_dist,
|
||||
install_dir: join_paths(dir_module_e, 'battery')
|
||||
)
|
||||
|
||||
module_files += join_paths(battery_dir, 'battery.so')
|
||||
shared_module('battery',
|
||||
battery_src,
|
||||
include_directories: include_directories(module_includes),
|
||||
name_prefix: '',
|
||||
dependencies: module_deps,
|
||||
install_dir: battery_dir,
|
||||
install: true
|
||||
)
|
||||
|
||||
executable('batget',
|
||||
'batget.c',
|
||||
include_directories: include_directories(module_includes),
|
||||
dependencies: [dep_eina, dep_ecore, dep_ecore_con, dep_ecore_file],
|
||||
install_dir: battery_dir,
|
||||
install: true
|
||||
)
|
||||
if get_option(m) == true
|
||||
executable('batget',
|
||||
'batget.c',
|
||||
include_directories: include_directories(module_includes),
|
||||
dependencies : [ dep_eina, dep_ecore, dep_ecore_con, dep_ecore_file ],
|
||||
install_dir : _dir_bin,
|
||||
install : true
|
||||
)
|
||||
endif
|
||||
|
|
|
@ -1,40 +1,17 @@
|
|||
cpufreq_dist = [
|
||||
'e-module-cpufreq.edj',
|
||||
'module.desktop',
|
||||
]
|
||||
src = files(
|
||||
'e_mod_main.c',
|
||||
'e_mod_config.c',
|
||||
'e_mod_main.h'
|
||||
)
|
||||
|
||||
cpufreq_src = [
|
||||
'e_mod_config.c',
|
||||
'e_mod_main.c',
|
||||
'freqset.c',
|
||||
'e_mod_main.h',
|
||||
]
|
||||
|
||||
cpufreq_dir = join_paths(dir_module_e, 'cpufreq', module_arch)
|
||||
if get_option('cpufreq') == true
|
||||
config_h.set('USE_MODULE_CPUFREQ', '1')
|
||||
|
||||
install_data(cpufreq_dist,
|
||||
install_dir: join_paths(dir_module_e, 'cpufreq')
|
||||
)
|
||||
|
||||
module_files += join_paths(cpufreq_dir, 'cpufreq.so')
|
||||
shared_module('cpufreq',
|
||||
cpufreq_src,
|
||||
include_directories: include_directories(module_includes),
|
||||
name_prefix: '',
|
||||
dependencies: module_deps,
|
||||
install_dir: cpufreq_dir,
|
||||
install: true
|
||||
)
|
||||
|
||||
executable('freqset',
|
||||
'freqset.c',
|
||||
c_args: suid_cflags,
|
||||
link_args: suid_ldflags,
|
||||
install_dir: cpufreq_dir,
|
||||
install: true
|
||||
)
|
||||
suid_exes += join_paths(cpufreq_dir, 'freqset')
|
||||
if get_option(m) == true
|
||||
executable('freqset',
|
||||
'freqset.c',
|
||||
c_args : suid_cflags,
|
||||
link_args : suid_ldflags,
|
||||
install_dir: _dir_bin,
|
||||
install : true
|
||||
)
|
||||
suid_exes += join_paths(_dir_bin, 'freqset')
|
||||
endif
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@ module_includes = [ '../../..', '../../bin', '../../bin/efx' ]
|
|||
module_includes2 = [ '../..' , '../bin' , '../bin/efx' ]
|
||||
module_deps = [ deps_e, dep_dl ]
|
||||
|
||||
subdir('battery')
|
||||
subdir('cpufreq')
|
||||
subdir('wizard')
|
||||
subdir('mixer')
|
||||
subdir('everything')
|
||||
|
@ -13,14 +11,16 @@ subdir('teamwork')
|
|||
subdir('wl_desktop_shell')
|
||||
subdir('wl_text_input')
|
||||
subdir('wl_weekeyboard')
|
||||
subdir('sysinfo')
|
||||
|
||||
# disabled for now
|
||||
####subdir('wl_fb')
|
||||
|
||||
mods = [
|
||||
# standard run of the mill modules with cion and desktop
|
||||
'battery',
|
||||
'cpufreq',
|
||||
'clock',
|
||||
'sysinfo',
|
||||
'ibar',
|
||||
'pager',
|
||||
'pager_plain',
|
||||
|
@ -80,7 +80,9 @@ foreach m: mods
|
|||
no_icon = false
|
||||
disable = false
|
||||
cargs = ''
|
||||
|
||||
_dir = join_paths(dir_module_e, m)
|
||||
_dir_bin = join_paths(_dir, module_arch)
|
||||
_inc = include_directories(module_includes2, join_paths('.', m))
|
||||
subdir(m)
|
||||
|
||||
opt = '-'.join(m.split('_'))
|
||||
|
@ -88,9 +90,6 @@ foreach m: mods
|
|||
if get_option(opt) == true and disable == false
|
||||
|
||||
_conf = 'USE_MODULE_' + m.underscorify().to_upper()
|
||||
_dir = join_paths(dir_module_e, m)
|
||||
_dir_bin = join_paths(_dir, module_arch)
|
||||
_inc = include_directories(module_includes2, join_paths('.', m))
|
||||
module_files += join_paths(_dir_bin, m + '.so')
|
||||
|
||||
if desktop_only == true
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
module = 'sysinfo'
|
||||
opt = 'sysinfo'
|
||||
conf = 'USE_MODULE_SYSINFO'
|
||||
|
||||
src = [
|
||||
src = files(
|
||||
'mod.c',
|
||||
'sysinfo.c',
|
||||
'sysinfo.h',
|
||||
|
@ -29,55 +25,34 @@ src = [
|
|||
'netstatus/netstatus.c',
|
||||
'netstatus/netstatus_config.c',
|
||||
'netstatus/netstatus_proc.c'
|
||||
]
|
||||
|
||||
)
|
||||
if config_h.has('HAVE_EEZE') == true
|
||||
src += [
|
||||
'batman/batman_udev.c',
|
||||
'thermal/thermal_udev.c'
|
||||
]
|
||||
src += files(
|
||||
'batman/batman_udev.c',
|
||||
'thermal/thermal_udev.c')
|
||||
elif host_machine.system().contains('bsd') == true
|
||||
src += ['batman/batman_sysctl.c',
|
||||
'thermal/thermal_sysctl.c',
|
||||
'cpuclock/cpuclock_sysctl.c',
|
||||
'netstatus/netstatus_sysctl.c',
|
||||
'cpumonitor/cpumonitor_sysctl.c',
|
||||
'memusage/memusage_sysctl.c'
|
||||
]
|
||||
src += files(
|
||||
'batman/batman_sysctl.c',
|
||||
'thermal/thermal_sysctl.c',
|
||||
'cpuclock/cpuclock_sysctl.c',
|
||||
'netstatus/netstatus_sysctl.c',
|
||||
'cpumonitor/cpumonitor_sysctl.c',
|
||||
'memusage/memusage_sysctl.c')
|
||||
else
|
||||
src += ['batman/batman_upower.c',
|
||||
'thermal/thermal_sysctl.c',
|
||||
'cpuclock/cpuclock_sysctl.c'
|
||||
]
|
||||
src += files(
|
||||
'batman/batman_upower.c',
|
||||
'thermal/thermal_sysctl.c',
|
||||
'cpuclock/cpuclock_sysctl.c')
|
||||
endif
|
||||
|
||||
icon = [
|
||||
'e-module-' + module + '.edj',
|
||||
'module.desktop'
|
||||
]
|
||||
|
||||
dir_mod = join_paths(dir_module_e, module)
|
||||
dir_mod_bin = join_paths(dir_mod, module_arch)
|
||||
|
||||
if get_option(opt) == true
|
||||
config_h.set(conf, '1')
|
||||
module_files += join_paths(dir_mod_bin, module + '.so')
|
||||
|
||||
install_data(icon, install_dir: dir_mod)
|
||||
shared_module(module, src,
|
||||
include_directories: include_directories(module_includes),
|
||||
name_prefix : '',
|
||||
dependencies : module_deps,
|
||||
install_dir : dir_mod_bin,
|
||||
install : true
|
||||
)
|
||||
executable('cpuclock_sysfs',
|
||||
'cpuclock/cpuclock_sysfs.c',
|
||||
dependencies: dep_crypt,
|
||||
c_args : suid_cflags,
|
||||
link_args : suid_ldflags,
|
||||
install_dir : dir_mod_bin,
|
||||
install : true
|
||||
)
|
||||
suid_exes += join_paths(dir_mod_bin, 'cpuclock_sysfs')
|
||||
if get_option(m) == true
|
||||
executable('cpuclock_sysfs',
|
||||
'cpuclock/cpuclock_sysfs.c',
|
||||
dependencies: dep_crypt,
|
||||
c_args : suid_cflags,
|
||||
link_args : suid_ldflags,
|
||||
install_dir : _dir_bin,
|
||||
install : true
|
||||
)
|
||||
suid_exes += join_paths(_dir_bin, 'cpuclock_sysfs')
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue