Magellan Linux

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

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

revision 190 by niro, Tue Aug 16 23:23:33 2005 UTC revision 191 by niro, Fri Aug 19 02:24:12 2005 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.21 2005-08-16 23:23:26 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.22 2005-08-19 02:24:12 niro Exp $
8    
9  #01.10.2004  #01.10.2004
10  # added ccache support  # added ccache support
# Line 411  setup_ccache_environment(){ Line 411  setup_ccache_environment(){
411   fi   fi
412  }  }
413    
414    # alx_create_mage_file: helper functions for regen_mage_tree()
415    # generates an mage file with given information in smage file
416    # needs at least:
417    #   PNAME                 name of pkg
418    #   PVER                  version
419    #   PBUILD                revision
420    #   PCATEGORIE            categorie of the pkg
421    #   STATE                 state of pkg stable|unstable|old
422    #   DESCRIPTION           va short description (opt)
423    #   HOMEPAGE              homepage (opt)
424    #   DEPEND                runtime dependencies (opt)
425    #   SDEPEND               add. needed deps to build the pkg (opt)
426    #   PROVIDE               provides a virtual (opt)
427    #
428    # special tags:
429    #   PKGTYPE               type of pkg
430    #   INHERITS              which functions get included
431    #   SPECIAL_FUNCTIONS     special functions wich should also be added
432    #                         warning: they get killed before the build starts !
433    #
434    #   MAGE_TREE_DEST        target destination of the generated tree
435    #   REGEN_MAGE_TREE       set to 'true' to enable this
436    alx_create_mage_file()
437    {
438     local magefile
439     local dest
440     local suffix
441     local sym
442     local depname
443    
444     # if MAGE_TREE_DEST not set use BUILDDIR
445     : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
446    
447     # determinate which suffix this mage file should get, if any
448     suffix="$1"
449    
450     # name of magefile
451     magefile="${PNAME}${suffix}-${PVER}-${PBUILD}.mage"
452    
453     # destination to magefile
454     dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${suffix}/${magefile}"
455    
456     # show what we are doing
457     echo "Generating Mage file:"
458     echo "  ${dest}"
459    
460     install -d "$(dirname ${dest})"
461     # now build the mage file
462     > ${dest}
463    
464     # header
465     echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.22 2005-08-19 02:24:12 niro Exp $' >> ${dest}
466     echo  >> ${dest}
467    
468     # pgkname and state
469     echo "PKGNAME=\"${PNAME}${suffix}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
470     echo "STATE=\"${STATE}\"" >> ${dest}
471     echo >> ${dest}
472    
473     # description and homepage
474     echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
475     echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
476     echo >> ${dest}
477    
478     # special tags
479     echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
480     if [ -n "${INHERITS}" ]
481     then
482     echo -n "minclude"  >> ${dest}
483     local i
484     for i in ${INHERITS}
485     do
486     echo -n " ${i}"  >> ${dest}
487     done
488     echo  >> ${dest}
489     fi
490     echo >> ${dest}
491    
492     # deps and provides
493     echo "DEPEND=\"${DEPEND}\"" >> ${dest}
494     echo "SDEPEND=\"${SDEPEND}\"" >> ${dest}
495     echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
496     echo >> ${dest}
497    
498     # add special functions
499     if [ -n "${SPECIAL_FUNCTIONS}" ]
500     then
501     local i
502     for i in ${SPECIAL_FUNCTIONS}
503     do
504     # add to mage (quotes needed !)
505     typeset -f "${i}" >> ${dest}
506     # unset to be safe (quotes needed !)
507     unset "${i}"
508     done
509     fi
510    
511     # pre|post-install|removes
512     typeset -f preinstall >> ${dest}
513     echo  >> ${dest}
514     typeset -f postinstall >> ${dest}
515     echo  >> ${dest}
516     typeset -f preremove >> ${dest}
517     echo  >> ${dest}
518     typeset -f postremove >> ${dest}
519     echo  >> ${dest}
520    }
521    
522    regen_mage_tree()
523    {
524     local i
525    
526     # build them only if requested
527     if [[ ${REGEN_MAGE_TREE} = true ]]
528     then
529     # build for each target an mage file
530     for i in ${MAGE_TARGETS}
531     do
532     echo
533     alx_create_mage_file "${i}"
534     echo
535     done
536     fi
537    
538     # now unset all uneeded vars to be safe
539     unset PKGNAME
540     unset STATE
541     unset DESCRIPTION
542     unset HOMEPAGE
543     unset PKGTYPE
544     unset INHERITS
545     unset DEPEND
546     unset SDEPEND
547     unset PROVIDE
548     unset SPECIAL_FUNCTIONS
549     unset preinstall
550     unset postinstall
551     unset preremove
552     unset postremove
553    }
554    
555  # print out our version  # print out our version
556  showversion  showversion
557  echo  echo
# Line 574  MD5DIR="$(dirname ${SMAGENAME})/md5" Line 715  MD5DIR="$(dirname ${SMAGENAME})/md5"
715  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
716  echo "Compiling ${PKGNAME}"  echo "Compiling ${PKGNAME}"
717    
718    # auto regen mage tree if requested
719    regen_mage_tree
720    
721  #download sources  #download sources
722  download_sources  download_sources
723    

Legend:
Removed from v.190  
changed lines
  Added in v.191