#!/bin/sh # ===================================================================== # Projet : DARKMAKE # Fichier : pkg-config # Auteur : Nicolas "DarkHack" Chapuis (c) 2026 # ================== DARKHACK ================== # [ darkweb.fr - system online ] # Powered by Perplexity, your AI assistant # [https://www.perplexity.ai](https://www.perplexity.ai) # ============================================== # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===================================================================== rootDarkMake="${rootDarkMake:-/etc/darkmake}" if ! type "shInclude" > /dev/null 2>&1; then . /etc/darkcontainer/lib/shTools; shDebugEnable="1";fi # LIBRARY_PATH="$(echo $LIBRARY_PATH | addPath ':' "$path")" addPath() { local params="" local first=1 local pathsToCheck="" local pathsToAdd="" for param in $*;do if [ $first -eq 1 ];then local pathDelim="$param" else local pathsToCheck="$pathsToCheck $param"; fi local first=0 done local paths="$(cat <&0)" cmdEcho="${cmdEcho:-$(which echo)}" # if [ "$pathDelim" = "¤" ];then ## shDebug 1 "addPath 'space' for delim. $pathsToAdd" 1>&2 # local pathsToCheck="$(echo $pathsToCheck | tr -s ¤ ' ')" # else # local paths="$(echo $paths | tr -s "$pathDelim" ' ')" # fi # shDebug 1 "addPath |$pathDelim| for delim." 1>&2 for pathToCheck in $(echo $pathsToCheck | tr -s "$pathDelim" '\n' );do if [ -z "$pathToCheck" ];then continue;fi local pathFound=0 for path in $(echo $paths | tr -s "$pathDelim" '\n' );do if [ "|$path|" = "|$pathToCheck|" ];then # shDebug 1 "addPath see:$path ever inside." 1>&2 local pathFound=1 fi done if [ $pathFound -eq 0 ];then if [ -z "$pathsToAdd" ];then local pathsToAdd="$pathToCheck" else local pathsToAdd="$pathToCheck $pathsToAdd" fi fi done local pathsRedondant="$paths" local paths="" for path1 in $pathsRedondant;do local found=0 if [ -z "$path" ];then continue;fi for path2 in $paths;do if [ -z "$path" ];then continue;fi if [ "$path1" = "$path2" ];then local found=$(($found + 1)) fi done if [ $found -eq 0 ];then local paths="$paths $path1" fi done local pathFirst=1 for path in $paths;do if [ -z "$path" ];then continue;fi if [ $pathFirst -eq 1 ];then local pathFirst=0 else if [ "$pathDelim" = "¤" ];then $cmdEcho -e " \c" else $cmdEcho -e "$pathDelim\c" fi fi $cmdEcho -e "$path\c" done for path in $pathsToAdd;do if [ -z "$path" ];then continue;fi if [ $pathFirst -eq 1 ];then local pathFirst=0 else if [ "$pathDelim" = "¤" ];then $cmdEcho -e " \c" else $cmdEcho -e "$pathDelim\c" fi fi $cmdEcho -e "$path\c" done } checkDeps() { local pkgDeps="$1" local old_path_install_vars="$path_install_vars" # shDebug 1 " START : LIBS:$LIBS CFLAGS:$CFLAGS CPPFLAGS:$CPPFLAGS LDFLAGS:$LDFLAGS LD_LIBRARY_PATH:$LD_LIBRARY_PATH LIBRARY_PATH:$LIBRARY_PATH M4DIR:$M4DIR PKG_CONFIG_PATH:$PKG_CONFIG_PATH" shDebug 0 "============ Dep:$deps" if [ -n "$pkgDeps" ];then for deps in $(echo "$pkgDeps" | tr ';' ' ');do found="" PKG_LIBSNAME="" #LIBS:-l PKG_LIBS="" #CFLAGS: PKG_CFLAGS="" #CPPFLAGS:-I PKG_CPPFLAGS="" #LDFLAGS:-L PKG_LDFLAGS="" #PKG_LD_RUN_PATH:"path1:path2:path3" PKG_LD_RUN_PATH="" #PKG_LD_LIBRARY_PATH:"path1:path2:path3" PKG_LD_LIBRARY_PATH="" #PATH: "dir1:dir2" PKG_PATH="" #LIBRARY_PATH:"path1:path2:path3" PKG_LIBRARY_PATH="" #M4DIR: PKG_M4DIR="" #CONFIG_PATH #PKG_CONFIG_PATH="" MYPKG_CONFIG_PATH="" pkgConfName="" pkgInstallPath="" PKG_SEARCHLIB_FILE="" PKG_SEARCHEAD_FILE="" PKG_SEARCHEADLIB_FOLDERS="" pkgConfName="";pkgInstallPath="" . ${rootDarkMake}/$deps/global/install_vars PKG_LIBSNAME="${PKG_LIBSNAME:-$PKG_LIBS}" if [ -f "${rootDarkMake}/$deps/install/check" ];then shDebug 1 "=========== DEPS:$deps check by file : $deps/install/check" . ${rootDarkMake}/$deps/install/check else shDebug 1 "=========== DEPS:$deps check by automake :$pkgConfName:$PKG_SEARCHLIB_FILE:$pkgInstallPath" PKG_SEARCHLIB_FILE="$PKG_SEARCHLIB_FILE" PKG_SEARCHEAD_FILE="$PKG_SEARCHEAD_FILE" PKG_SEARCHEADLIB_FOLDERS="$PKG_SEARCHEADLIB_FOLDERS" \ PKG_CONFIG_PATH="$PKG_CONFIG_PATH" . ${rootDarkMake}/pkg/bin/check if [ -z "$found" ] && [ -f "${rootDarkMake}/$pkgInstallPath/install/compile" ];then shDebug 1 "! HAVE TO INSTALL this lib $pkgInstallPath";echo "Press any key to continue... ";read REPLY [ ! -d "/compile-log" ] && mkdir "/compile-log" $(which sh) "${rootDarkMake}/$pkgInstallPath/install/compile" | tee "/compile-log/$(echo $deps | tr '/' '-').log" PKG_SEARCHLIB_FILE="$PKG_SEARCHLIB_FILE" PKG_SEARCHEAD_FILE="$PKG_SEARCHEAD_FILE" PKG_SEARCHEADLIB_FOLDERS="$PKG_SEARCHEADLIB_FOLDERS" \ PKG_CONFIG_PATH="$PKG_CONFIG_PATH" . ${rootDarkMake}/pkg/bin/check fi fi dbgMsg="ADD[$pkgConfName]" if [ -n "$PKG_LIBS" ];then export LIBS="$(echo $LIBS | addPath ¤ "$PKG_LIBS")";dbgMsg="${dbgMsg} LIBS:${LIBS}";fi if [ -n "$PKG_CFLAGS" ];then export CFLAGS="$(echo $CFLAGS | addPath ¤ "$PKG_CFLAGS")";dbgMsg="${dbgMsg} CFLAGS:${CFLAGS}";fi if [ -n "$PKG_CPPFLAGS" ];then export CPPFLAGS="$(echo $CPPFLAGS | addPath ¤ "$PKG_CPPFLAGS")";dbgMsg="${dbgMsg} CPPFLAGS:${CPPFLAGS}";fi if [ -n "$PKG_LDFLAGS" ];then export LDFLAGS="$(echo $LDFLAGS | addPath ¤ "$PKG_LDFLAGS")";dbgMsg="${dbgMsg} LDFLAGS:${LDFLAGS}";fi if [ -n "$PKG_LD_LIBRARY_PATH" ];then export LD_LIBRARY_PATH="$(echo $LD_LIBRARY_PATH | addPath : "$PKG_LD_LIBRARY_PATH")";dbgMsg="${dbgMsg} LD_LIBRARY_PATH:${LD_LIBRARY_PATH}";fi if [ -n "$PKG_LD_RUN_PATH" ];then export LD_RUN_PATH="$(echo $LD_RUN_PATH | addPath : "$PKG_LD_RUN_PATH")";dbgMsg="${dbgMsg} LD_RUN_PATH:${LD_RUN_PATH}";fi if [ -n "$PKG_PATH" ];then export PATH="$(echo $PATH | addPath : "$PKG_PATH")";dbgMsg="${dbgMsg} PATH:${PATH}";fi if [ -n "$PKG_LIBRARY_PATH" ];then export LIBRARY_PATH="$(echo $LIBRARY_PATH | addPath : "$PKG_LIBRARY_PATH")";dbgMsg="${dbgMsg} LIBRARY_PATH:${LIBRARY_PATH}";fi if [ -n "$PKG_M4DIR" ];then export M4DIR="$M4DIR $PKG_M4DIR";dbgMsg="${dbgMsg} M4DIR:${M4DIR}";fi if [ -n "$PKG_LIBSNAME" ];then export LIBSNAME="$(echo $LIBSNAME | addPath ¤ "$PKG_LIBSNAME")";dbgMsg="${dbgMsg} LIBSNAME:${LIBSNAME}";fi if [ -n "$MYPKG_CONFIG_PATH" ];then export PKG_CONFIG_PATH="$(echo $PKG_CONFIG_PATH | addPath : "$MYPKG_CONFIG_PATH")";dbgMsg="${dbgMsg} PKG_CONFIG_PATH:${PKG_CONFIG_PATH}";fi shDebug 1 " ${dbgMsg}" done fi path_install_vars="$old_path_install_vars" } printEnv() { echo pkgSrc="${pkgSrc}" pwd="$(pwd)" echo AUTOM4TE="${cmdAutom4te}" AUTOCONF="${cmdAutoconf}" AUTOHEADER="${cmdAutoheader}" AUTOMAKE="${cmdAutomake}" ACLOCAL="${cmdAclocal}" echo AUTOPOINT="${cmdAutopoint}" AUTOUPDATE="${cmdAutoupdate}" AUTOSCAN="${cmdAutoscan}" echo PKG_CONFIG_PATH="${PKG_CONFIG_PATH}" PYTHONHOME="${PYTHONHOME}" echo GPERF="$GPERF" YACC="$YACC" INTLBISON="$INTLBISON" CC="$CC" CXX="$CXX" M4="$M4" echo GNULIB_SRCDIR="$GNULIB_SRCDIR" GNULIB_TOOL="$GNULIB_TOOL" echo LIBGNU_LIBS="$LIBGNU_LIBS" LIBGNU_CFLAGS="$LIBGNU_CFLAGS" LIBGNU_PATH="$LIBGNU_PATH" echo LIBTOOL_LIBS="$LIBTOOL_LIBS" LIBTOOL_CFLAGS="$LIBTOOL_CFLAGS" LIBTOOL_PATH="$LIBTOOL_PATH" LIBTOOL="$LIBTOOL" LIBTOOLIZE="$LIBTOOLIZE" echo PATH="$PATH" LIBRARY_PATH="$LIBRARY_PATH" LD_RUN_PATH="$LD_RUN_PATH" LD_LIBRARY_PATH="$LD_LIBRARY_PATH" M4DIR="$M4DIR" echo LIBS="$LIBS" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" echo pkgSrc="$pkgSrc" pkgDirLog="$pkgDirLog" filesToInit="$filesToInit" echo NETTLE_LIBS="$NETTLE_LIBS" NETTLE_CFLAGS="$NETTLE_CFLAGS" HOGWEED_LIBS="$HOGWEED_LIBS" HOGWEED_CFLAGS="$HOGWEED_CFLAGS" } # filesToInit="$( pkgSrc="${pkgSrc}" findConfigures )" findConfigures() { dbgMsg="findConfigures:" for file in $(find $pkgSrc | grep "Makefile" ) $(find $pkgSrc | grep "configure" ) $(find $pkgSrc | grep "aclocal.m4");do if [ $file = "$pkgSrc/configure" ];then continue;fi local folder="$( echo $file | rev | cut -f2- -d'/' | rev )" local filesToInit="$( echo ${filesToInit} | addPath ¤ "${folder}/configure" )" dbgMsg="${dbgMsg} $(shDirGetSubFolder $pkgSrc $folder)" done local filesToInit="$filesToInit $pkgSrc/configure" shDebug 1 " findConfigures ${dbgMsg}" >&2 echo $filesToInit }