Magellan Linux

Diff of /trunk/mage/usr/lib/mage/smage2.functions.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2842 by niro, Fri Oct 31 14:50:27 2014 UTC revision 3181 by niro, Mon Jul 31 09:23:35 2023 UTC
# Line 261  src_install() Line 261  src_install()
261    
262  mlibdir()  mlibdir()
263  {  {
264   local libdir=lib   local libdir="${ABI_DEFAULT_LIBDIR}"
265   [[ ${ARCH} = x86_64 ]] && libdir=lib64   [[ ${ARCH} = i686 ]] && libdir="${ABI_X86_LIBDIR}"
266     [[ ${ARCH} = x86_64 ]] && libdir="${ABI_X86_64_LIBDIR}"
267     [[ -n ${ABI_LIBDIR} ]] && libdir="${ABI_LIBDIR}"
268    
269   echo "${libdir}"   echo "${libdir}"
270  }  }
271    
272  mconfigure()  mconfigure()
273  {  {
274     local configure_exec="./configure"
275    
276     if [[ ! -z ${MCONFIGURE_EXEC} ]]
277     then
278     if [ -x ${MCONFIGURE_EXEC} ]
279     then
280     echo -e "${COLBLUE}*** ${COLGREEN}Using '${MCONFIGURE_EXEC}' as configure script${COLDEFAULT}"
281     configure_exec="${MCONFIGURE_EXEC}"
282     else
283     die "MCONFIGURE_EXEC '${MCONFIGURE_EXEC}' not executable"
284     fi
285     fi
286    
287     if [ ! -x ${configure_exec} ]
288     then
289     die "${configure_exec} not executable"
290     fi
291    
292   local myopts   local myopts
293   if [[ ! -z ${CTARGET} ]]   if [[ ! -z ${CTARGET} ]]
294   then   then
295   myopts+=" --target=${CTARGET}"   myopts+=" --target=${CTARGET}"
296   fi   fi
297    
298   if [ -x ./configure ]   # if requested disable-static
299     if [[ ! -z $(${configure_exec} --help | grep -- '--.*able-static') ]]
300   then   then
301   # if requested disable-static   if mqueryfeature '!static'
  if [[ ! -z $(./configure --help | grep -- '--.*able-static') ]]  
302   then   then
303   if mqueryfeature '!static'   myopts+=" --disable-static"
304   then   else
305   myopts+=" --disable-static"   myopts+=" --enable-static"
  else  
  myopts+=" --enable-static"  
  fi  
  fi  
   
  # always enable shared by default but not for waf configure  
  if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] &&  
  [[ -z $(./configure --version | grep waf) ]]  
  then  
  myopts+=" --enable-shared"  
306   fi   fi
   
  ./configure \  
  --prefix=/usr \  
  --host=${CHOST} \  
  --build=${CHOST} \  
  --mandir=/usr/share/man \  
  --infodir=/usr/share/info \  
  --datadir=/usr/share \  
  --sysconfdir=/etc \  
  --localstatedir=/var/lib \  
  --libdir=/usr/$(mlibdir) \  
  ${myopts} \  
  "$@" || die "mconfigure failed"  
  else  
  echo "configure is not an executable ..."  
  exit 1  
307   fi   fi
308    
309     # always enable shared by default but not for waf configure
310     if [[ ! -z $(${configure_exec} --help | grep -- '--.*able-shared') ]] &&
311     [[ -z $(${configure_exec} --version | grep waf) ]]
312     then
313     myopts+=" --enable-shared"
314     fi
315    
316     ${configure_exec} \
317     --prefix=/usr \
318     --host=${CHOST} \
319     --build=${CHOST} \
320     --mandir=/usr/share/man \
321     --infodir=/usr/share/info \
322     --datadir=/usr/share \
323     --sysconfdir=/etc \
324     --localstatedir=/var/lib \
325     --libdir=/usr/$(mlibdir) \
326     ${myopts} \
327     "$@" || die "mconfigure failed"
328  }  }
329    
330  minstall()  minstall()
# Line 391  munpack() Line 405  munpack()
405   popd > /dev/null   popd > /dev/null
406   fi   fi
407   ;;   ;;
408     lz)
409     IFTAR="$(basename $SRCFILE .lz)"
410     IFTAR="${IFTAR##*.}"
411     if [[ ${IFTAR} = tar ]]
412     then
413     tar --no-same-owner -xvf --lzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.lz unpack failed."
414     else
415     pushd ${DEST} > /dev/null
416     lzip -dc ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".lz unpack failed."
417     popd > /dev/null
418     fi
419     ;;
420   tbz2|mpks|mpk)   tbz2|mpks|mpk)
421   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
422   ;;   ;;
# Line 498  mstriplibs() Line 524  mstriplibs()
524    
525   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
526   [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug"   [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug"
527   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "[shared object|pie executable]" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null
528  }  }
529    
530  mstripbins()  mstripbins()
# Line 507  mstripbins() Line 533  mstripbins()
533    
534   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
535   [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug"   [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug"
536   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null   find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep -v "pie executable" | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null
537  }  }
538    
539  mstripstatic()  mstripstatic()
# Line 595  march() Line 621  march()
621   return "${retval}"   return "${retval}"
622  }  }
623    
624  marchsrcfile()  marchvariable()
625  {  {
626   local retval   local retval
627   local var="$1"   local var="$1"
628    
629   [[ -z ${var} ]] && var="SRCFILE"   [[ -n ${var} ]] || die "marchvariable(): missing variable"
630    
631   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
632   then   then
# Line 613  marchsrcfile() Line 639  marchsrcfile()
639   return "${retval}"   return "${retval}"
640  }  }
641    
642    marchsrcfile()
643    {
644     local retval
645     local var="$1"
646    
647     [[ -z ${var} ]] && var="SRCFILE"
648    
649     marchvariable "${var}" || die
650    }
651    
652  marchsrcdir()  marchsrcdir()
653  {  {
654   local retval   local retval
# Line 620  marchsrcdir() Line 656  marchsrcdir()
656    
657   [[ -z ${var} ]] && var="SRCDIR"   [[ -z ${var} ]] && var="SRCDIR"
658    
659   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]   marchvariable "${var}" || die
  then  
  eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'  
  retval=0  
  else  
  retval=1  
  fi  
   
  return "${retval}"  
660  }  }
661    
662  marchdepend()  marchdepend()
# Line 638  marchdepend() Line 666  marchdepend()
666    
667   [[ -z ${var} ]] && var="DEPEND"   [[ -z ${var} ]] && var="DEPEND"
668    
669   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]   if [[ ! -z $(eval echo \"\$${var}_${ARCH/i*86/x86}\") ]]
670   then   then
671   # evaluate with escape strings for the magefile if called by smage   # evaluate with escape strings for the magefile if called by smage
672   # but do not escape if the smagefile was called by depwalker directly   # but do not escape if the smagefile was called by depwalker directly
673   if [[ ${SMAGE_DEPEND} = 1 ]]   if [[ ${SMAGE_DEPEND} = 1 ]]
674   then   then
675   eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'   eval echo \"\$${var}_${ARCH/i*86/x86}\" | tr ';' '\n'
676   else   else
677   echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"   echo "\$(eval echo \\\"\\\$${var}_\${ARCH/i*86/x86}\\\" | tr ';' '\n')"
678   fi   fi
679   retval=0   retval=0
680   else   else
# Line 663  marchsdepend() Line 691  marchsdepend()
691    
692   [[ -z ${var} ]] && var="SDEPEND"   [[ -z ${var} ]] && var="SDEPEND"
693    
694   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]   if [[ ! -z $(eval echo \"\$${var}_${ARCH/i*86/x86}\") ]]
695   then   then
696   # evaluate with escape strings for the magefile if called by smage   # evaluate with escape strings for the magefile if called by smage
697   # but do not escape if the smagefile was called by depwalker directly   # but do not escape if the smagefile was called by depwalker directly
698   if [[ ${SMAGE_DEPEND} = 1 ]]   if [[ ${SMAGE_DEPEND} = 1 ]]
699   then   then
700   eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'   eval echo \"\$${var}_${ARCH/i*86/x86}\" | tr ';' '\n'
701   else   else
702   echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"   echo "\$(eval echo \\\"\\\$${var}_\${ARCH/i*86/x86}\\\" | tr ';' '\n')"
703   fi   fi
704   retval=0   retval=0
705   else   else
# Line 797  build_mage_script() Line 825  build_mage_script()
825   for i in ${SPECIAL_VARS}   for i in ${SPECIAL_VARS}
826   do   do
827   # being tricky here :)   # being tricky here :)
828   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}   echo "${i}=\"$(eval echo \"\$${i}\")\"" >> ${dest}
829   done   done
830   fi   fi
831    
# Line 1192  generate_package_md5sum() Line 1220  generate_package_md5sum()
1220    
1221  source_pkg_build()  source_pkg_build()
1222  {  {
  if [[ ${PKGTYPE} = virtual ]]  
  then  
  echo "Virtual package detected; src-pkg-tarball not necessary ..."  
  return 0  
  fi  
   
1223   if [[ ! -d ${SOURCEDIR}/${PNAME} ]]   if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
1224   then   then
1225   install -d ${SOURCEDIR}/${PNAME}   install -d ${SOURCEDIR}/${PNAME}

Legend:
Removed from v.2842  
changed lines
  Added in v.3181