#!/bin/sh # Copyright 2011, 2012, 2017, 2018, 2020 Patrick J. Volkerding, Sebeka, MN, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Adapted by Nathaniel Russell for the modular Gnome build. # Gnome.SlackBuild Script # Set up general build options CLEANUP=${CLEANUP:-"yes"} # Clean up after build UPGRADE=${UPGRADE:-"no"} # Upgrade package after successful build PRECHECK=${PRECHECK:-"no"} # Perform a pre-check of sources CHECKOUT=${CHECKOUT:-"no"} # don't let the script checkout missing sources. GRACETME=${GRACETME:-"10"} # Grace time before build starts SKIPBUILT=${SKIPBUILT:-"no"} # Skip already built packages EXITFAIL=${EXITFAIL:-"yes"} # Exit on build failure # Function to get base name of the package (remove .tar extensions) pkgbase() { PKGEXT=$(echo $1 | rev | cut -f 1 -d . | rev) case $PKGEXT in 'gz' ) PKGRETURN=$(basename $1 .tar.gz) ;; 'bz2' ) PKGRETURN=$(basename $1 .tar.bz2) ;; 'xz' ) PKGRETURN=$(basename $1 .tar.xz) ;; 'deb' ) PKGRETURN=$(basename $1 .deb) ;; *) PKGRETURN=$(basename $1) ;; esac echo $PKGRETURN } # Set initial directory variables cd $(dirname $0) ; CWD=$(pwd) TMP=${TMP:-/home} SLACK_GNOME_BUILD_DIR=${GNOME_BUILD_DIR:-$TMP/build} mkdir -p "$SLACK_GNOME_BUILD_DIR" extract_archive() { # Find the archive first: local src_archive=$(find $CWD/src -name ${1} | tail -1) if [[ "$src_archive" == *.deb ]]; then local tempdir=$(mktemp -d) ( cd "$tempdir" && ar x "$src_archive" ) local data_archive=$(find "$tempdir" -name 'data.tar.*' | head -n 1) mkdir -p "$(pkgbase "$1")" tar -C "$tempdir" -xf "$data_archive" || return 1 # Move everything from tempdir into pkgbase dir find "$tempdir" -mindepth 1 -maxdepth 1 -exec mv -t "$(pkgbase "$1")" -- {} + rm -rf "$tempdir" return 0 fi # Regular tar-based logic if [ $(tar -tf $src_archive | grep -o '^[^/]\+' | sort -u | wc -l) -eq 1 ]; then tar -xf $src_archive || return 1 local topdir="$(tar -tf $src_archive | grep -o '^[^/]\+' | sort -u)" if [ "${topdir}" != "$(pkgbase $1)" ]; then mv ${topdir} $(pkgbase $1) fi else mkdir -p $(pkgbase $1) tar -C $(pkgbase $1) -xf $src_archive || return 1 fi } fix_perms() { local target_dir=$1 [ -z "$target_dir" ] && target_dir="." chown -R root:root "$target_dir" find "$target_dir" \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \ -exec chmod 755 {} \+ -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \+ } strip_binaries() { local target_dir=$1 [ -z "$target_dir" ] && target_dir="." find "$target_dir" | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find "$target_dir" | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find "$target_dir" | xargs file | grep "current ar archive" | grep ELF | cut -f 1 -d : | xargs strip -g 2> /dev/null # Strip rpaths: # Retain here just incase I need it later: #for file in $(find "$target_dir" | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : 2> /dev/null); do # if [ -n "$(patchelf --print-rpath "$file" 2> /dev/null)" ]; then # patchelf --remove-rpath "$file" # fi #done } process_man_pages() { # Move usr/share/man to usr/man if it exists if [ -d "usr/share/man" ]; then mkdir -p usr/man cp -av usr/share/man/* usr/man/ rm -fr usr/share/man # Find .gz files and check if an uncompressed version exists find usr/man -type f -name "*.gz" | while read -r gzfile; do uncompressed="${gzfile%.gz}" if [ -f "$uncompressed" ]; then rm -v "$gzfile" # Remove the .gz file only if an uncompressed version exists fi done fi # Compress and symlink the man pages if needed: if [ -d "usr/man" ]; then ( cd usr/man for manpagedir in $(find . -type d -name "man*"); do ( cd "$manpagedir" for eachpage in $(find . -type l -maxdepth 1); do ln -s "$(readlink "$eachpage").gz" "$eachpage.gz" rm "$eachpage" done gzip -9 *.* ) done ) fi } process_info_pages() { # Move usr/share/info to usr/info if it exists if [ -d "usr/share/info" ]; then mkdir -p usr/info mv usr/share/info/* usr/info/ rmdir usr/share/info fi # Compress info pages and remove "dir" file from the package: if [ -d "usr/info" ]; then ( cd usr/info rm -f dir gzip -9 * ) fi } #no_usr_share_doc() { # # If there are docs, move them: # if [ -d "usr/share/doc" ]; then # mkdir -p usr/doc # mv usr/share/doc/* usr/doc # rmdir usr/share/doc # fi #} no_usr_share_doc() { # If there are docs, move them: if [ -d "usr/share/doc" ]; then mkdir -p usr/doc/${DOCNAME}-${PACKAGE_VERSION} mv usr/share/doc/* usr/doc/${DOCNAME}-${PACKAGE_VERSION} rmdir usr/share/doc fi } no_usr_doc_prgnam() { # If there are docs, move them: if [ -d "usr/doc/${DOCNAME}" ]; then mv usr/doc/${DOCNAME}/* usr/doc/${DOCNAME}-${PACKAGE_VERSION} rmdir usr/doc/${DOCNAME} fi } no_usr_dups() { # If there are docs, move them: if [ -d "usr/doc/${DOCNAME}-${PACKAGE_VERSION}/${DOCNAME}-${PACKAGE_VERSION}" ]; then rm -fr usr/doc/${DOCNAME}-${PACKAGE_VERSION}/${DOCNAME}-${PACKAGE_VERSION} fi } no_systemd() { # Remove any systemd files if present: for path in usr/lib/systemd usr/lib64/systemd; do if [ -d "$path" ]; then rm -rf "$path" fi done } precheck() { # Initialize return value RETVAL=0 # Check if the source files match the module components we want to build: #for SRCFILE in $(find $CWD/src -name "*.tar.?z*" | grep -vE ".asc$|.sig$"); do for SRCFILE in $(find "$CWD/src" -type f \( -name "*.tar.?z*" -o -name "*.deb" \) | grep -vE ".asc$|.sig$"); do # Check if the source tarball is mentioned in pkgsrc # This feature should be reserved for cases where a different package name is needed PKGSRC=$(echo $SRCFILE | rev | cut -f2- -d- | cut -f1,2 -d/ | rev) PKGBASE=$(basename $(grep -lw $PKGSRC $CWD/pkgsrc/* 2>/dev/null) 2>/dev/null) # If PKGBASE is empty, derive it from the source filename if [ -z "$PKGBASE" ]; then PKGBASE=$(echo $(basename $SRCFILE) | rev | cut -f2- -d- | rev) fi # Check for the package in modules PKGTGT=$(grep -w ${PKGBASE}$ modules/*) if [ -n "$(echo $PKGTGT | cut -d: -f2- | grep "^ *#")" ]; then echo "Source file '$(basename $SRCFILE)' is commented out: ($PKGTGT) !" elif cat package-blacklist | grep -v "^ *#" | grep -wq ${PKGBASE}$ ; then echo "Source file '$(basename $SRCFILE)' is on the package-blacklist ($PKGBASE) !" elif ! cat modules/* | grep -v "^ *#" | grep -wq ${PKGBASE}$ ; then echo "Source file '$(basename $SRCFILE)' is not mentioned in 'modules' ($PKGBASE) !" RETVAL=1 fi done # Check for duplicate package names PKGDUP=$(cat $CWD/modules/* | grep -v "^ *#" | grep -v "^$" | sort | uniq -d) if [ -n "$PKGDUP" ]; then echo "Multiply-defined package names: '$(echo $PKGDUP)'" RETVAL=1 fi unset PKGDUP # Check each module package for correct source tarball and slack-desc file for MODPKG in $(cat $CWD/modules/* | grep -v "^ *#"); do # Determine if the module source is different from the package name if [ -f $CWD/pkgsrc/$MODPKG ]; then MODBASE=$(basename $(cat $CWD/pkgsrc/$MODPKG)) MODLOC=$(dirname $(cat $CWD/pkgsrc/$MODPKG))/ else MODBASE=$MODPKG MODLOC="" fi # Find the matching source tarball for the module MODSRC=$(find $CWD/src/$MODLOC -name $MODBASE-*.tar.* | grep -vE ".asc$|.sig$" | grep -E "$MODBASE-[^-]+.tar.*$|$MODBASE-[0-9].+.tar.*$") if [ -z "$MODSRC" ]; then echo "Module '$MODPKG' does not have a matching source tarball ($MODLOC$MODBASE)!" if [ "$CHECKOUT" = "yes" ] || [ "$CHECKOUT" = "YES" ]; then THEDATE=$(date +%Y%m%d) echo "Checking out ${MODLOC}:${MODBASE} at date ${THEDATE}." $CWD/gnome_checkout.sh -c -d ${THEDATE} -o $CWD/src ${MODLOC}:${MODBASE} RETVAL=$? if [ $RETVAL -ne 0 ]; then echo "Error while checking out '$MODPKG' ($MODLOC/$MODBASE) !" mv $CWD/src/$MODLOC/${MODBASE}-${THEDATE}git.tar.xz $CWD/src/$MODLOC/${MODBASE}-${THEDATE}git.tar.xz.failed fi else RETVAL=1 fi fi # Check for the existence of a slack-desc file, this is fatal if missing if [ -z "$(find $CWD/slack-desc -name ${MODPKG})" ]; then echo "Module '$MODPKG' does not have a slack-desc file !" RETVAL=1 fi done # If no errors, proceed with the build if [ $RETVAL -eq 0 ]; then echo "Check complete, build starts in ${GRACETME} seconds.." sleep ${GRACETME} else echo "Precheck failed with error code '$RETVAL'." exit 1 fi } # Function to download and build GNOME package build_mod_pkg() { gnome_module=$1 gnome_pkg=$2 cd $CWD/modules # See if $gnome_module is a module name like "gnome-frameworks": if [ ! -z "$gnome_module" ]; then if [ ! -f "$gnome_module" ]; then echo "** '${gnome_module}' is not an existing module." return fi fi PKG=${SLACK_GNOME_BUILD_DIR}/${gnome_module}/package-${gnome_module} rm -rf $PKG mkdir -p $PKG ( for PKGNAME in $(cat $gnome_module |grep -v "^$" |grep -v "^ *#") ; do if grep -wq "^${PKGNAME}$" ${CWD}/package-blacklist ; then if [ -z "$PRINT_PACKAGE_NAME" ]; then echo "** '${PKGNAME}' is on the package blacklist." fi continue fi # Find the full source filename - yeah ugly, but I had two goals: # 1- source tarball can be in a random subdirectory of src/ # 2- differentiate between e.g. 'gnome-shell' and 'gnome-settings-daemon' if [ -f $CWD/pkgsrc/$PKGNAME ]; then PKGSRC=$(basename $(cat $CWD/pkgsrc/$PKGNAME)) PKGLOC=$(dirname $(cat $CWD/pkgsrc/$PKGNAME)) else PKGSRC=$PKGNAME PKGLOC="" fi #gnome_src=$(basename $(find $CWD/src/$PKGLOC -name "$PKGSRC-*.tar.?z*" |grep -vE ".asc$|.sig$" |grep -E "$PKGSRC-[^-]+.tar.*$|$PKGSRC-[0-9].+.tar.*$") 2>/dev/null) #if [ "x$gnome_src" = "x" ]; then # if [ -z "$PRINT_PACKAGE_NAME" ]; then # echo "** Did not find '$PKGSRC' in src" # fi # continue #fi gnome_src=$(find "$CWD/src/$PKGLOC" -type f \( -name "$PKGSRC-*.tar.?z*" -o -name "$PKGSRC-*.deb" \) \ | grep -vE ".asc$|.sig$" \ | grep -E "$PKGSRC-[^-]+.(tar.*|deb)$|$PKGSRC-[0-9].+.(tar.*|deb)$" \ | head -n1 | xargs -r basename) if [ -z "$gnome_src" ]; then if [ -z "$PRINT_PACKAGE_NAME" ]; then echo "** Did not find '$PKGSRC' in src" fi continue fi # Reset $PKGARCH to its initial value: PKGARCH=$ARCH # Perhaps $PKGARCH should be something different: if grep -wq "^${PKGNAME}$" ${CWD}/noarch ; then PKGARCH=noarch fi cd $SLACK_GNOME_BUILD_DIR/${gnome_module} # If $gnome_pkg is set, we only want to build one package: if [ ! -z "$gnome_pkg" ]; then if [ "$gnome_pkg" = "$PKGNAME" ]; then # Set $PKG to a private dir for the modular package build: PKG=$SLACK_GNOME_BUILD_DIR/${gnome_module}/package-$PKGNAME rm -rf $PKG mkdir -p $PKG else continue fi else if [ -z "$PRINT_PACKAGE_NAME" ]; then echo echo "Building from source ${gnome_src}" echo fi fi # Set $PKG to a private dir for the modular package build: PKG=$SLACK_GNOME_BUILD_DIR/${gnome_module}/package-$PKGNAME rm -rf $PKG mkdir -p $PKG # Let's figure out the version number on the modular package: MODULAR_PACKAGE_VERSION=$(echo $gnome_src | rev | cut -f 3- -d . | cut -f 1 -d - | rev) # If this variable is passed to the script, nothing will be built. # Instead, a list of packages to be built will be output. if [ ! -z "$PRINT_PACKAGE_NAME" ]; then if [ -r $CWD/makepkg/${PKGNAME} ]; then MODBUILD=$(cat $CWD/makepkg/${PKGNAME}) else MODBUILD=$BUILD fi echo "${PKGNAME}-${MODULAR_PACKAGE_VERSION}-${PKGARCH}-${MODBUILD}${TAG}.txz" continue fi # If requested, skip packages that are already in the output directory: if [ "$SKIPBUILT" = "yes" ]; then # Construct the package name: if [ -r $CWD/makepkg/${PKGNAME} ]; then MODBUILD=$(cat $CWD/makepkg/${PKGNAME}) else MODBUILD=$BUILD fi TESTPKGNAME="${PKGNAME}-${MODULAR_PACKAGE_VERSION}-${PKGARCH}-${MODBUILD}${TAG}.txz" if [ -r ${SLACK_GNOME_BUILD_DIR}/${gnome_module}/$TESTPKGNAME -o -r ${SLACK_GNOME_BUILD_DIR}/$TESTPKGNAME ]; then echo "** Skipping already built package $TESTPKGNAME." continue fi fi rm -rf $(pkgbase $gnome_src) extract_archive $gnome_src || exit 1 cd $(pkgbase $gnome_src) || exit 1 fix_perms # If any patches are needed, call this script to apply them: if [ -r $CWD/patch/${PKGNAME}.patch ]; then . $CWD/patch/${PKGNAME}.patch || exit 1 fi # If there's any pre-install things to do, do them: if [ -r $CWD/pre-install/${PKGNAME}.pre-install ]; then . $CWD/pre-install/${PKGNAME}.pre-install fi # Run meson, using custom meson script if needed: if ! grep -wq "^${PKGNAME}$" ${CWD}/nomake ; then # Run meson, using custom meson script if needed: if [ -r $CWD/meson/${PKGNAME} ]; then . $CWD/meson/${PKGNAME} elif [ -r $CWD/meson/${gnome_module} ]; then . $CWD/meson/${gnome_module} else . $CWD/meson/meson fi # Run make, using custom make script if needed: if [ -r $CWD/make/${PKGNAME} ]; then . $CWD/make/${PKGNAME} elif [ -r $CWD/make/${gnome_module} ]; then . $CWD/make/${gnome_module} else # This is the default make && make install routine: . $CWD/make/make fi fi # Back to source toplevel builddir, since meson may have run in a subdir: cd $SLACK_GNOME_BUILD_DIR/${gnome_module}/$(pkgbase $gnome_src) # Source PRGNAM from the makepkg file if available if [ -r "$CWD/makepkg/${PKGNAME}" ]; then . "$CWD/makepkg/${PKGNAME}" fi # Use PRGNAM if it is set; otherwise, default to PKGNAME DOCNAME="${PRGNAM:-$PKGNAME}" PACKAGE_VERSION="${PKGVERSION:-$MODULAR_PACKAGE_VERSION}" # Create the documentation directory mkdir -p "$PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION}" # Use specific documentation files if available, else use a default set if [ -r "$CWD/docs/${DOCNAME}" ]; then cp -a $(cat "$CWD/docs/${DOCNAME}") \ "$PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION}" else cp -a \ AUTHORS* CONTRIBUTING* COPYING* HACKING* \ INSTALL* LICENSE* MAINTAINERS README* NEWS* TODO* CHANGES* *.rst NOTICE \ "$PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION}" # If there's a ChangeLog, include it with a limit of the most recent 1000 lines if [ -r ChangeLog ]; then DOCSDIR="$PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION}" head -n 1000 ChangeLog > "$DOCSDIR/ChangeLog" touch -r ChangeLog "$DOCSDIR/ChangeLog" fi if [ -f $CWD/slack-required/${DOCNAME} ]; then cat $CWD/slack-required/${DOCNAME} > "$PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION}"/slack-required; fi if [ -f $CWD/slack-required/${PKGNAME} ]; then cat $CWD/slack-required/${DOCNAME} > "$PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION}"/slack-required; fi fi # Get rid of zero-length junk files: if [ -r $CWD/makepkg/${DOCNAME} ]; then find $PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION} -type f -size 0 -exec rm --verbose "{}" \+ rmdir --verbose $PKG/usr/doc/${DOCNAME}-${PACKAGE_VERSION} 2> /dev/null else find $PKG/usr/doc/${PKGNAME}-$MODULAR_PACKAGE_VERSION -type f -size 0 -exec rm --verbose "{}" \+ rmdir --verbose $PKG/usr/doc/${PKGNAME}-$MODULAR_PACKAGE_VERSION 2> /dev/null fi # And get rid of any .la files rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la # Strip binaries if needed: if [ ! -r $CWD/nostrip/${PKGNAME} ]; then strip_binaries $PKG fi # If there's any special post-install things to do, do them: if [ -r $CWD/post-install/${PKGNAME}.post-install ]; then . $CWD/post-install/${PKGNAME}.post-install fi # If this package requires some doinst.sh material, add it here: #if [ -r $CWD/doinst.sh/${PKGNAME} ]; then # mkdir -p $PKG/install # cat $CWD/doinst.sh/${PKGNAME} \ # | sed -e "s#usr/lib#usr/lib${LIBDIRSUFFIX}#g" \ # >> $PKG/install/doinst.sh #else # cat $CWD/doinst.sh/${PKGNAME} \ # > $PKG/install/doinst.sh #fi # If this package requires some doinst.sh material, add it here: if [ -r "$CWD/doinst.sh/${PKGNAME}" ]; then mkdir -p "$PKG/install" cat "$CWD/doinst.sh/${PKGNAME}" > "$PKG/install/doinst.sh" fi # If this is a modular package, build it here: if [ -d $SLACK_GNOME_BUILD_DIR/${gnome_module}/package-${PKGNAME} ]; then cd $PKG process_man_pages process_info_pages no_usr_share_doc no_usr_doc_prgnam no_usr_dups no_systemd mkdir -p $PKG/install if [ -r $CWD/slack-desc/${PKGNAME} ]; then cat $CWD/slack-desc/${PKGNAME} > $PKG/install/slack-desc if [ -f $CWD/slack-required/${PKGNAME} ]; then cat $CWD/slack-required/${PKGNAME} > $PKG/install/slack-required; fi if [ -f $CWD/slack-required/${DOCNAME} ]; then cat $CWD/slack-required/${DOCNAME} > $PKG/install/slack-required; fi if [ -f $CWD/slack-suggests/${PKGNAME} ]; then cat $CWD/slack-suggests/${PKGNAME} > $PKG/install/slack-suggests; fi if [ -f $CWD/slack-conflicts/${PKGNAME} ]; then cat $CWD/slack-conflicts/${PKGNAME} > $PKG/install/slack-conflicts; fi else touch $PKG/install/slack-desc-missing touch $PKG/install/slack-required touch $PKG/install/slack-suggests touch $PKG/install/slack-conflicts fi if [ -r $CWD/build/${PKGNAME} ]; then MODBUILD=$(cat $CWD/build/${PKGNAME}) else MODBUILD=$BUILD fi if [ -r "$CWD/makepkg/${PKGNAME}" ]; then # Source the file to retrieve PRGNAM and PKGVERSION if defined . "$CWD/makepkg/${PKGNAME}" # Ensure PRGNAM and PKGVERSION are set after sourcing, else use defaults PACKAGE_NAME="${PRGNAM:-$PKGNAME}" PACKAGE_VERSION="${PKGVERSION:-$MODULAR_PACKAGE_VERSION}" # Set the build string BUILD="${MODBUILD}${TAG}" echo "Using custom package name: $PACKAGE_NAME, version: $PACKAGE_VERSION with build: $BUILD" # Use the parsed values in the makepkg command /sbin/makepkg --remove-tmp-rpaths -l y -c n "${SLACK_GNOME_BUILD_DIR}/${gnome_module}/${PACKAGE_NAME}-$(echo $PACKAGE_VERSION | tr - _)-${PKGARCH}-${BUILD}.txz" else # Fallback to default makepkg process with original PKGNAME /sbin/makepkg --remove-tmp-rpaths -l y -c n "${SLACK_GNOME_BUILD_DIR}/${gnome_module}/${PKGNAME}-$(echo $MODULAR_PACKAGE_VERSION | tr - _)-${PKGARCH}-${MODBUILD}${TAG}.txz" fi # We will continue with the fresh packages installed: if [ "$UPGRADE" = "yes" ] || [ "$UPGRADE" = "YES" ]; then if [ -r "$CWD/makepkg/${PKGNAME}" ]; then . "$CWD/makepkg/${PKGNAME}" upgradepkg --install-new --reinstall ${SLACK_GNOME_BUILD_DIR}/${gnome_module}/${PRGNAM:-$PACKAGE_NAME}-${PKGVERSION:-$PACKAGE_VERSION}-${PKGARCH}-${MODBUILD}${TAG}.txz # Keep MIME database current: /usr/bin/update-mime-database /usr/share/mime >/dev/null 2>&1 & else upgradepkg --install-new --reinstall ${SLACK_GNOME_BUILD_DIR}/${gnome_module}/${PKGNAME}-${MODULAR_PACKAGE_VERSION}-${PKGARCH}-${MODBUILD}${TAG}.txz # Keep MIME database current: /usr/bin/update-mime-database /usr/share/mime >/dev/null 2>&1 & fi fi fi done ) } # Process the module queue for GNOME and KDE. Format is: # module[:subpackage[,subpackage]] [module...] deterministic_build() { RET=0 for ENTRY in $1 ; do MODULE=$(echo "$ENTRY": | cut -f1 -d:) PKGS=$(echo "$ENTRY": | cut -f2 -d:) if [ -z "$PKGS" ]; then if [ -z "$PRINT_PACKAGE_NAME" ]; then echo "** SlackBuild building '$MODULE'" fi build_mod_pkg $MODULE let RET=$RET+$? else if [ "${PKGS: -1}" = "," ]; then # Last character is a ','. Expand the list with all subsequent packages. START_PKG=$(echo $PKGS |rev |cut -d, -f2 |rev) MOD_LIST=$(cat modules/$MODULE |grep -v "^ *#" |grep -v "^$" |tr '\n' ',') PKGS="${PKGS}${MOD_LIST/#?*,${START_PKG},/}" if [ -z "$PRINT_PACKAGE_NAME" ]; then echo "** SlackBuild expanding '$ENTRY' to '$MODULE:$PKGS'" fi fi for PKG in $(echo $PKGS |tr ',' ' ') ; do if [ -z "$PRINT_PACKAGE_NAME" ]; then echo "** SlackBuild building '$MODULE:$PKG'" fi build_mod_pkg $MODULE $PKG let RET=$RET+$? done fi done return $RET } # MAIN PART # # Import the build configuration options for as far as they are not already set: [ -r ./gnome.options ] && . ./gnome.options # This avoids compiling a version number into GNOME's .la files: GTKDIR=/usr/lib${LIBDIRSUFFIX}/gtk-3.0 ; export GTKDIR GNOMEVARS=/usr/lib${LIBDIRSUFFIX}/gnome ; export GNOMEVARS # Get the GNOME environment variables: [ -d post-install/gservice ] && eval $(sed -e "s#/lib#/lib${LIBDIRSUFFIX}#" ./post-install/gservice/profile.d/gnome.sh) # Build/install libgnome before compiling gnome-shell. # Build/install libgtk before compiling gnome-terminal. # Build/install gnome-shell before compiling gnome-settings-daemon. GNOMEMODS=" \ blacklist \ gnome \ gnome-extras \ applications \ " # Allow for specification of individual packages to be built: if [ -z "$1" ]; then MODQUEUE=$GNOMEMODS else MODQUEUE="$*" fi # If requested, check if sources, module definitions, and slack-desc are complete and matching: if [ "$PRECHECK" = "yes" -o "$PRECHECK" = "YES" ]; then precheck fi # And finally, start working! for module in \ $MODQUEUE ; do if [ -z "$PRINT_PACKAGE_NAME" ]; then echo "SlackBuild processing module '$module'" fi deterministic_build $module if [ $? = 0 ]; then # Success! if [ "$CLEANUP" = "yes" -o "$CLEANUP" = "YES" ]; then # Clean out package and build directories: find ${SLACK_GNOME_BUILD_DIR}/$(echo $module |cut -f1 -d:) -type d -mindepth 1 -maxdepth 1 |xargs rm -rf fi else if [ -z "$PRINT_PACKAGE_NAME" ]; then echo "${module} failed to build." fi if [ "$EXITFAIL" = "yes" ]; then exit 1 fi fi cd - > /dev/null done exit 0