author | Olivier Brunel
<jjk@jjacky.com> 2023-05-25 11:24:10 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-06-20 07:07:15 UTC |
parent | 218e9929fdd4f92fc30fb1935a0c0814212d1b30 |
blddeps | +42 | -0 |
build/comain/comain/version | +0 | -1 |
common.mk | +4 | -23 |
configure | +10 | -30 |
getdeps | +26 | -22 |
meta/deps.tpl/limb/configure | +1 | -1 |
diff --git a/blddeps b/blddeps new file mode 100755 index 0000000..652abad --- /dev/null +++ b/blddeps @@ -0,0 +1,42 @@ +#!/bin/sh + +. "$(dirname $0)"/libcomain + +getdep() +{ + local dep=$2 + local depname="${dep##*/}" + local needed + eval needed=\"\$need$depname\" + local rec="$3" + local cpnt=0 + test -e "$dep/cpnt" && cpnt=1 + if test $cpnt -eq 1; then return; fi + local library=$depname + test -e "$dep/library" && library="$(cat "$dep/library")" + if ! test -e "deps/$depname"; then return; fi + echo $depname lib$library $(cat "$dep/configure" 2>/dev/null) + + # recursive lila dependency + if ! test -d "deps/$depname/meta/deps"; then return; fi + for d in "deps/$depname"/meta/deps/*; do + if ! test -d "$d"; then continue; fi + getdep 0 "$d" "$rec " + done +} + +loadoptions +loaddeps + +foreach deps $nb_deps getdep | tac | while read -r name library arg; do + if test -e "deps/$name/$library.a" || test -e "deps/$name/$library.so"; then + echo $name already built. + continue + fi + echo Building $name + cd deps/$name + ./configure $arg && make + cd ../.. +done + +echo "done." diff --git a/build/comain/comain/version b/build/comain/comain/version deleted file mode 120000 index 19d2fe8..0000000 --- a/build/comain/comain/version +++ /dev/null @@ -1 +0,0 @@ -../../../meta/version \ No newline at end of file diff --git a/common.mk b/common.mk index 37d8205..14f85f5 100644 --- a/common.mk +++ b/common.mk @@ -89,7 +89,7 @@ build/%.lo: src/%.c Makefile common.mk config.mk project.mk | build -c $< @test -e $(@:%.lo=%.d) && mv $(@:%.lo=%.d) $(@:%.lo=%.lo.d) -build/comain/%: $(LIBS) +build/comain/%: $(_SAY) Making comain confdir : $(_CMN) comain/mkcmn $@ @@ -114,9 +114,6 @@ lib%.so: -o $@ \ $^ -# dependencies to try and make automatically -BUILD_DEPS = - DESTDOC = $(DESTDIR)$(SHAREDIR)/doc/$(PROJECT_NAME) INSTDOC = $(_INST) install -D -m 644 $< $@ @@ -195,11 +192,7 @@ install: install-bins install-libs install-priv install-docs install-data clean: $(_CLEAN) rm -rf build ; rm -f $(CLEAN) -cleandeps: - $(_CLEAN) rm -f $(BUILD_DEPS) - $(foreach file,$(BUILD_DEPS),@make -C $(subst .built,,$(file)) clean) - -distclean: clean cleandeps +distclean: clean $(_CLEAN) rm -f config.mk src/include/config.h repoclean: distclean @@ -219,19 +212,7 @@ _INST = $(if $(V),,$(call say," INST ")$@;) _CMN = $(if $(V),,$(call say," CMN ")$@;) -$(BUILD_DEPS): Makefile common.mk - $(_MAKE) cd $(subst .built,,$@) \ - && ./configure --bindir=$(BINDIR) --libdir=$(LIBDIR) \ - --incdir=$(INCDIR) --sharedir=$(SHAREDIR) \ - $$(cd .. && cat meta/deps/$(subst .built,,$@)/configure) \ - && make - @touch $@ - -$(BLD_STATIC_LIBS) $(BLD_SHARED_LIBS) $(BLD_BINS): | $(BUILD_DEPS) - -all: doc $(BLD_STATIC_LIBS) $(BLD_SHARED_LIBS) $(BLD_BINS) - -deps: $(BUILD_DEPS) +all: doc $(BLD_STATIC_LIBS) $(BLD_SHARED_LIBS) $(BLD_BINS) $(LIBS:%=build/comain/%) doc: $(BLD_MD0) $(BLD_MD1) $(BLD_MD2) $(BLD_MD3) $(BLD_MD4) $(BLD_MD5) \ $(BLD_MD6) $(BLD_MD7) $(BLD_MD8) $(BLD_MD9) @@ -249,4 +230,4 @@ $(BLD_BINS): $^ .PHONY: install-bins install-libs install-priv install-docs install-data install \ - clean cleandeps distclean repoclean + clean distclean repoclean diff --git a/configure b/configure index 67f22d6..83860f7 100755 --- a/configure +++ b/configure @@ -98,7 +98,6 @@ COMMON_CPPFLAGS_SHARED= COMMON_CFLAGS_SHARED= COMMON_LDFLAGS_SHARED= VPATHS="# this will handle prefer or set shared/static" -BUILD_DEPS= loadoptions @@ -196,12 +195,16 @@ procdep_real() # get version local version if test $islila -eq 1; then - if test $isint -eq 1; then - d="$intdir/$depname/build" + if test -e "$depdir/cpnt"; then + d="$intdir/$depname/meta" else - d="$libdir" + if test $isint -eq 1; then + d="$intdir/$depname/build" + else + d="$libdir" + fi + d="$d/comain/$depname" fi - d="$d/comain/$depname" version="$(cat "$d/version" 2>/dev/null)" else version="$("$depdir/get_version" $isint "$intdir/$depname" "$libdir" "$incdir" 2>/dev/null)" @@ -496,28 +499,8 @@ vpath lib%.a $vpath vpath lib%.so $vpath" fi - if test $internal -eq 1; then - if test -e "$dep/configure"; then - local f= - local e= - if test $link -eq 1; then - f="$vpathso" - e=so - else - f="$vpatha" - e=a - fi - f="$f/lib$library.$e" - if test -e "$f"; then - touch "$depdir.built" - fi - - BUILD_DEPS="$BUILD_DEPS $depdir.built" - fi - - if test $depname = "skalibs"; then - sysdeps="$depdir/sysdeps.cfg" - fi + if test $internal -eq 1 && test $depname = "skalibs"; then + sysdeps="$depdir/sysdeps.cfg" fi fi } @@ -971,9 +954,6 @@ CFLAGS += $CFLAGS LDFLAGS += $LDFLAGS $PER_FLAGS - -# special dependencies we try to make automatically -BUILD_DEPS = $BUILD_DEPS EOF exec 1>&5 5>&- diff --git a/getdeps b/getdeps index 613ad75..1f3b966 100755 --- a/getdeps +++ b/getdeps @@ -31,6 +31,8 @@ showdep() local needed eval needed=\"\$need$depname\" local rec="$3" + local cpnt=0 + test -z "$rec" && test -e "$dep/cpnt" && cpnt=1 echon "$rec- $depname version $(cat $dep/version)" if test -z "$rec" && test "$needed" != "1"; then echon " [optional: --with-$(echo $needed | sed "s/ /, --with-/g")]" @@ -40,11 +42,10 @@ showdep() if test -f "$dep/git" ; then echo "$rec repo : $(cat $dep/git)" ; fi if test -f "$dep/ref" ; then echo "$rec ref : $(cat $dep/ref)" ; fi - local dst= - if ! test -e "$dep/cpnt"; then dst="deps"; fi # recursive lila dependency - if ! test -d "$dst/$depname/meta/deps"; then return; fi - for d in "$dst/$depname"/meta/deps/*; do + if test $cpnt -eq 1; then return; fi + if ! test -d "deps/$depname/meta/deps"; then return; fi + for d in "deps/$depname"/meta/deps/*; do if ! test -d "$d"; then continue; fi showdep 0 "$d" "$rec " done @@ -65,30 +66,30 @@ getdep() local depname="${dep##*/}" local intonly=$3 local rec=$4 - if test -z "$rec"; then rec="."; fi - local cpnt= - if test -z "$rec" && test -e "$dep/cpnt"; then - cpnt=1 - dst="$depname" + local cpnt=0 + test -e "$dep/cpnt" && cpnt=1 + if test $cpnt -eq 1; then + if test "$(expr substr "$dep" 1 5)" = "deps/"; then + dst="${dep%/meta/deps/*}" + else + dst="." + fi else - cpnt=0 - dst="deps/$depname" + dst="deps" fi - if test $intonly -eq 1 && test ! -e "$dep/files"; then return; fi + if test $intonly -eq 1 && test $cpnt -eq 0 && test ! -e "$dep/files"; then return; fi echo "getting $depname..." if ! test -e "deps"; then run mkdir "deps"; fi - if test -e "$dst"; then - warn "cannot clone: '$dst' already exists" - if test -z "$rec" && test $cpnt -eq 1 && ! test -e "deps/$depname"; then - run ln -s "../$depname" "deps/$depname" - fi + if test -e "$dst/$depname"; then + warn "cannot clone: '$dst/$depname' already exists" else - run git clone "$(cat $dep/git)" "deps/$depname" + run git clone "$(cat $dep/git)" "$dst/$depname" local ref="$(cat $dep/ref 2>/dev/null)" if test -z "$ref"; then ref="$(cat $dep/version)"; fi run git -C "deps/$depname" checkout -b "$prjname" "$ref" - - if test $cpnt -eq 1; then ln -s "deps/$depname" "$depname"; fi + fi + if test $cpnt -eq 1 && ! test -e "$dst/deps/$depname"; then + run ln -s "../$depname" "$dst/deps/$depname" fi # recursive lila dependency @@ -130,15 +131,18 @@ for arg ; do intdeps) foreach deps $nb_deps getdep 1;; deps) foreach deps $nb_deps getdep 0;; dep) isdep=1 ;; + all) ;; -h|--help|help) usage 0 ;; *) error 1 "unknown action '$arg'" ;; esac done -if test -z "$arg"; then +if test -z "$arg" || test "$arg" = "all"; then foreach cpnt $nb_cpnt getdep 0 - foreach deps $nb_deps getdep 1 + intonly=1 + test "$arg" = "all" && intonly=0 + foreach deps $nb_deps getdep $intonly fi echo "done." diff --git a/meta/deps.tpl/limb/configure b/meta/deps.tpl/limb/configure index 4928a4a..1661455 100644 --- a/meta/deps.tpl/limb/configure +++ b/meta/deps.tpl/limb/configure @@ -1 +1 @@ ---no-shared +--no-doc --no-shared