Magellan Linux

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

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

revision 1640 by niro, Fri Jan 13 18:29:52 2012 UTC revision 2040 by niro, Fri Feb 1 09:45:47 2013 UTC
# Line 7  Line 7 
7  smagesource()  smagesource()
8  {  {
9   local file="$1"   local file="$1"
10   local mystate   local localstate
11   local mycodename   local distfilestate
12     local mytag
13    
14   source ${file}   source ${file}
15    
16   [[ -n ${STATE} ]] && mystate="${STATE}"   # if PCAT was not set and PCATEGORIE was found
17     # inform the user and use PCATEGORIE as PCAT
18     if [[ -z ${PCAT} ]]
19     then
20     if [[ -n ${PCATEGORIE} ]]
21     then
22     PCAT="${PCATEGORIE}"
23     unset PCATEGORIE
24     # print a warning
25     echo -e "${COLYELLOW}Warning: 'PCATEGORIE' is deprecated and gets removed in the future.${COLDEFAULT}"
26     echo -e "${COLYELLOW}         Please modify this smage2 script to use the 'PCAT' variable.${COLDEFAULT}"
27     echo
28     else
29     die "Neither PCAT nor PCATEGORIE are defined!"
30     fi
31     fi
32    
33   # do not overide if local state was broken or disabled!   [[ -n ${STATE} ]] && localstate="${STATE}"
34   case ${STATE} in   [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}"
  broken) return ;;  
  disabled) return ;;  
  esac  
