Magellan Linux

Diff of /branches/mage-next/src/smage2.functions.sh.in

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

trunk/mage/usr/lib/mage/smage2.functions.sh revision 2365 by niro, Mon Jan 6 12:56:50 2014 UTC branches/mage-next/src/smage2.functions.sh.in revision 3082 by niro, Tue May 22 14:12:41 2018 UTC
# Line 79  print_distrotag() Line 79  print_distrotag()
79   fi   fi
80  }  }
81    
 showversion()  
 {  
  echo -en "Magellan Source Install v${SMAGEVERSION} "  
  echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"  
 }  
   
 die()  
 {  
  xtitleclean  
  echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT}  
  echo "SMAGE failed: $@"  
  exit 1  
 }  
   
 die_pipestatus()  
 {  
  # the status change if we do any parameter declarations!!  
  # dont do this anymore, keep this in mind!  
  #  
  # local pos="$1"  
  # local comment="$2"  
  #  
  # [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}"  
  #  
  [ ${PIPESTATUS[$1]} -ne 0 ] && die "$2"  
 }  
   
 xtitle()  
 {  
  if [[ ${TERM} = xterm ]]  
  then  
  echo -ne "\033]0;[sMage: $@]\007"  
  fi  
  return 0  
 }  
   
 xtitleclean()  
 {  
  if [[ ${TERM} = xterm ]]  
  then  
  echo -ne "\033]0;\007"  
  fi  
  return 0  
 }  
   
82  syncsmage2()  syncsmage2()
83  {  {
84   xtitle "Updating smage2-script tree ..."   xtitle "Updating smage2-script tree ..."
# Line 225  download_sources() Line 180  download_sources()
180  }  }
181    
182  # dummy function, used if that does not exist in smage file  # dummy function, used if that does not exist in smage file
183    pkg_setup()
184    {
185     echo "no pkg_setup defined; doing nothing ..."
186     return 0
187    }
188    
189    # dummy function, used if that does not exist in smage file
190  src_prepare()  src_prepare()
191  {  {
192   echo "no src_prepare defined; doing nothing ..."   echo "no src_prepare defined; doing nothing ..."
# Line 491  mstriplibs() Line 453  mstriplibs()
453    
454   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
455   [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug"   [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug"
456   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
457  }  }
458    
459  mstripbins()  mstripbins()
# Line 500  mstripbins() Line 462  mstripbins()
462    
463   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
464   [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug"   [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug"
465   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
466  }  }
467    
468  mstripstatic()  mstripstatic()
# Line 588  march() Line 550  march()
550   return "${retval}"   return "${retval}"
551  }  }
552    
553  marchsrcfile()  marchvariable()
554  {  {
555   local retval   local retval
556   local var="$1"   local var="$1"
557    
558   [[ -z ${var} ]] && var="SRCFILE"   [[ -n ${var} ]] || die "marchvariable(): missing variable"
559    
560   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
561   then   then
# Line 606  marchsrcfile() Line 568  marchsrcfile()
568   return "${retval}"   return "${retval}"
569  }  }
570    
571    marchsrcfile()
572    {
573     local retval
574     local var="$1"
575    
576     [[ -z ${var} ]] && var="SRCFILE"
577    
578     marchvariable "${var}" || die
579    }
580    
581  marchsrcdir()  marchsrcdir()
582  {  {
583   local retval   local retval
# Line 613  marchsrcdir() Line 585  marchsrcdir()
585    
586   [[ -z ${var} ]] && var="SRCDIR"   [[ -z ${var} ]] && var="SRCDIR"
587    
588   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}"  
589  }  }
590    
591  marchdepend()  marchdepend()
# Line 633  marchdepend() Line 597  marchdepend()
597    
598   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
599   then   then
600   echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"   # evaluate with escape strings for the magefile if called by smage
601     # but do not escape if the smagefile was called by depwalker directly
602     if [[ ${SMAGE_DEPEND} = 1 ]]
603     then
604     eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'
605     else
606     echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"
607     fi
608   retval=0   retval=0
609   else   else
610   retval=1   retval=1
# Line 651  marchsdepend() Line 622  marchsdepend()
622    
623   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]   if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
624   then   then
625   echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"   # evaluate with escape strings for the magefile if called by smage
626     # but do not escape if the smagefile was called by depwalker directly
627     if [[ ${SMAGE_DEPEND} = 1 ]]
628     then
629     eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'
630     else
631     echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')"
632     fi
633   retval=0   retval=0
634   else   else
635   retval=1   retval=1
# Line 1171  generate_package_md5sum() Line 1149  generate_package_md5sum()
1149    
1150  source_pkg_build()  source_pkg_build()
1151  {  {
  if [[ ${PKGTYPE} = virtual ]]  
  then  
  echo "Virtual package detected; src-pkg-tarball not necessary ..."  
  return 0  
  fi  
   
1152   if [[ ! -d ${SOURCEDIR}/${PNAME} ]]   if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
1153   then   then
1154   echo "No SRC_URI defined; src-pkg-tarball not necessary ..."   install -d ${SOURCEDIR}/${PNAME}
  return 0  
1155   fi   fi
1156    
1157   [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."   [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."

Legend:
Removed from v.2365  
changed lines
  Added in v.3082