Magellan Linux

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

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

revision 597 by niro, Mon Nov 5 16:47:10 2007 UTC revision 941 by niro, Fri Nov 20 19:41:27 2009 UTC
# Line 4  Line 4 
4  # needs pkgbuild_dir (mage)  # needs pkgbuild_dir (mage)
5    
6  # SMAGE2  # SMAGE2
7  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.59 2007-11-05 16:47:10 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $
8    
9  #01.10.2004  #01.10.2004
10  # added ccache support  # added ccache support
# Line 73  die() Line 73  die()
73   exit 1   exit 1
74  }  }
75    
76    die_pipestatus()
77    {
78     local pos="$1"
79     local comment="$2"
80    
81     [ ${PIPESTATUS[${pos}]} -gt 0 ] && die "${comment}"
82    }
83    
84  xtitle()  xtitle()
85  {  {
86   if [[ ${TERM} = xterm ]]   if [[ ${TERM} = xterm ]]
# Line 171  download_sources() Line 179  download_sources()
179   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
180   fi   fi
181    
182     # create the SOURCEDIR
183     install -d ${my_SOURCEDIR}
184    
185   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
186   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
187   then   then
# Line 186  download_sources() Line 197  download_sources()
197   --tries 3 \   --tries 3 \
198   --continue \   --continue \
199   --progress bar \   --progress bar \
200   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
201   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
202   if [[ $? = 0 ]]   if [[ $? = 0 ]]
203   then   then
# Line 210  download_sources() Line 221  download_sources()
221   --tries 3 \   --tries 3 \
222   --continue \   --continue \
223   --progress bar \   --progress bar \
224   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
225   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
226   if [[ $? = 0 ]]   if [[ $? = 0 ]]
227   then   then
# Line 234  download_sources() Line 245  download_sources()
245   --tries 3 \   --tries 3 \
246   --continue \   --continue \
247   --progress bar \   --progress bar \
248   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
249   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
250   if [[ $? = 0 ]]   if [[ $? = 0 ]]
251   then   then
# Line 258  download_sources() Line 269  download_sources()
269   --tries 3 \   --tries 3 \
270   --continue \   --continue \
271   --progress bar \   --progress bar \
272   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
273   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
274   if [[ $? = 0 ]]   if [[ $? = 0 ]]
275   then   then
# Line 282  download_sources() Line 293  download_sources()
293   --tries 3 \   --tries 3 \
294   --continue \   --continue \
295   --progress bar \   --progress bar \
296   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
297   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
298   if [[ $? = 0 ]]   if [[ $? = 0 ]]
299   then   then
# Line 301  download_sources() Line 312  download_sources()
312   --tries 3 \   --tries 3 \
313   --continue \   --continue \
314   --progress bar \   --progress bar \
315   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
316   "${my_SRC_URI}"   "${my_SRC_URI}"
317   fi   fi
318   fi   fi
# Line 362  mconfigure() Line 373  mconfigure()
373   ./configure \   ./configure \
374   --prefix=/usr \   --prefix=/usr \
375   --host=${CHOST} \   --host=${CHOST} \
376     --build=${CHOST} \
377   --mandir=/usr/share/man \   --mandir=/usr/share/man \
378   --infodir=/usr/share/info \   --infodir=/usr/share/info \
379   --datadir=/usr/share \   --datadir=/usr/share \
# Line 439  munpack() Line 451  munpack()
451   popd > /dev/null   popd > /dev/null
452   fi   fi
453   ;;   ;;
454   tbz2)   tbz2|mpks|mpk)
455   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."
456   ;;   ;;
457   tgz)   tgz)
# Line 448  munpack() Line 460  munpack()
460   rar)   rar)
461   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
462   ;;   ;;
463   zip)   zip|xpi)
464   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
465   ;;   ;;
466   rpm)   rpm)
467   pushd ${BUILDDIR} > /dev/null   pushd ${DEST} > /dev/null
468   rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."   rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
469   tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz/} || die "tar: .rpm unpack failed."   tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
470   [[ -f ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} ]] && rm ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/}   if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
471     then
472     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
473     fi
474   ;;   ;;
475   *)   *)
476   die "munpack failed"   die "munpack failed"
# Line 647  EOF Line 662  EOF
662  # special tags:  # special tags:
663  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
664  #   INHERITS              which functions get included  #   INHERITS              which functions get included
665  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
666  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
667  #  #
668  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
# Line 683  build_mage_script() Line 698  build_mage_script()
698   > ${dest}   > ${dest}
699    
700   # header   # header
701   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.59 2007-11-05 16:47:10 niro Exp $' >> ${dest}   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $' >> ${dest}
702   echo  >> ${dest}   echo  >> ${dest}
703    
704   # pgkname and state   # pgkname and state
# Line 876  generate_package_md5sum() Line 891  generate_package_md5sum()
891   # fix target as it may be empty !   # fix target as it may be empty !
892   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
893    
894    
895   # build pkgname   # build pkgname
896   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
897    
# Line 895  generate_package_md5sum() Line 911  generate_package_md5sum()
911   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
912    
913   # setup md5 dir   # setup md5 dir
914   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
915   install -d ${dest}   install -d ${dest}
916    
917   # gen md5sum   # gen md5sum
# Line 933  source_pkg_build() Line 949  source_pkg_build()
949   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
950  }  }
951    
952    step_by_step()
953    {
954     if [[ ${STEP_BY_STEP} = true ]]
955     then
956     echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
957     echo "Press [enter] to continue"
958     read
959     fi
960    }
961    
962    
963  # print out our version  # print out our version
964  showversion  showversion
# Line 1053  then Line 1079  then
1079    
1080   regen_mage_tree   regen_mage_tree
1081    
1082   # build md5sum for existing packages   # build several targets
1083   generate_package_md5sum \   if [ -n "${MAGE_TARGETS}" ]
1084   --pcat "${PCATEGORIE}" \   then
1085   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1086   --pver "${PVER}" \   do
1087   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1088   --parch "${ARCH}" \   generate_package_md5sum \
1089   --target "${target}"   --pcat "${PCATEGORIE}" \
1090     --pname "${PNAME}" \
1091     --pver "${PVER}" \
1092     --pbuild "${PBUILD}" \
1093     --parch "${ARCH}" \
1094     --target "${target}"
1095     done
1096     else
1097     # build md5sum for existing packages
1098     generate_package_md5sum \
1099     --pcat "${PCATEGORIE}" \
1100     --pname "${PNAME}" \
1101     --pver "${PVER}" \
1102     --pbuild "${PBUILD}" \
1103     --parch "${ARCH}" \
1104     --target "${target}"
1105     fi
1106    
1107   exit 0   exit 0
1108  fi  fi
# Line 1125  fi Line 1167  fi
1167  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1168  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1169  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1170    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1171    
1172  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1173  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
# Line 1199  then Line 1242  then
1242   mage rmstamp   mage rmstamp
1243  fi  fi
1244    
1245  src_prepare || die "src_prepare failed"  # setup build loggins
1246  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1247  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1248    
1249    src_prepare | ${SMAGE_LOG_CMD}
1250    die_pipestatus 0 "src_prepare failed"
1251    step_by_step $_
1252    
1253    src_compile | ${SMAGE_LOG_CMD}
1254    die_pipestatus 0 "src_compile failed"
1255    step_by_step $_
1256    
1257    src_install | ${SMAGE_LOG_CMD}
1258    die_pipestatus 0 "src_install failed"
1259    step_by_step $_
1260    
1261    
1262  # compressing doc, info & man files  # compressing doc, info & man files
# Line 1282  case ${NOPKGBUILD} in Line 1337  case ${NOPKGBUILD} in
1337   ;;   ;;
1338  esac  esac
1339    
1340    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1341    then
1342     bzip2 -9f /var/log/smage/${PKGNAME}.log
1343    else
1344     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1345    fi
1346    
1347  # for sure  # for sure
1348  unset NOPKGBUILD  unset NOPKGBUILD
1349  unset NOSTRIP  unset NOSTRIP

Legend:
Removed from v.597  
changed lines
  Added in v.941