35    
36   if [ -f ${SMAGESCRIPTSDIR}/distribution ]   if [ -f ${SMAGESCRIPTSDIR}/distribution ]
37   then   then
38   source ${SMAGESCRIPTSDIR}/distribution   source ${SMAGESCRIPTSDIR}/distribution
39   [[ -n ${STATE} ]] && mystate="${STATE}"   [[ -n ${STATE} ]] && distfilestate="${STATE}"
40     [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}"
41     fi
42     # now switch state and export it but do not overide any local states
43     if [[ ! -z ${localstate} ]]
44     then
45     STATE="${localstate}"
46     else
47     STATE="${distfilestate}"
48     fi
49    
50     if mqueryfeature "pkgdistrotag"
51     then
52     # if DISTROTAG was not defined globally
53     # or in distribution file then deactivate this feature!
54     # at this point $mytag must have the distrotag
55     if [[ -z ${mytag} ]]
56     then
57     FVERBOSE=off msetfeature "!pkgdistrotag"
58     unset DISTROTAG
59     echo -e "${COLRED}Requested 'pkgdistrotag' but no \$DISTROTAG found!${COLDEFAULT}"
60     echo -e "${COLRED}Disabled the feature for pkgbuild sanity!${COLDEFAULT}"
61     else
62     # now switch state and export it but do not overide any local states
63     export DISTROTAG="${mytag}"
64     fi
65     else
66     unset DISTROTAG
67     fi
68    }
69    
70    print_distrotag()
71    {
72     if FVERBOSE=off mqueryfeature "pkgdistrotag"
73     then
74     if [[ ! -z ${DISTROTAG} ]]
75     then
76     # add a point as prefix
77     echo ".${DISTROTAG}"
78     fi
79   fi   fi
  # now switch state and export it  
  STATE="${mystate}"  
80  }  }
81    
82  showversion()  showversion()
# Line 231  mconfigure() Line 281  mconfigure()
281   fi   fi
282   fi   fi
283    
284   # always enable shared by default   # always enable shared by default but not for waf configure
285   if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]]   if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] &&
286     [[ -z $(./configure --version | grep waf) ]]
287   then   then
288   myopts+=" --enable-shared"   myopts+=" --enable-shared"
289   fi   fi
# Line 292  munpack() Line 343  munpack()
343   DEST=$2   DEST=$2
344   fi   fi
345    
346     echo -e "${COLBLUE}>>>${COLGREEN} Unpacking ${SOURCEDIR}/${PNAME}/${SRCFILE}${COLDEFAULT}"
347    
348   [[ ! -d ${DEST} ]] && install -d ${DEST}   [[ ! -d ${DEST} ]] && install -d ${DEST}
349    
350   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
# Line 520  sminclude() Line 573  sminclude()
573   fi   fi
574  }  }
575    
576    march()
577    {
578     local retval
579    
580     if [[ ! -z ${ARCH} ]]
581     then
582     echo "${ARCH}"
583     retval=0
584     else
585     retval=1
586     fi
587    
588     return "${retval}"
589    }
590    
591    marchsrcfile()
592    {
593     local retval
594     local var="$1"
595    
596     [[ -z ${var} ]] && var="SRCFILE"
597    
598     if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]]
599     then
600     eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n'
601     retval=0
602     else
603     retval=1
604     fi
605    
606     return "${retval}"
607    }
608    
609    marchsrcdir()
610    {
611     local retval
612     if [[ ! -z $(eval echo \$SRCDIR_${ARCH/i*86/x86}) ]]
613     then
614     eval echo \$SRCDIR_${ARCH/i*86/x86} | tr ';' '\n'
615     retval=0
616     else
617     retval=1
618     fi
619    
620     return "${retval}"
621    }
622    
623    marchdepend()
624    {
625     local retval
626    
627     if [[ ! -z $(eval echo \$DEPEND_${ARCH/i*86/x86}) ]]
628     then
629     echo "\$(eval echo \\\$DEPEND_\${ARCH/i*86/x86} | tr ';' '\n')"
630     retval=0
631     else
632     retval=1
633     fi
634    
635     return "${retval}"
636    }
637    
638    marchsdepend()
639    {
640     local retval
641     if [[ ! -z $(eval echo \$SDEPEND_${ARCH/i*86/x86}) ]]
642     then
643     echo "\$(eval echo \\\$SDEPEND_\${ARCH/i*86/x86} | tr ';' '\n')"
644     retval=0
645     else
646     retval=1
647     fi
648    
649     return "${retval}"
650    }
651    
652  setup_distcc_environment()  setup_distcc_environment()
653  {  {
654   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
# Line 606  EOF Line 735  EOF
735  #   PNAME                 name of pkg  #   PNAME                 name of pkg
736  #   PVER                  version  #   PVER                  version
737  #   PBUILD                revision  #   PBUILD                revision
738  #   PCATEGORIE            category of the pkg  #   PCAT                  category of the pkg
739    #   PCATEGORIE            category of the pkg (deprecated, use PCAT!)
740  #   STATE                 state of pkg stable|unstable|old  #   STATE                 state of pkg stable|unstable|old
741  #   DESCRIPTION           a short description (opt)  #   DESCRIPTION           a short description (opt)
742  #   HOMEPAGE              homepage (opt)  #   HOMEPAGE              homepage (opt)
743    #   LICENSE               license information of the pkg (opt)
744  #   DEPEND                runtime dependencies (opt)  #   DEPEND                runtime dependencies (opt)
745  #   SDEPEND               adds needed deps to build the pkg (opt)  #   SDEPEND               adds needed deps to build the pkg (opt)
746  #   PROVIDE               provides a virtual (opt)  #   PROVIDE               provides a virtual (opt)
# Line 649  build_mage_script() Line 780  build_mage_script()
780   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
781    
782   # destination to magefile   # destination to magefile
783   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCAT}/${PNAME}${target}/${magefile}"
784    
785   # show what we are doing   # show what we are doing
786   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
# Line 660  build_mage_script() Line 791  build_mage_script()
791   > ${dest}   > ${dest}
792    
793   # pgkname and state   # pgkname and state
794   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}$(print_distrotag)-${PBUILD}\"" >> ${dest}
795   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
796    
797   # description and homepage   # description and homepage
798   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
799   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
800    
801     # license information
802     echo "LICENSE=\"${LICENSE}\"" >> ${dest}
803    
804   # special tags and vars   # special tags and vars
805   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
806    
# Line 758  regen_mage_tree() Line 892  regen_mage_tree()
892   # get the right variables for the split   # get the right variables for the split
893   export PNAME="${subpackage}"   export PNAME="${subpackage}"
894   split_info_${subpackage}   split_info_${subpackage}
895     # fix PCATEGORIE -> PCAT
896     if [[ ! -z ${PCATEGORIE} ]]
897     then
898     PCAT="${PCATEGORIE}"
899     unset PCATEGORIE
900     fi
901   # get the preinstall etc   # get the preinstall etc
902   split_export_inherits ${subpackage}   split_export_inherits ${subpackage}
903   build_mage_script --split-pkg-base "${split_pkg_base}"   build_mage_script --split-pkg-base "${split_pkg_base}"
# Line 809  split_save_variables() Line 949  split_save_variables()
949   export SAVED_PNAME="${PNAME}"   export SAVED_PNAME="${PNAME}"
950   export SAVED_PVER="${PVER}"   export SAVED_PVER="${PVER}"
951   export SAVED_PBUILD="${PBUILD}"   export SAVED_PBUILD="${PBUILD}"
952   export SAVED_PCATEGORIE="${PCATEGORIE}"   export SAVED_PCAT="${PCAT}"
953   export SAVED_DESCRIPTION="${DESCRIPTION}"   export SAVED_DESCRIPTION="${DESCRIPTION}"
954   export SAVED_HOMEPAGE="${HOMEPAGE}"   export SAVED_HOMEPAGE="${HOMEPAGE}"
955   export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"   export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
956   export SAVED_STATE="${STATE}"   export SAVED_STATE="${STATE}"
  export SAVED_PKGTYPE="${PKGTYPE}"  
