# $Id$ # alx specific functions # some global includes sminclude cleanutils mtools # include alx functions INHERITS="${INHERITS} alx" # injects files to given path (defaults to /usr/bin) # mcinjectfile file {/path/to/dest} mcinjectfile() { local file local dest [[ -z $1 ]] && die "No etc file given" file="${SMAGENAME%/*}/alx/files/$1" dest="$2" if [[ -z $2 ]] then dest=/usr/bin fi # needed directory minstalldir ${dest} || die # install our configfile minstallfile ${file} ${dest} || die } # injects executables to given path # mcinjectexec exec {/path/to/dest} mcinjectexec() { local file local dest [[ -z $1 ]] && die "No etc file given" file="${SMAGENAME%/*}/alx/files/$1" dest="$2" if [[ -z $2 ]] then dest=/usr/bin fi # needed directory minstalldir ${dest} || die # install our configfile minstallexec ${file} ${dest} || die } # injects a patch to the sourcecode # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files # mcinjectpatch patch mcinjectpatch() { local PATCHOPTS local PATCHFILE local i PATCHOPTS=$1 PATCHFILE=$2 if [[ -z $2 ]] then PATCHFILE=$1 ## patch level auto-detection, get patch level for ((i=0; i < 10; i++)) do patch --dry-run -Np${i} -i ${SMAGENAME%/*}/alx/files/${PATCHFILE} > /dev/null if [[ $? = 0 ]] then PATCHOPTS="-Np${i}" break fi done fi echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}" patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE} } ############################# ##### compile functions #### ############################# # respect multilib! if [[ -z $(typeset -f oldconfigure) ]] then alx_old_mconfigure=alx_old$(typeset -f mconfigure) else alx_old_mconfigure=alx_old$(typeset -f oldmconfigure) fi eval ${alx_old_mconfigure} mconfigure() { local myconf local configurefile # get configure instructions from smage dir if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg ]] then # version specific configure files configurefile=${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.cfg ]] then # generic configure files for a package configurefile=${SMAGENAME%/*}/alx/${PNAME}.cfg else configurefile="" fi # now read the content if [[ -f ${configurefile} ]] then echo -e "${COLBLUE}*** ${COLGREEN}Using configure info from ${configurefile}${COLDEFAULT}" local line while read line do # ignore empty and commeted lines case "${line}" in \#*|"") continue ;; esac echo -e " adding ${COLGREEN}${line}${COLDEFAULT} to ALX_CONFIGURE_OPTS" ALX_CONFIGURE_OPTS+=" ${line}" done < ${configurefile} fi alx_oldmconfigure ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die } # get custom mcore functions if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom ]] then echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom${COLDEFAULT}" source ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.custom ]] then echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}.custom${COLDEFAULT}" source ${SMAGENAME%/*}/alx/${PNAME}.custom fi