diff options
| author | PS <p@0x53.net> | 2026-03-10 22:42:08 +0100 |
|---|---|---|
| committer | PS <p@0x53.net> | 2026-03-10 22:42:08 +0100 |
| commit | 39af33c6d066a06b89c457cd9353d2f259cd5eb5 (patch) | |
| tree | dfbc9a2bfb005641260ad99b4040a04eec1d4a65 | |
| parent | ad6504669cc0fcb4a6cd12c984122ccb7c872c5c (diff) | |
| download | linux-supplements-39af33c6d066a06b89c457cd9353d2f259cd5eb5.tar.gz linux-supplements-39af33c6d066a06b89c457cd9353d2f259cd5eb5.tar.bz2 linux-supplements-39af33c6d066a06b89c457cd9353d2f259cd5eb5.zip | |
| -rw-r--r-- | Makefile | 55 | ||||
| -rwxr-xr-x | configure | 74 |
2 files changed, 81 insertions, 48 deletions
@@ -25,10 +25,13 @@ LIB_DEFS := BIN_SYMLINKS := TEST_BINS := +-include config.mak +include package/targets.mak + define library_definition -LIB$(1) := lib$(2).$(if $(DO_ALLSTATIC),a,so).xyzzy +LIB$(1) := lib$(2).$(if $(DO_ALLSTATIC),a,$(SHLIB_EXT)).xyzzy ifdef DO_SHARED -SHARED_LIBS += lib$(2).so.xyzzy +SHARED_LIBS += lib$(2).$(SHLIB_EXT).xyzzy endif ifdef DO_STATIC STATIC_LIBS += lib$(2).a.xyzzy @@ -39,6 +42,7 @@ endif lib$(2).pc: exec env \ + prefix="$(prefix)" \ library="$(2)" \ includedir="$(includedir)" \ dynlibdir="$(dynlibdir)" \ @@ -67,9 +71,6 @@ $(DESTDIR)$(1)/$(2): $(DESTDIR)$(1)/$(SYMLINK_TARGET_$(2)) exec $(INSTALL) -l $$(<F) $$@ endef --include config.mak -include package/targets.mak - $(foreach var,$(LIB_DEFS),$(eval $(call library_definition,$(firstword $(subst =, ,$(var))),$(lastword $(subst =, ,$(var)))))) include package/deps.mak @@ -108,12 +109,12 @@ distclean: clean tgz: distclean @. package/info && \ - rm -rf ../../stage/$$package-$$version && \ - cp -a . ../../stage/$$package-$$version && \ - cd ../../stage && \ - tar -zpcv --owner=0 --group=0 --numeric-owner --exclude=.git* -f $$package-$$version.tar.gz $$package-$$version && \ + rm -rf /tmp/$$package-$$version && \ + cp -a . /tmp/$$package-$$version && \ + cd /tmp && \ + tar -zpcv --owner=0 --group=0 --numeric-owner --exclude=.git* -f /tmp/$$package-$$version.tar.gz $$package-$$version && \ sha256sum $$package-$$version.tar.gz > $$package-$$version.tar.gz.sha256 && \ - exec rm -rf $$package-$$version + exec rm -rf /tmp/$$package-$$version strip: $(ALL_LIBS) $(ALL_BINS) ifneq ($(strip $(STATIC_LIBS)),) @@ -124,7 +125,7 @@ ifneq ($(strip $(ALL_BINS)$(SHARED_LIBS)),) endif install: install-dynlib install-libexec install-bin install-symlinks install-lib install-include install-pkgconfig -install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so) +install-dynlib: $(SHARED_LIBS:lib%.$(SHLIB_EXT).xyzzy=$(DESTDIR)$(dynlibdir)/lib%.$(SHLIB_EXT)) install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%) install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%) install-symlinks: $(BIN_SYMLINKS:%=$(DESTDIR)$(bindir)/%) @@ -156,10 +157,10 @@ $(DESTDIR)$(sproot)/library.so/lib%.so.$(version_M): $(DESTDIR)$(dynlibdir)/lib% endif -$(DESTDIR)$(dynlibdir)/lib%.so $(DESTDIR)$(dynlibdir)/lib%.so.$(version_M): lib%.so.xyzzy - $(INSTALL) -D -m 755 $< $@.$(version) && \ - $(INSTALL) -l $(@F).$(version) $@.$(version_M) && \ - exec $(INSTALL) -l $(@F).$(version_M) $@ +$(DESTDIR)$(dynlibdir)/lib%.so $(DESTDIR)$(dynlibdir)/lib%.so.$(version_M) $(DESTDIR)$(dynlibdir)/lib%.so.$(version): lib%.so.xyzzy + $(INSTALL) -D -m 755 $< $(@D)/lib$(*F).so.$(version) && \ + $(INSTALL) -l lib$(*F).so.$(version) $(@D)/lib$(*F).so.$(version_M) && \ + exec $(INSTALL) -l lib$(*F).so.$(version_M) $(@D)/lib$(*F).so $(DESTDIR)$(libdir)/lib%.a: lib%.a.xyzzy exec $(INSTALL) -D -m 644 $< $@ @@ -192,3 +193,27 @@ lib%.so.xyzzy: .PHONY: it all clean distclean tests check tgz strip install install-dynlib install-bin install-lib install-include install-pkgconfig .DELETE_ON_ERROR: + +ifeq ($(SHLIB_EXT),dylib) + +version_X := $(shell exec expr 256 '*' $(version_l) + $(subst .,,$(suffix $(version_M)))) +version_XY := $(version_X)$(suffix $(version_m)) +version_XYZ := $(version_XY)$(suffix $(version)) + +ifneq ($(exthome),) +global-links: $(SHARED_LIBS:lib%.dylib.xyzzy=$(DESTDIR)$(sproot)/library.so/lib%.$(version_X).dylib) + +$(DESTDIR)$(sproot)/library.so/lib%.$(version_X).dylib: $(DESTDIR)$(sproot)/library.so/lib%.$(version_M).dylib + exec $(INSTALL) -l $(<F) $@ +endif + +$(DESTDIR)$(dynlibdir)/lib%.dylib $(DESTDIR)$(dynlibdir)/lib%.$(version_X).dylib $(DESTDIR)$(dynlibdir)/lib%.$(version_M).dylib $(DESTDIR)$(dynlibdir)/lib%.$(version).dylib: lib%.dylib.xyzzy + $(INSTALL) -D -m 755 $< $(@D)/lib$(*F).$(version).dylib && \ + $(INSTALL) -l lib$(*F).$(version).dylib $(@D)/lib$(*F).$(version_M).dylib && \ + $(INSTALL) -l lib$(*F).$(version_M).dylib $(@D)/lib$(*F).$(version_X).dylib && \ + exec $(INSTALL) -l lib$(*F).$(version_X).dylib $(@D)/lib$(*F).dylib + +lib%.dylib.xyzzy: $(ALL_DOBJS) + exec $(CC) -o $@ $(CFLAGS_ALL) $(CFLAGS_SHARED) $(LDFLAGS_ALL) $(LDFLAGS_SHARED) -Wl,-dylib_install_name,$(dynlibdir)/lib$(*F).$(version_M).dylib -Wl,-dylib_compatibility_version,$(version_XY) -Wl,-dylib_current_version,$(version_XYZ) -undefined dynamic_lookup $^ $(EXTRA_LIBS) $(SOCKET_LIB) $(SPAWN_LIB) $(SYSCLOCK_LIB) $(TAINNOW_LIB) $(TIMER_LIB) $(UTIL_LIB) $(LDLIBS) +endif + @@ -25,6 +25,9 @@ Fine tuning of the installation directories: --includedir=DIR C header files [PREFIX/include] --sysconfdir=DIR global configuration files [PREFIX/etc] --pkgconfdir=DIR pkg-config .pc files [PREFIX/lib/pkgconfig] + --bootdb=PATH default path for the boot database [SYSCONFDIR/s6-rc/compiled/current] + --livedir=DIR default live directory [/run/s6-rc] + --repodir=DIR default repo directory [/var/lib/s6-rc/repository] If no --prefix option is given, by default libdir (but not dynlibdir) will be /usr/lib, and includedir will be /usr/include. @@ -48,8 +51,7 @@ Optional features: --enable-pkgconfig Build and install .pc files for pkg-config [disabled] --enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled] --enable-absolute-paths hardcode absolute BINDIR/foobar paths in binaries [disabled] - --enable-nsss use the nsss library for user information [disabled] - --disable-execline don't use the execline library [enabled] + --with-default-bundle=def name of the bundle started at boot [default] EOF exit 0 @@ -149,6 +151,7 @@ pkgconfdir='$prefix/lib/pkgconfig' shebangdir='$bindir' sysdeps='$prefix/lib/skalibs/sysdeps' manualsysdeps=false +shlibext=so shared=false static=true allpic=true @@ -169,8 +172,10 @@ deplibpath='' vpaths='' vpathd='' build= -usensss=false -useexecline=true +bootdb='$sysconfdir/s6-rc/compiled/current' +livedir=/run/s6-rc +repodir=/var/lib/s6-rc/repository +defaultbundle=default for arg ; do case "$arg" in @@ -195,9 +200,9 @@ for arg ; do --disable-shared|--enable-shared=no) shared=false ;; --enable-static|--enable-static=yes) static=true ;; --disable-static|--enable-static=no) static=false ;; - --enable-allstatic|--enable-allstatic=yes) allstatic=true ;; - --disable-allstatic|--enable-allstatic=no) allstatic=false ; evenmorestatic=false ;; - --enable-static-libc|--enable-static-libc=yes) allstatic=true ; evenmorestatic=true ;; + --enable-allstatic|--enable-allstatic=yes) static=true ; allstatic=true ;; + --disable-allstatic|--enable-allstatic=no) allstatic=false ; evenmorestatic=false ; shared=true ;; + --enable-static-libc|--enable-static-libc=yes) static=true ; allstatic=true ; evenmorestatic=true ;; --disable-static-libc|--enable-static-libc=no) evenmorestatic=false ;; --enable-all-pic|--enable-all-pic=yes) allpic=true ;; --disable-all-pic|--enable-all-pic=no) allpic=false ;; @@ -208,10 +213,11 @@ for arg ; do --disable-slashpackage) sproot= ; slashpackage=false ;; --enable-absolute-paths|--enable-absolute-paths=yes) abspath=true ;; --disable-absolute-paths|--enable-absolute-paths=no) abspath=false ;; - --enable-nsss|--enable-nsss=yes) usensss=true ;; - --disable-nsss|--enable-nsss=no) usensss=false ;; - --enable-execline|--enable-execline=yes) useexecline=true ;; - --disable-execline|--enable-execline=no) useexecline=false ;; + --bootdb=*) bootdb=${arg#*=} ;; + --livedir=*) livedir=${arg#*=} ;; + --repodir=*) repodir=${arg#*=} ;; + --with-default-bundle=*) defaultbundle=${arg#*=} ;; + --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;; --host=*|--target=*) target=${arg#*=} ;; @@ -240,7 +246,7 @@ fi # Expand installation directories stripdir prefix -for i in exec_prefix dynlibdir libexecdir bindir libdir includedir sysconfdir pkgconfdir sysdeps sproot ; do +for i in exec_prefix dynlibdir libexecdir bindir libdir includedir sysconfdir pkgconfdir sysdeps sproot bootdb livedir repodir ; do eval tmp=\${$i} eval $i=$tmp stripdir $i @@ -379,16 +385,25 @@ if test ! -d $sysdeps || test ! -f $sysdeps/target ; then echo "$0: error: $sysdeps is not a valid sysdeps directory" exit 1 fi -if [ "x$target" != "x$(cat $sysdeps/target)" ] ; then +if test "$target" != "$(cat $sysdeps/target)" ; then echo "$0: error: target $target does not match the contents of $sysdeps/target" exit 1 fi +echo "Shared libraries will be named ..." +libc="${target##*-}" +if test "${libc##darwin}" != "$libc" ; then + shlibext=dylib +fi +echo " ... *.$shlibext" + if $allpic ; then tryflag CPPFLAGS_AUTO -fPIC fi -spawn_lib=$(cat $sysdeps/spawn.lib) + +pthread_lib=$(cat $sysdeps/pthread.lib) socket_lib=$(cat $sysdeps/socket.lib) +spawn_lib=$(cat $sysdeps/spawn.lib) sysclock_lib=$(cat $sysdeps/sysclock.lib) timer_lib=$(cat $sysdeps/timer.lib) util_lib=$(cat $sysdeps/util.lib) @@ -457,8 +472,10 @@ home := $home exthome := $exthome extra_includedirs :=$depincpath extra_libdirs :=$deplibpath -SPAWN_LIB := ${spawn_lib} + +PTHREAD_LIB := ${pthread_lib} SOCKET_LIB := ${socket_lib} +SPAWN_LIB := ${spawn_lib} SYSCLOCK_LIB := ${sysclock_lib} TIMER_LIB := ${timer_lib} UTIL_LIB := ${util_lib} @@ -473,16 +490,17 @@ LDFLAGS := ${LDFLAGS}${LDFLAGS_POST:+ }$LDFLAGS_POST LDFLAGS_SHARED := $LDFLAGS_SHARED LDFLAGS_NOSHARED :=$LDFLAGS_NOSHARED CROSS_COMPILE := $cross +SHLIB_EXT := ${shlibext} vpath lib%.a$vpaths -vpath lib%.so$vpathd +vpath lib%.${shlibext}$vpathd EOF if $allstatic ; then echo ".LIBPATTERNS := lib%.a" echo "DO_ALLSTATIC := 1" else - echo ".LIBPATTERNS := lib%.so" + echo ".LIBPATTERNS := lib%.${shlibext}" echo "DO_ALLSTATIC :=" fi if $static ; then @@ -505,18 +523,7 @@ if $allpic ; then else echo "STATIC_LIBS_ARE_PIC :=" fi -if $usensss ; then - echo "LIBNSSS := -lnsss" - echo "MAYBEPTHREAD_LIB := -lpthread" -else - echo "LIBNSSS :=" - echo "MAYBEPTHREAD_LIB :=" -fi -if $useexecline ; then - echo "EXECLINE_LIB := -lexecline" -else - echo "EXECLINE_LIB :=" -fi + exec 1>&3 3>&- echo " ... done." @@ -548,10 +555,11 @@ else fi echo "#define ${package_macro_name}_LIBEXECPREFIX \"$libexecdir/\"" echo "#define ${package_macro_name}_SYSCONFPREFIX \"$sysconfdir/\"" -echo "#undef ${package_macro_name}_USE_EXECLINE" -if $useexecline ; then - echo "#define ${package_macro_name}_USE_EXECLINE" -fi +echo "#define ${package_macro_name}_BOOTDB \"$bootdb\"" +echo "#define ${package_macro_name}_LIVEDIR \"$livedir\"" +echo "#define ${package_macro_name}_REPODIR \"$repodir\"" +echo "#define ${package_macro_name}_DEFBUNDLE \"$defaultbundle\"" + echo echo "#endif" exec 1>&3 3>&- |
