-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hope you like this one. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkrY/6kACgkQhS0drJ3goJKdtACdFSy6TkV5nPIGCKF1yVQ9dxvZ g9IAnREDJNNVPfHs6vRbq80+2n3TL3hU =JbnE -----END PGP SIGNATURE-----
diff --git a/Jamfile b/Jamfile new file mode 100644 index 0000000..aa0841b --- /dev/null +++ b/Jamfile @@ -0,0 +1,7 @@ +SubDir TOP ; +SubInclude TOP core ; +SubInclude TOP tools ; +SubInclude TOP modules ; + +GenHeaders config.h initng-paths.h ; +Clean config.h initng-paths.h ; diff --git a/Jamrules b/Jamrules new file mode 100644 index 0000000..bb7a6be --- /dev/null +++ b/Jamrules @@ -0,0 +1,147 @@ +# Jamrules -- the rule boilerplate for InitNG +# Copyright (C) 2009 Eric MSP Veith <[email protected]> +# Licensed under GNU GPL v3, see the included file "COPYING" for details. +# +# This file contains predefined variables available throughout the whole build +# process as well as some rules needed for creating the executables and +# libraries. +# Normally, a packager or quite anyone building InitNG doesn't have to change +# anything in here, but can rely on environmental variables or the -s +# parameter to jam, e.g. OPTIM="" for compiler optimization flags. +# If you have to change something in here to make InitNG build, it is probably +# a bug, and you should contact the author of the build system. +# + + +# Configuration variables for the build that will later on be in config.h or +# initng-paths.h +VERSION = 0.7.0svn ; +VERSION_NAME = "Bleeding Edge" ; +RUNLEVEL_DEFAULT = runlevel/default ; +RUNLEVEL_FAKE = runlevel/fake-default ; + +# Modules to be built +MODULES ?= also chdir chroot conflict cpout critical ctrlaltdel daemon_clean + dbus_event debug_commands fmon fstat history idleprobe initctl interactive + last limit lockfile logfile netdev ngc4 ngcs nge pause provide reload + renice service_file simple_launcher stcmd stdout suid syncron syslog + sysreq task unneeded ; +MODULES += service daemon runlevel ; + + +DESTDIR ?= "" ; +prefix ?= / ; +bindir ?= $(prefix)/bin ; +sbindir ?= $(prefix)/sbin ; +libdir ?= $(prefix)/lib ; +mandir ?= $(prefix)/share/man ; +sysconfdir ?= $(prefix)/etc ; +localstatedir ?= $(prefix)/var ; + +# Cflags, defines and linker flags: +CCFLAGS += -std=c99 -Wall -O2 ; +CCFLAGS += -g -Werror -Wmissing-prototypes -Wmissing-declarations + -Wstrict-prototypes -Wimplicit -Wredundant-decls -Wnested-externs + -Wwrite-strings -Wsign-compare -Winline -Wswitch -Wreturn-type + -Wparentheses -Wmissing-braces -Wformat -Wformat-nonliteral + -Wformat-security -Wsequence-point -Wundef -Wunused -Wcomment ; +DEFINES += HAVE_CONFIG_H _XOPEN_SOURCE=600 DEBUG ; +LINKFLAGS += -rdynamic -fPIC ; + +# config.h defines that are configurable by the user +if $(CHECK_RO) +{ + DEFINES += CHECK_RO ; +} +if $(FORCE_NOCOLOR) +{ + DEFINES += FORCE_NOCOLOR ; +} +if $(FORCE_POSIX_IFILES) +{ + DEFINES += FORCE_POSIX_IFILES ; +} + + +# Builds a static library from a set of subdirectories given as arguments to +# this rule. It takes care of creating the objects in the right place, +# cleaning up and running Ar. It does not, however, handle recursion. +rule LibraryFromSubdirs +{ + local _o = [ ObjectsFromSubdir $(>) ] ; + LibraryFromObjects $(<) : $(_o) ; +} + + +# Does pretty much the same as LibraryFromSubdirs, but creates an executable +# instead. +rule MainFromSubdirs +{ + local _o = [ ObjectsFromSubdir $(>) ] ; + MainFromObjects $(<) : $(_o) ; +} + + +# Workhouse for subdir compile. Iterates over all subdirectories given and +# turns the *.c sources found there into objects. Returns a list of all +# objects created. Doesn't do the cleanup as it doesn't know about the target. +# USAGE: ObjectsFromSubdir foo bar baz ; +rule ObjectsFromSubdir +{ + local _sources _objects _subdir ; + + for _subdir in $(<) + { + # Get all source files + _sources = [ Glob [ FDirName $(SUBDIR) $(_subdir) ] : *.c ] ; + + # Adjust grist (otherwise we get $(SUBDIR) twice) + _sources = $(_sources:D=$(_subdir)) ; + + # Keep track of the objects we're about to create + _objects += $(_sources:S=$(SUFOBJ)) ; + + # Do the actual compile + Objects $(_sources) ; + } + + return $(_objects) ; +} + + +# Creates an InitNG module from a given subdirectory. Will automatically link +# it against libinitng.a, and build a shared library named by the scheme +# "mod$(SUBDIR)$(SUF)". +rule ModuleFromSubdir +{ + local _lib = mod$(<).so ; + local _obj = [ ObjectsFromSubdir $(<) ] ; + + LINKFLAGS on $(_lib) += -fPIC -rdynamic + -shared -Wl,-soname,$(_lib) + -Wl,--whole-archive [ FDirName $(TOP) core libinitng$(SUFLIB) ] + -Wl,--no-whole-archive -ldl ; + MainFromObjects $(_lib) : $(_obj) ; + + return $(_lib) ; +} + + +# Creates the config.h file from config.h.in. +actions GenHeaders +{ + for h in $(<).in + do + cat "$h" | sed \ + -e 's,@VERSION@,$(VERSION),g' \ + -e 's,@VERSION_NAME@,$(VERSION_NAME),g' \ + -e 's,@RUNLEVEL_DEFAULT@,$(RUNLEVEL_DEFAULT),g' \ + -e 's,@RUNLEVEL_FAKE@,$(RUNLEVEL_FAKE),g' \ + -e 's,@PREFIX@,$(prefix),g' \ + -e 's,@BINDIR@,$(bindir),g' \ + -e 's,@LIBDIR@,$(libdir),g' \ + -e 's,@SYSCONFDIR@,$(sysconfdir),g' \ + -e 's,@LOCALSTATEDIR@,$(localstatedir),g' \ + > "${h%*.in}" + done +} diff --git a/config.h.in b/config.h.in index 82ded3a..da54195 100644 --- a/config.h.in +++ b/config.h.in @@ -1,7 +1,4 @@ #define VERSION "@VERSION@" #define VERSION_NAME "@VERSION_NAME@" -#cmakedefine CHECK_RO -#cmakedefine FORCE_NOCOLOR -#cmakedefine FORCE_POSIX_IFILES #define RUNLEVEL_DEFAULT "@RUNLEVEL_DEFAULT@" #define RUNLEVEL_FAKE "@RUNLEVEL_FAKE@" diff --git a/core/Jamfile b/core/Jamfile new file mode 100644 index 0000000..40d3d62 --- /dev/null +++ b/core/Jamfile @@ -0,0 +1,29 @@ +# Let Jam know that this is a sub directory. +SubDir TOP core ; + +# Directories that contain sources for libinitng: +LIBINITNG_SRC_DIRS = hash active_db module event process_db service string + toolbox env active_state fork signal fd common error command execute + handler depend interrupt kill static plugin_callers io module_callers main + data config ; + +# Source directores for initng executable +INITNG_SRC_DIRS = frontend ; + +# Where to look for headers: +SubDirHdrs $(TOP) ; +SubDirHdrs $(TOP) include ; + + +# Build the library +LibraryFromSubdirs libinitng : $(LIBINITNG_SRC_DIRS) ; + +# Build initng executable +MainFromSubdirs initng : $(INITNG_SRC_DIRS) ; +LINKFLAGS on initng = -rdynamic -fPIC + -Wl,--whole-archive [ FDirName $(SUBDIR) libinitng$(SUFLIB) ] + -Wl,--no-whole-archive -ldl ; + +# Install +InstallBin $(DESTDIR)/$(sbindir) : initng ; +InstallLib $(DESTDIR)/$(libdir) : libinitng$(SUFLIB) ; diff --git a/core/data/is_var.c b/core/data/is_var.c index 01a44e3..2c85780 100644 --- a/core/data/is_var.c +++ b/core/data/is_var.c @@ -30,7 +30,7 @@ * initng_data_is_var can be used to check any type, if its in the db, * or just to check unset and set types. */ -inline int initng_data_is_var(s_entry * type, const char *vn, data_head * d) +int initng_data_is_var(s_entry * type, const char *vn, data_head * d) { s_data *current = initng_data_get_next_var(type, vn, d, NULL); diff --git a/include/initng/string.h b/include/initng/string.h index 3e1b708..22ff380 100644 --- a/include/initng/string.h +++ b/include/initng/string.h @@ -20,6 +20,7 @@ #ifndef INITNG_STRING_H #define INITNG_STRING_H +#include <stddef.h> /* * MACRO JUMP_SPACES, will increase string, until it founds a valid token. diff --git a/initng-paths.h.in b/initng-paths.h.in index 5f64849..7d6cf96 100644 --- a/initng-paths.h.in +++ b/initng-paths.h.in @@ -1,11 +1,11 @@ #ifndef INITNG_PATHS_H #define INITNG_PATHS_H -#define DEVDIR "/dev" -#define ETCDIR "@CMAKE_INSTALL_PREFIX@@SYSCONF_INSTALL_DIR@" -#define VARDIR "@CMAKE_INSTALL_PREFIX@/var" -#define INITNG_ROOT "@CMAKE_INSTALL_PREFIX@@SYSCONF_INSTALL_DIR@/initng" -#define INITNG_MODULE_DIR "@CMAKE_INSTALL_PREFIX@@LIB_INSTALL_DIR@/initng" -#define INITNG_CORE_BIN "@CMAKE_INSTALL_PREFIX@@SBIN_INSTALL_DIR@/initng" +#define DEVDIR "/dev" +#define ETCDIR "@SYSCONFDIR@" +#define VARDIR "@LOCALSTATEDIR@" +#define INITNG_ROOT "@SYSCONFDIR@/initng" +#define INITNG_MODULE_DIR "@LIBDIR@/initng" +#define INITNG_CORE_BIN "@BINDIR@/initng" #endif /* INITNG_PATHS_H */ diff --git a/modules/Jamfile b/modules/Jamfile new file mode 100644 index 0000000..4c2986e --- /dev/null +++ b/modules/Jamfile @@ -0,0 +1,15 @@ +SubDir $(TOP) modules ; +SubDirHdrs $(TOP) ; +SubDirHdrs $(TOP) include ; + + +Linkflags on moddbus_event.so += -ldbus ; + +for mod in $(MODULES) +{ + MODFILES += [ ModuleFromSubdir $(mod) ] ; +} + + +MODDIR = [ FDirName $(libdir) initng ] ; +InstallBin $(DESTDIR)/$(MODDIR) : $(MODFILES) ; diff --git a/tools/Jamfile b/tools/Jamfile new file mode 100644 index 0000000..6828bfa --- /dev/null +++ b/tools/Jamfile @@ -0,0 +1,17 @@ +SubDir TOP tools ; + +SubDirHdrs $(TOP) include ; + +Main itype : itype.c ; +LinkLibraries itype : libinitng ; + +Main killalli5 : killalli5.c ; +LinkLibraries killalli5 : libinitng ; + +Main mountpoint : mountpoint.c ; + +Main sulogin : sulogin.c ; +CCFLAGS on <$(SOURCE_GRIST)>sulogin$(SUFOBJ) += -D_GNU_SOURCE ; +LINKLIBS on sulogin += -lcrypt ; + +InstallBin $(DESTDIR)/$(sbindir) : itype killalli5 sulogin ; diff --git a/tools/killalli5.c b/tools/killalli5.c index 87f0f0a..df19272 100644 --- a/tools/killalli5.c +++ b/tools/killalli5.c @@ -30,7 +30,8 @@ * 2 of the License, or (at your option) any later version. */ -#include <initng.h> +#include <initng/io.h> +#include <initng/string.h> #include <sys/types.h> #include <stdio.h> diff --git a/tools/mountpoint.c b/tools/mountpoint.c index 0a44253..216ddbf 100644 --- a/tools/mountpoint.c +++ b/tools/mountpoint.c @@ -15,6 +15,7 @@ */ #include <sys/stat.h> +#include <sys/sysmacros.h> #include <unistd.h> #include <stdlib.h> #include <string.h>
-- _______________________________________________ Initng mailing list [email protected] http://jw.dyndns.org/mailman/listinfo/initng
