#!/bin/sh # ===================================================================== # Projet : DARKMAKE # Fichier : init # 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. # ===================================================================== if ! type "shInclude" > /dev/null; then . /etc/darksh/lib/shTools shLog="${shLog:-automake-init}" shDebugEnable="${shDebugEnable:-1}" shDebug "$*" fi # stdCleanMakeInstall --check rootDarkMake="${rootDarkMake:-/etc/darkmake}" $(shInclude ${rootDarkMake}/pkg/lib-sh/pkg-config) cmdAutomake="${cmdAutomake:-$(which automake)}" cmdAclocal="${cmdAclocal:-$(which aclocal)}" shErrorOnMissing "pkgSrc pkgDirLog filesToInit" automakelog="${pkgDirLog}/1_automake" if [ ! -d "${automakelog}" ];then mkdir "${automakelog}";fi cpt=0 #shDebug 1 " M4DIR:$M4DIR" M4DIR="$(echo $M4DIR | addPath ¤ "-I$pkgSrc/m4")" M4DIR="$(echo $M4DIR | addPath ¤ "-I$pkgSrc")" #acLocalList="${acLocalList:-ltargz.m4 ltdl.m4 alloca.m4}" #acLocalDests="${acLocalDests:-${pkgSrc}}" automakePkgDirLogOld="$pkgDirLog" if [ ! -d "$pkgDirLog/0_autoconf" ];then mkdir "$pkgDirLog/0_autoconf";fi pkgDirLog="$pkgDirLog/0_autoconf" \ . ${rootDarkMake}/lib/autotools/autoconf/install/init pkgDirLog="$automakePkgDirLogOld" if [ -f "$pkgSrc/configure" ];then shDebug 1 " $pkgSrc/configure exist mv $pkgSrc/configure $pkgSrc/_configure.first" mv $pkgSrc/configure $pkgSrc/_configure.first # return ; fi # TOOL CHAIN PARAM ACLOCAL_PARAM="${ACLOCAL_PARAM:-$M4DIR --force --verbose}" #AUTOMAKE_CONF="${AUTOMAKE_CONF:--acf --foreign --add-missing --force-missing }" #AUTOMAKE_CONF="${AUTOMAKE_CONF:--acf --gnu --add-missing --force-missing }" AUTOMAKE_CONF="${AUTOMAKE_CONF:--acf --add-missing --force-missing}" AUTOPOINT_CONF="${AUTOPOINT_CONF:---force}" GETTEXTIZE_CONF="${GETTEXTIZE_CONF:--f}" # shDebug 1 "AUTOMAKE INIT === ( $ACLOCAL_PARAM/$AUTOMAKE_CONF/$AUTOPOINT_CONF ) ===" cptFolder=0 for file in $filesToInit;do #if [ -f "$file" ];then rm $file;fi folder=$(echo $file | rev | cut -f2- -d'/' | rev) if [ ! -d "$folder" ];then shDebug 0 "AUTOMAKE INIT = NOT AN FOLDER:$folder";continue;fi cd $folder cptFolder=$((cptFolder + 1 )) subFolder="$(shDirGetSubFolder $pkgSrc $folder)" strSubId="$(shDirGenerateSubId $pkgSrc $folder)" automakelog="${pkgDirLog}/1_automake/${cptFolder}_$strSubId" # shDebug 1 "init:$subFolder" # shDebug 1 "automake init:${subFolder}" # $folder/*.m4 if [ -f "${folder}/configure.in" ] || [ -f "${folder}/configure.ac" ];then if [ ! -d "$automakelog" ];then mkdir "$automakelog";fi if [ ! -d "${folder}/m4" ];then mkdir "${folder}/m4";fi if [ -x "${cmdGettextize}" ];then cpt=$((cpt + 1 )); fileLog="$automakelog/${cpt}-gettextize.log" #shDebug 1 "automake[$subFolder] gettextize( ${GETTEXTIZE_CONF} )" printEnv > $fileLog echo ${cmdGettextize} ${GETTEXTIZE_CONF} >> $fileLog ${cmdGettextize} ${GETTEXTIZE_CONF} 2>&1 | tee $fileLog fi if [ -x "${cmdAutopoint}" ];then cpt=$((cpt + 1 )); fileLog="$automakelog/${cpt}-autopoint.log" #shDebug 1 "automake[$subFolder] autopoint( ${AUTOPOINT_CONF} )" printEnv > $fileLog echo ${cmdAutopoint} ${AUTOPOINT_CONF} >> $fileLog ${cmdAutopoint} ${AUTOPOINT_CONF} >> $fileLog 2>&1 fi fi # if [ -f "${folder}/configure.ac" ];then # && [ ! -f $folder/Makefile.am ];then if [ ! -f $folder/configure.ac ];then #shDebug 0 "automake[$subFolder] no configure.ac." continue; else if [ ! -d "$automakelog" ];then mkdir "$automakelog";fi if [ ! -d "${folder}/m4" ];then mkdir "${folder}/m4";fi if [ -f $folder/aclocal.m4 ] && [ -z "$noDeleteAclocal" ];then # shDebug 1 "automake[$subFolder] clear aclocal" rm $folder/aclocal.m4 fi cpt=$((cpt + 1 )); fileLog="$automakelog/${cpt}-aclocal.log" #shDebug 1 "automake[$subFolder] aclocal( $ACLOCAL_PARAM )" printEnv > $fileLog echo ${cmdAclocal} $ACLOCAL_PARAM >> $fileLog ${cmdAclocal} $ACLOCAL_PARAM >> $fileLog 2>&1 if [ "$AUTOMAKE_CONF" = "none" ];then shDebug 0 "automake[$subFolder] AUTOMAKE_CONF defined 'none'." else cpt=$((cpt + 1 )); fileLog="$automakelog/${cpt}-subautomake.log" printEnv > $fileLog for subAutomakeFile in $( find . | grep Makefile.am$ );do if [ -z "${subAutomakeFile}" ];then continue;fi automakeSubFolder="$(echo ${subAutomakeFile} | rev | cut -f2- -d'/' | rev)" shDebug 1 "${subAutomakeSubFolder}:${subAutomakeFile} ==================================================="; echo ${cmdAutomake} $AUTOMAKE_CONF ${automakeSubFolder}/Makefile >> $fileLog ${cmdAutomake} $AUTOMAKE_CONF ${automakeSubFolder}/Makefile >> $fileLog 2>&1 done cpt=$((cpt + 1 )); fileLog="$automakelog/${cpt}-automake.log" shDebug 1 "automake[$subFolder] automake( $AUTOMAKE_CONF )"; printEnv > $fileLog echo ${cmdAutomake} $AUTOMAKE_CONF >> $fileLog if [ ! -f $folder/Makefile.am ];then shDebug 1 "automake[$subFolder] !!!!!! .in to am or root to am !!!!!!!!!!!!!!!!!!!!!!!!!!!!"; if [ -f $folder/Makefile.in ];then cp "$folder/Makefile.in" "$folder/Makefile.am"; elif [ -f $folder/Makefile ];then cp "$folder/Makefile" "$folder/Makefile.am";fi fi ${cmdAutomake} $AUTOMAKE_CONF >> $fileLog 2>&1 ${cmdAutomake} $AUTOMAKE_CONF Makefile >> $fileLog 2>&1 #if [ -f "$folder/configure~" ];then # echo "mv $folder/configure~ $folder/configure !!!!!!!!!!!!!!!!!" >> $fileLog # echo "**** mv $folder/configure~ $folder/configure !!!!!!!!!!!!!!!!! *********************" >&2 # mv "$folder/configure~" "$folder/configure" #fi if [ ! -f $folder/Makefile.in ];then cp "$folder/Makefile.am" "$folder/Makefile.in";fi fi fi done #for file in $(find "${pkgSrc}" | grep touchDW_autoupdate$ );do # rm "${file}" #done automakePkgDirLogOld="$pkgDirLog" if [ ! -d "$pkgDirLog/2_autoconf" ];then mkdir "$pkgDirLog/2_autoconf";fi pkgDirLog="$pkgDirLog/2_autoconf" \ . ${rootDarkMake}/lib/autotools/autoconf/install/init pkgDirLog="$automakePkgDirLogOld" #cpt=$((cpt + 1 )); #fileLog="${automakelog}/${cpt}-m4.log" #echo "$(date) ========= M4" >> "${fileLog}" 2>&1 #acLocalAllDest="" #for acLocalDest in ${acLocalDests} ;do # if [ -z "${acLocalDest}" ];then continue;fi # if [ -n "${acLocalAllDest}" ];then acLocalAllDest="${acLocalAllDest} ${acLocalDest}/m4"; # else acLocalAllDest="${acLocalDest}/m4";fi #done #for acLocalDest in ${acLocalFullDests} ;do # if [ -z "${acLocalDest}" ];then continue;fi # if [ -n "${acLocalAllDest}" ];then acLocalAllDest="${acLocalAllDest} ${acLocalDest}"; # else acLocalAllDest="${acLocalDest}";fi #done #for acLocalDest in ${acLocalAllDest} ;do # if [ -z "${acLocalDest}" ];then continue;fi # [ ! -d "${acLocalDest}" ] && mkdir "${acLocalDest}" # for acLocalFile in ${acLocalList};do # if [ -f "${acLocalDest}/$acLocalFile" ];then # shDebug 1 "automake aclocal m4 no replace ${acLocalFile} ${acLocalDest} !" # # rm ${acLocalDest}/$acLocalFile # else # for acLocalSrc in /usr/share/aclocal /usr/share/gnulib/autotools/m4;do # if [ -f "${acLocalSrc}/${acLocalFile}" ] && [ ! -f "${acLocalDest}/${acLocalFile}" ];then # shDebug 1 "automake m4 cp missing ${acLocalSrc}/${acLocalFile} ${acLocalDest}" # cp "${acLocalSrc}/${acLocalFile}" "${acLocalDest}/${acLocalFile}" \ # && echo cp "${acLocalSrc}/${acLocalFile}" "${acLocalDest}/${acLocalFile}" >> "${fileLog}" 2>&1 # fi # done # fi # done #done