author | Olivier Brunel
<jjk@jjacky.com> 2023-12-23 13:28:05 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2024-01-02 14:20:24 UTC |
parent | 54b76c02e6f0a1a588a39bcbe9279df7fef1a1c9 |
common.mk | +2 | -1 |
configure | +53 | -25 |
initrepo | +1 | -1 |
mkcmn | +9 | -3 |
diff --git a/common.mk b/common.mk index 7d2f64d..6cd0197 100644 --- a/common.mk +++ b/common.mk @@ -38,7 +38,7 @@ DATA = CLEAN = $(BLD_STATIC_LIBS) $(BLD_SHARED_LIBS) $(BLD_BINS) # to be removed upon `make distclean` -DISTCLEAN = .endian +DISTCLEAN = build: comain $(_DIR) comain/mkbuild @@ -211,6 +211,7 @@ clean: distclean: clean $(_CLEAN) rm -f config.mk src/include/config.h $(DISTCLEAN) + @rm -rf config.tmp repoclean: distclean $(_CLEAN) rm -f configure common.mk diff --git a/configure b/configure index b7b2b23..d2871e3 100755 --- a/configure +++ b/configure @@ -181,24 +181,47 @@ procdep_real() d="$libdir" fi + # is it lila? + local islila=0 + if ! test -e "$depdir/get_version"; then islila=1; fi + + # look for it + local vpath + local vpatha + local inc if ! test -e "$depdir/cpnt"; then - if test -e "$depdir/is_found"; then - if ! "$depdir/is_found" "$d"; then + if test $islila -eq 1; then + vpath="$d" + vpatha="$d" + if test $isint -eq 1; then d="$d/build"; fi + if ! test -d "$d/comain/$depname"; then echo $isint NOTFOUND - return fi else - if ! test -e "$d/lib$libname.so" && ! test -e "$d/lib$libname.a"; then + r=0 + vpath="$d/$($depdir/is_found $isint shared "$d" 2>/dev/null)" + if test $? -eq 0; then r=1; fi + vpatha="$d/$($depdir/is_found $isint static "$d" 2>/dev/null)" + if test $? -eq 0; then r=1; fi + if test $r -eq 0; then echo $isint NOTFOUND - return fi + + r=0 + if test $isint -eq 1; then + inc="$d" + else + inc="$incdir" + fi + inc="$inc/$($depdir/is_found $isint include "$inc" 2>/dev/null)" + if test $? -eq 0; then r=1; fi + if test $r -eq 0; then + echo $isint INCNOTFOUND + fi + incdir="$inc" fi fi - # is it lila? - local islila=0 - if ! test -e "$depdir/get_version"; then islila=1; fi - # get version local version if test $islila -eq 1; then @@ -237,19 +260,23 @@ procdep_real() # get data: libs, flags... local libs + local cflags local cppflags - local clfags local ldflags if test $islila -eq 1; then libs="$(cat "$d/libs" 2>/dev/null)" libsA="$(cat "$d/libs.static" 2>/dev/null)" + if test $isint -eq 1; then + inc="$intdir/$depname/src/lib$depname/include" + else + inc="$(cat "$d/incdir" 2>/dev/null)" + fi ldflags="$(cat "$d/ldflags" 2>/dev/null)" ldflagsA="$(cat "$d/ldflags.static" 2>/dev/null)" cflags="$(cat "$d/cflags" 2>/dev/null)" cflagsA="$(cat "$d/cflags.static" 2>/dev/null)" - if test $isint -eq 1; then - cppflags="src/lib$depname/include" - fi + cppflags="$(cat "$d/cppflags" 2>/dev/null)" + cppflagsA="$(cat "$d/cppflags.static" 2>/dev/null)" vpath="$libdir" vpathA="$libdir" else @@ -259,7 +286,8 @@ procdep_real() ldflagsA="$("$depdir/get_ldflags" static $isint "$intdir/$depname" "$libdir" "$incdir" 2>/dev/null)" cflags="$("$depdir/get_cflags" shared $isint "$intdir/$depname" "$libdir" "$incdir" 2>/dev/null)" cflagsA="$("$depdir/get_cflags" static $isint "$intdir/$depname" "$libdir" "$incdir" 2>/dev/null)" - cppflags="$("$depdir/get_incdir" $isint "$intdir/$depname" "$libdir" "$incdir" 2>/dev/null)" + cppflags="$("$depdir/get_cppflags" shared $isint "$intdir/$depname" "$libdir" "$incdir" 2>/dev/null)" + cppflagsA="$("$depdir/get_cppflags" static $isint "$intdir/$depname" "$libdir" "$incdir" 2>/dev/null)" vpath="$("$depdir/get_vpath" shared "$libdir" 2>/dev/null)" vpathA="$("$depdir/get_vpath" static "$libdir" 2>/dev/null)" fi @@ -267,16 +295,8 @@ procdep_real() d="$intdir/$depname" vpath="$d" vpathA="$d" - else - d="$incdir" - if test -z "$vpath"; then vpath="$libdir"; fi - if test -z "$vpathA"; then vpathA="$libdir"; fi - fi - if test -n "$cppflags"; then - cppflags="-isystem $d/$cppflags" - else - cppflags="-isystem $d" fi + cppflags="-isystem $inc $cppflags" # lila: dependencies? if test $islila -eq 1; then @@ -310,6 +330,7 @@ procdep_real() CFLAGS=*) cflags="$cflags $(expr substr "$arg" 8 ${#arg}) " ;; CFLAGSA=*) cflagsA="$cflagsA $(expr substr "$arg" 9 ${#arg}) " ;; CPPFLAGS=*) cppflags="$cppflags $(expr substr "$arg" 10 ${#arg}) " ;; + CPPFLAGSA=*) cppflagsA="$cppflagsA $(expr substr "$arg" 11 ${#arg}) " ;; VPATH=*) vpath="$vpath $(expr substr "$arg" 7 ${#arg}) " ;; VPATHA=*) vpathA="$vpathA $(expr substr "$arg" 8 ${#arg}) " ;; esac @@ -333,6 +354,7 @@ LDFLAGSA=$(echo $ldflagsA | tr '\n' ' ') CFLAGS=$(echo $cflags | tr '\n' ' ') CFLAGSA=$(echo $cflagsA | tr '\n' ' ') CPPFLAGS=$(echo $cppflags | tr '\n' ' ') +CPPFLAGSA=$(echo $cppflagsA | tr '\n' ' ') VPATH=$(echo $vpath | tr '\n' ' ') VPATHA=$(echo $vpathA | tr '\n' ' ') EOF @@ -354,6 +376,7 @@ procdep_error() case ${s%% *} in BADVERSION) echo "version too old" ;; NOTFOUND) echo "not found" ;; + INCNOTFOUND) echo "include dir not found" ;; NOVERSION) echo "version unknown";; NONEEDVER) echo "needed version unknown" ;; ERRDEP) echo "dependency error" ;; @@ -416,6 +439,7 @@ procdep() CFLAGS=*) depcflags="$(expr substr "$arg" 8 ${#arg}) " ;; CFLAGSA=*) depcflagsA="$(expr substr "$arg" 9 ${#arg}) " ;; CPPFLAGS=*) depcppflags="$(expr substr "$arg" 10 ${#arg}) " ;; + CPPFLAGSA=*) depcppflagsA="$(expr substr "$arg" 11 ${#arg}) " ;; VPATH=*) vpath="$(expr substr "$arg" 7 ${#arg}) " ;; VPATHA=*) vpathA="$(expr substr "$arg" 8 ${#arg}) " ;; esac @@ -478,9 +502,10 @@ procdep() if test $cpnt -ne 1; then eval idx$depname=$1 eval after$depname=0 - eval "cppflags$depname=\"$depcppflags\"" eval "cflags$depname=\"$depcflags\"" eval "cflagsA$depname=\"$depcflagsA\"" + eval "cppflags$depname=\"$depcppflags\"" + eval "cppflagsA$depname=\"$depcppflagsA\"" eval "ldflags$depname=\"$depldflags\"" eval "ldflagsA$depname=\"$depldflagsA\"" eval "libs$depname=\"$deplibs\"" @@ -1086,8 +1111,11 @@ exec 1>&5 5>&- if ! test -d src/include; then mkdir src/include; fi mv -f config.h.tmp src/include/config.h +rm -rf config.tmp +mkdir config.tmp +echo $incdir > config.tmp/incdir if test $has_skalibs -eq 1; then - echo $ENDIAN > .endian + echo $ENDIAN > config.tmp/endian fi echo "done." diff --git a/initrepo b/initrepo index 2f86bd0..e23f7ba 100755 --- a/initrepo +++ b/initrepo @@ -56,10 +56,10 @@ run cat > .gitignore <<EOF /configure /common.mk /config.mk +/config.tmp /src/include/config.h /deps /build -/*.d EOF if test -e .git; then error 2 "Already a git repo (.git exist)"; fi git init . diff --git a/mkcmn b/mkcmn index efd1ec1..acbdc8d 100755 --- a/mkcmn +++ b/mkcmn @@ -7,10 +7,16 @@ if ! test "$(expr substr "$d" 1 13)" = "build/comain/"; then fi n="$(expr substr "$d" 14 ${#d})" +if ! test -e config.tmp/incdir; then + echo "missing config.tmp/incdir" >&2 + exit 1 +fi + test -e "$d" || mkdir -p "$d" cp meta/version "$d" -echo -l$n > "$d/libs" # default -set libs libs.static cflags cflags.static ldflags ldflags.static +printf %s "-l$n" > "$d/libs" # default +cp config.tmp/incdir "$d/incdir" +set libs libs.static cflags cflags.static cppflags cppflags.static ldflags ldflags.static for ext; do if test -e meta/lib$n.$ext; then cp meta/lib$n.$ext "$d/$ext" @@ -24,7 +30,7 @@ if test -d meta/deps; then test -e "$dep/cpnt" && continue n="$(expr substr "$dep" 11 ${#dep})" mkdir "$d/deps/$n" - set version library get_version get_libs get_cflags get_ldflags get_incdir + set version library is_found get_version get_libs get_cflags get_ldflags for file; do if test -e "$dep/$file"; then cp "$dep/$file" "$d/deps/$n"