# $Id$ # mcore specific functions # some global includes sminclude cleanutils mtools INHERITS="mcore" # 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%/*}/mcore/files/$1" dest="$2" if [[ -z $2 ]] then dest=/usr/bin install -d ${BINDIR}/${dest} || die fi # install our configfile install -m 0644 -o root -g root ${file} ${BINDIR}/${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%/*}/mcore/files/$1" dest="$2" if [[ -z $2 ]] then dest=/usr/bin install -d ${BINDIR}/${dest} || die fi # install our configfile install -m 0755 -o root -g root ${file} ${BINDIR}/${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%/*}/mcore/files/${PATCHFILE} > /dev/null if [[ $? = 0 ]] then PATCHOPTS="-Np${i}" break fi done fi echo -e "${COLBLUE}*** ${COLGREEN}Applying mCore patch '${PATCHFILE}'${COLDEFAULT}" patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/mcore/files/${PATCHFILE} } ############################# ##### compile functions #### ############################# # respect multilib! if [[ -z $(typeset -f oldconfigure) ]] then mc_old_mconfigure=mc_old$(typeset -f mconfigure) else mc_old_mconfigure=mc_old$(typeset -f oldmconfigure) fi eval ${mc_old_mconfigure} mconfigure() { local myconf local configurefile # get configure instructions from smage dir if [[ -f ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.cfg ]] then # version specific configure files configurefile=${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.cfg elif [[ -f ${SMAGENAME%/*}/mcore/${PNAME}.cfg ]] then # generic configure files for a package configurefile=${SMAGENAME%/*}/mcore/${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 MCORE_CONFIGURE_OPTS" MCORE_CONFIGURE_OPTS+=" ${line}" done < ${configurefile} fi case "${MCORE_NO_DISABLE_NLS}" in 1|true|TRUE|yes|YES) ;; *) myconf="${myconf} --disable-nls" ;; esac mc_oldmconfigure ${myconf} $@ ${MCORE_CONFIGURE_OPTS} || die } # get custom mcore functions if [[ -f ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.custom ]] then echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.custom${COLDEFAULT}" source ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.custom elif [[ -f ${SMAGENAME%/*}/mcore/${PNAME}.custom ]] then echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/mcore/${PNAME}.custom${COLDEFAULT}" source ${SMAGENAME%/*}/mcore/${PNAME}.custom fi