957   export SAVED_INHERITS="${INHERITS}"   export SAVED_INHERITS="${INHERITS}"
958   export SAVED_DEPEND="${DEPEND}"   export SAVED_DEPEND="${DEPEND}"
959   export SAVED_SDEPEND="${SDEPEND}"   export SAVED_SDEPEND="${SDEPEND}"
# Line 884  split_restore_variables() Line 1023  split_restore_variables()
1023   export PNAME="${SAVED_PNAME}"   export PNAME="${SAVED_PNAME}"
1024   export PVER="${SAVED_PVER}"   export PVER="${SAVED_PVER}"
1025   export PBUILD="${SAVED_PBUILD}"   export PBUILD="${SAVED_PBUILD}"
1026   export PCATEGORIE="${SAVED_PCATEGORIE}"   export PCAT="${SAVED_PCAT}"
1027   export DESCRIPTION="${SAVED_DESCRIPTION}"   export DESCRIPTION="${SAVED_DESCRIPTION}"
1028   export HOMEPAGE="${SAVED_HOMEPAGE}"   export HOMEPAGE="${SAVED_HOMEPAGE}"
1029   export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"   export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
1030   export STATE="${SAVED_STATE}"   export STATE="${SAVED_STATE}"
  export PKGTYPE="${SAVED_PKGTYPE}"  
1031   export INHERITS="${SAVED_INHERITS}"   export INHERITS="${SAVED_INHERITS}"
1032   export DEPEND="${SAVED_DEPEND}"   export DEPEND="${SAVED_DEPEND}"
1033   export SDEPEND="${SAVED_SDEPEND}"   export SDEPEND="${SAVED_SDEPEND}"
# Line 953  split_unset_variables() Line 1091  split_unset_variables()
1091   unset SAVED_PNAME   unset SAVED_PNAME
1092   unset SAVED_PVER   unset SAVED_PVER
1093   unset SAVED_PBUILD   unset SAVED_PBUILD
1094   unset SAVED_PCATEGORIE   unset SAVED_PCAT
1095   unset SAVED_DESCRIPTION   unset SAVED_DESCRIPTION
1096   unset SAVED_HOMEPAGE   unset SAVED_HOMEPAGE
1097   unset SAVED_SPECIAL_VARS   unset SAVED_SPECIAL_VARS
# Line 1069  generate_package_md5sum() Line 1207  generate_package_md5sum()
1207   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
1208    
1209   # build pkgname   # build pkgname
1210   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}$(print_distrotag)-${pbuild}"
1211    
1212   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1213   if mqueryfeature regentree   if mqueryfeature regentree
# Line 1122  source_pkg_build() Line 1260  source_pkg_build()
1260   [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}   [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
1261   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
1262    
1263   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}\n"
1264  }  }
1265    
1266  step_by_step()  step_by_step()

Legend:
Removed from v.1640  
changed lines
  Added in v.2040