2018-05-28 21:12:29 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright 2011, 2012, 2017, 2018 Patrick J. Volkerding, Sebeka, MN, USA
|
2012-09-26 03:10:42 +02:00
|
|
|
# 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.
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
# Adapted by Eric Hameleers <alien@slackware.com> from the modular x.org build.
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
# To build only a single package group, specify it as $1, like:
|
|
|
|
# ./KDE.SlackBuild kdeedu
|
|
|
|
# To build only a single package, specify both the group name
|
|
|
|
# and the name of the package, like:
|
|
|
|
# ./KDE.SlackBuild kdeedu:marble
|
|
|
|
# ./KDE.SlackBuild kdebindings:perlqt,perlkde
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
|
|
|
|
CLEANUP=${CLEANUP:-"yes"} # clean up build directory after successful build.
|
|
|
|
PRECHECK=${PRECHECK:-"no"} # don't let the script check the available sources.
|
|
|
|
CHECKOUT=${CHECKOUT:-"no"} # don't let the script checkout missing sources.
|
|
|
|
|
|
|
|
KDEGITURI="git://anongit.kde.org"
|
|
|
|
|
|
|
|
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)
|
|
|
|
;;
|
|
|
|
'lzma' )
|
|
|
|
PKGRETURN=$(basename $1 .tar.lzma)
|
|
|
|
;;
|
|
|
|
'xz' )
|
|
|
|
PKGRETURN=$(basename $1 .tar.xz)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
PKGRETURN=$(basename $1)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo $PKGRETURN
|
|
|
|
}
|
|
|
|
|
|
|
|
# Set initial variables:
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
if [ -z "$TMP" ]; then
|
|
|
|
TMP=/tmp
|
|
|
|
# Old default output directory. If $TMP wasn't predefined, we'll default to
|
|
|
|
# using it unless a different value is provided:
|
|
|
|
SLACK_KDE_BUILD_DIR=${SLACK_KDE_BUILD_DIR:-/tmp/kde_build}
|
|
|
|
else
|
|
|
|
# $TMP already set. We'll also use it for the output directory unless
|
|
|
|
# a different value is provided:
|
|
|
|
SLACK_KDE_BUILD_DIR=${SLACK_KDE_BUILD_DIR:-$TMP}
|
|
|
|
fi
|
|
|
|
mkdir -p $TMP $SLACK_KDE_BUILD_DIR
|
2012-09-26 03:10:42 +02:00
|
|
|
|
|
|
|
# Set up a few useful functions:
|
|
|
|
|
|
|
|
fix_perms() {
|
|
|
|
target_dir=$1
|
|
|
|
[ -z "$target_dir" ] && target_dir='.'
|
|
|
|
|
|
|
|
chown -R root:root $target_dir
|
|
|
|
find $target_dir \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
|
|
-exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
|
|
-exec chmod 644 {} \;
|
|
|
|
}
|
|
|
|
|
|
|
|
strip_binaries() {
|
|
|
|
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
|
2018-05-28 21:12:29 +02:00
|
|
|
# Also strip rpaths:
|
|
|
|
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 [ ! "$(patchelf --print-rpath $file 2> /dev/null)" = "" ]; then
|
|
|
|
patchelf --remove-rpath $file
|
|
|
|
fi
|
|
|
|
done
|
2012-09-26 03:10:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
process_man_pages() {
|
|
|
|
# Compress and if needed symlink the man pages:
|
|
|
|
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() {
|
|
|
|
# Compress info pages and purge "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
|
|
|
|
}
|
|
|
|
|
|
|
|
precheck() {
|
|
|
|
# See if the sources we have match the module components we want to build:
|
|
|
|
RETVAL=0
|
|
|
|
|
|
|
|
for SRCFILE in $(find $CWD/src -name "*.tar.?z*") ; do
|
|
|
|
if cat modules/* |grep "^ *#" |grep -wq $(echo $(basename $SRCFILE) | rev | cut -f2- -d- | rev)$ ; then
|
|
|
|
echo "Source file '$(basename $SRCFILE)' is commented out in 'modules' !"
|
|
|
|
elif ! cat modules/* |grep -v "^ *#" |grep -wq $(echo $(basename $SRCFILE) | rev | cut -f2- -d- | rev) ; then
|
|
|
|
echo "Source file '$(basename $SRCFILE)' is not mentioned in 'modules' !"
|
|
|
|
RETVAL=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for MODULE in $(cat $CWD/modules/* | grep -v "^#") ; do
|
|
|
|
#if [ -z "$(find $CWD/src -name ${MODULE}-*)" ] ; then
|
|
|
|
if [ -z "$(find $CWD/src -name $MODULE-*.tar.* |grep -E "$MODULE-[^-]+.tar.*$|$MODULE-[0-9].+.tar.*$")" ] ; then
|
|
|
|
echo "Module '$MODULE' does not have a matching source tarball !"
|
|
|
|
if [ "$CHECKOUT" = "yes" -o "$CHECKOUT" = "YES" ]; then
|
|
|
|
echo "Checking out KDE component at branch '$VERSION'."
|
|
|
|
git archive --format=tar --prefix {$MODULE}-${VERSION}/ --remote ${KDEGITURI}/${MODULE}.git v${VERSION} | xz -c > $CWD/src/${MODULE}-${VERSION}.tar.xz
|
|
|
|
RETVAL=$?
|
|
|
|
if [ $RETVAL -ne 0 ]; then
|
|
|
|
echo "Error while checking out '$MODULE' !"
|
|
|
|
mv $CWD/src/${MODULE}-${VERSION}.tar.xz $CWD/src/${MODULE}-${VERSION}.tar.xz.failed
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
RETVAL=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# A missing slack-desc counts as fatal even if the program may end up
|
|
|
|
# inside the big meta-package.
|
|
|
|
if [ -z "$(find $CWD/slack-desc -name ${MODULE})" ] ; then
|
|
|
|
echo "Module '$MODULE' does not have a slack-desc file !"
|
|
|
|
RETVAL=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $RETVAL -eq 0 ]; then
|
|
|
|
echo "Check complete, build starts in 5 seconds"
|
|
|
|
sleep 5
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Support function builds one complete module (like 'kdelibs'), or
|
|
|
|
# exactly one package which is part of a module (like 'okular'):
|
|
|
|
build_mod_pkg () {
|
|
|
|
kde_module=$1
|
|
|
|
kde_pkg=$2
|
|
|
|
|
|
|
|
cd $CWD/modules
|
|
|
|
|
|
|
|
# See if $kde_module is a module name like "kdeadmin":
|
|
|
|
if [ ! -z "$kde_module" ]; then
|
|
|
|
if [ ! -f "$kde_module" ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
PKG=${SLACK_KDE_BUILD_DIR}/${kde_module}/package-${kde_module}
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $PKG
|
|
|
|
( for PKGNAME in $(cat $kde_module |grep -v "^$" |grep -v "^#") ; do
|
|
|
|
# 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. 'kdepim' and 'kdepim-runtime'
|
|
|
|
kde_src=$(basename $(find $CWD/src -name "$PKGNAME-*.tar.?z*" |grep -E "$PKGNAME-[^-]+.tar.*$|$PKGNAME-[0-9].+.tar.*$") 2>/dev/null)
|
|
|
|
if [ "x$kde_src" = "x" ]; then
|
|
|
|
echo "** Did not find '$PKGNAME' in src"
|
|
|
|
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
|
|
|
|
if grep -wq "^$PKGNAME" ${CWD}/package-blacklist ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
cd $SLACK_KDE_BUILD_DIR/${kde_module}
|
|
|
|
# If $kde_pkg is set, we only want to build one package:
|
|
|
|
if [ ! -z "$kde_pkg" ]; then
|
|
|
|
if [ "$kde_pkg" = "$PKGNAME" ]; then
|
|
|
|
# Set $PKG to a private dir for the modular package build:
|
|
|
|
PKG=$SLACK_KDE_BUILD_DIR/${kde_module}/package-$PKGNAME
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $PKG
|
|
|
|
else
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
else
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo
|
|
|
|
echo "Building from source ${kde_src}"
|
|
|
|
echo
|
|
|
|
fi
|
2012-09-26 03:10:42 +02:00
|
|
|
fi
|
|
|
|
if grep -wq "^$PKGNAME" ${CWD}/modularize ; then
|
|
|
|
# Set $PKG to a private dir for the modular package build:
|
|
|
|
PKG=$SLACK_KDE_BUILD_DIR/${kde_module}/package-$PKGNAME
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $PKG
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Let's figure out the version number on the modular package:
|
|
|
|
MODULAR_PACKAGE_VERSION=$(echo $kde_src | rev | cut -f 3- -d . | cut -f 1 -d - | rev)
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# 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/build/${PKGNAME} ]; then
|
|
|
|
MODBUILD=$(cat $CWD/build/${PKGNAME})
|
|
|
|
else
|
|
|
|
MODBUILD=$BUILD
|
|
|
|
fi
|
|
|
|
if [ "$PKGNAME" = "kde-runtime" -o "$PKGNAME" = "kmix" ]; then
|
|
|
|
# If this package is being built for ALSA (no PulseAudio), use the _alsa $TAG:
|
|
|
|
if [ ! -r /usr/lib${LIBDIRSUFFIX}/pkgconfig/libpulse.pc ]; then
|
|
|
|
MODBUILD=${MODBUILD}_alsa
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "${PKGNAME}-${MODULAR_PACKAGE_VERSION}-${PKGARCH}-${MODBUILD}.txz"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
rm -rf $(pkgbase $kde_src)
|
|
|
|
tar xf $(find $CWD/src -name ${kde_src}) || exit 1
|
|
|
|
cd $(pkgbase $kde_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 cmake, using custom cmake script if needed:
|
|
|
|
if [ -r $CWD/cmake/${PKGNAME} ]; then
|
|
|
|
. $CWD/cmake/${PKGNAME}
|
2013-11-04 18:08:47 +01:00
|
|
|
elif [ -r $CWD/cmake/${kde_module} ]; then
|
|
|
|
. $CWD/cmake/${kde_module}
|
2012-09-26 03:10:42 +02:00
|
|
|
else
|
|
|
|
# This is the default configure script:
|
|
|
|
. $CWD/cmake/cmake
|
|
|
|
fi
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# Run make, using custom make script if needed:
|
|
|
|
if [ -r $CWD/make/${PKGNAME} ]; then
|
|
|
|
. $CWD/make/${PKGNAME}
|
|
|
|
elif [ -r $CWD/make/${kde_module} ]; then
|
|
|
|
. $CWD/make/${kde_module}
|
|
|
|
else
|
|
|
|
# This is the default make && make install routine:
|
|
|
|
make $NUMJOBS || make || exit 1
|
|
|
|
make install DESTDIR=$PKG || exit 1
|
|
|
|
fi
|
2012-09-26 03:10:42 +02:00
|
|
|
|
|
|
|
# Back to source toplevel builddir, since cmake may have run in a subdir:
|
|
|
|
cd $SLACK_KDE_BUILD_DIR/${kde_module}/$(pkgbase $kde_src)
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/${PKGNAME}-${MODULAR_PACKAGE_VERSION}
|
|
|
|
# Use specific documentation files if available, else use a default set:
|
|
|
|
if [ -r $CWD/docs/${PKGNAME} ]; then
|
|
|
|
cp -a $(cat $CWD/docs/${PKGNAME}) \
|
|
|
|
$PKG/usr/doc/${PKGNAME}-${MODULAR_PACKAGE_VERSION}
|
|
|
|
else
|
|
|
|
cp -a \
|
|
|
|
AUTHORS* CONTRIBUTING* COPYING* HACKING* \
|
|
|
|
INSTALL* MAINTAINERS README* NEWS* TODO* \
|
|
|
|
$PKG/usr/doc/${PKGNAME}-${MODULAR_PACKAGE_VERSION}
|
|
|
|
# If there's a ChangeLog, installing at least part of the recent
|
|
|
|
# history is useful, but don't let it get totally out of control:
|
|
|
|
if [ -r ChangeLog ]; then
|
|
|
|
DOCSDIR=$(echo $PKG/usr/doc/${PKGNAME}-$MODULAR_PACKAGE_VERSION)
|
|
|
|
cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
|
|
|
|
touch -r ChangeLog $DOCSDIR/ChangeLog
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get rid of zero-length junk files:
|
|
|
|
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
|
|
|
|
|
|
|
|
# Strip binaries:
|
|
|
|
strip_binaries $PKG
|
|
|
|
|
|
|
|
# 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
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If this is a modular package, build it here:
|
|
|
|
if [ -d $SLACK_KDE_BUILD_DIR/${kde_module}/package-$PKGNAME ]; then
|
|
|
|
cd $PKG
|
|
|
|
process_man_pages
|
|
|
|
process_info_pages
|
|
|
|
no_usr_share_doc
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
if [ -r $CWD/slack-desc/${PKGNAME} ]; then
|
|
|
|
cat $CWD/slack-desc/${PKGNAME} > $PKG/install/slack-desc
|
|
|
|
else
|
|
|
|
touch $PKG/install/slack-desc-missing
|
|
|
|
fi
|
|
|
|
if [ -r $CWD/build/${PKGNAME} ]; then
|
|
|
|
MODBUILD=$(cat $CWD/build/${PKGNAME})
|
|
|
|
else
|
|
|
|
MODBUILD=$BUILD
|
|
|
|
fi
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ "$PKGNAME" = "kde-runtime" -o "$PKGNAME" = "kmix" ]; then
|
|
|
|
# If this package is being built for ALSA (no PulseAudio), use the _alsa $TAG:
|
|
|
|
if [ ! -r /usr/lib${LIBDIRSUFFIX}/pkgconfig/libpulse.pc ]; then
|
|
|
|
MODBUILD=${MODBUILD}_alsa
|
|
|
|
fi
|
|
|
|
fi
|
2012-09-26 03:10:42 +02:00
|
|
|
if [ -r $CWD/makepkg/${PKGNAME} ]; then
|
|
|
|
BUILD=$MODBUILD . $CWD/makepkg/${PKGNAME}
|
|
|
|
else
|
|
|
|
/sbin/makepkg -l y -c n ${SLACK_KDE_BUILD_DIR}/${kde_module}/${PKGNAME}-$(echo $MODULAR_PACKAGE_VERSION |tr - _)-${PKGARCH}-${MODBUILD}.txz
|
|
|
|
fi
|
|
|
|
# We will continue with the fresh packages installed:
|
|
|
|
upgradepkg --install-new --reinstall ${SLACK_KDE_BUILD_DIR}/${kde_module}/${PKGNAME}-${MODULAR_PACKAGE_VERSION}-${PKGARCH}-${MODBUILD}.txz
|
|
|
|
# Keep MIME database current:
|
|
|
|
/usr/bin/update-mime-database /usr/share/mime 1>/dev/null 2>/dev/null &
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Reset $PKG to assume we're building the whole source dir:
|
|
|
|
PKG=${SLACK_KDE_BUILD_DIR}/${kde_module}/package-${kde_module}
|
|
|
|
|
|
|
|
done
|
|
|
|
|
2013-11-04 18:08:47 +01:00
|
|
|
# At this point, we have left the loop to build modular packages.
|
|
|
|
# We might need to build a package for the "<kde_module>", but to
|
|
|
|
# avoid needlessly repacking if there happens to be a package with
|
|
|
|
# the same name as "<kde_module>", we'll do some checks first.
|
|
|
|
|
|
|
|
# If every package listed in modules/"<kde_module>" is also listed
|
|
|
|
# in the modularize file, then there's no need to make a package
|
|
|
|
# for "<kde_module>":
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo
|
|
|
|
echo "Searching for packages in ${kde_module} that were not built modular:"
|
|
|
|
fi
|
2013-11-04 18:08:47 +01:00
|
|
|
cat $CWD/modules/${kde_module} | grep -v "^#" | grep -v -w "^" | while read checkpackage ; do
|
|
|
|
if ! grep -wq "^$checkpackage" ${CWD}/modularize ; then
|
|
|
|
# Non-modular package found, so we'll have to build the package below.
|
|
|
|
# It might already have been built once, but in that case it is likely
|
|
|
|
# that more things have been added to the package directory since then.
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo "Found non-modular package $checkpackage."
|
|
|
|
fi
|
2013-11-04 18:08:47 +01:00
|
|
|
exit 99
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Exit if everything in "<kde_module>" was built modular:
|
|
|
|
if [ ! $? = 99 ]; then
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo "No non-modular components found in ${kde_module}."
|
|
|
|
echo "Not building catch-all package for ${kde_module}."
|
|
|
|
echo
|
|
|
|
fi
|
2013-11-04 18:08:47 +01:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If there's no /usr directory in the "<kde_module>" package directory,
|
|
|
|
# then skip it. There's nothing present worth packing up.
|
2012-09-26 03:10:42 +02:00
|
|
|
if [ ! -d ${SLACK_KDE_BUILD_DIR}/${kde_module}/package-${kde_module}/usr ]; then
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo "No /usr directory found in package-${kde_module}."
|
|
|
|
echo "Not building catch-all package for ${kde_module}."
|
|
|
|
echo
|
|
|
|
fi
|
2012-09-26 03:10:42 +02:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build a "<kde_module>" package for anything that wasn't built modular:
|
|
|
|
# It's safer to consider these to have binaries in them. ;-)
|
2013-11-04 18:08:47 +01:00
|
|
|
|
|
|
|
# Put up a bit of a black-box warning, in case this was a mistake where
|
|
|
|
# something was meant to be listed in the modularize file and wasn't:
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo
|
|
|
|
echo "**************************************************************************"
|
|
|
|
echo "* Building combined package for non-modular parts of ${kde_module}"
|
|
|
|
echo "**************************************************************************"
|
|
|
|
echo
|
|
|
|
fi
|
2013-11-04 18:08:47 +01:00
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
PKGARCH=$ARCH
|
|
|
|
cd $PKG
|
|
|
|
|
|
|
|
process_man_pages
|
|
|
|
process_info_pages
|
|
|
|
no_usr_share_doc
|
|
|
|
|
|
|
|
# If there are post-install things to do for the combined package,
|
|
|
|
# we do them here. This could be used for things like making a
|
|
|
|
# VERSION number for a combined package. :-)
|
|
|
|
if [ -r $CWD/post-install/${kde_module}.post-install ]; then
|
|
|
|
. $CWD/post-install/${kde_module}.post-install
|
|
|
|
fi
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
if [ -r $CWD/slack-desc/${kde_module} ]; then
|
|
|
|
cat $CWD/slack-desc/${kde_module} > $PKG/install/slack-desc
|
|
|
|
else
|
|
|
|
touch $PKG/install/slack-desc-missing
|
|
|
|
fi
|
|
|
|
if [ -r $CWD/doinst.sh/${kde_module} ]; then
|
|
|
|
cat $CWD/doinst.sh/${kde_module} \
|
|
|
|
| sed -e "s#usr/lib#usr/lib${LIBDIRSUFFIX}#g" \
|
|
|
|
>> $PKG/install/doinst.sh
|
|
|
|
fi
|
|
|
|
if [ -r $CWD/build/${kde_module} ]; then
|
|
|
|
SRCDIRBUILD=$(cat $CWD/build/${kde_module})
|
|
|
|
else
|
|
|
|
SRCDIRBUILD=$BUILD
|
|
|
|
fi
|
|
|
|
if [ -r $CWD/makepkg/${kde_module} ]; then
|
|
|
|
BUILD=$SRCDIRBUILD . $CWD/makepkg/${kde_module}
|
|
|
|
else
|
|
|
|
/sbin/makepkg -l y -c n ${SLACK_KDE_BUILD_DIR}/${kde_module}/${kde_module}-$(echo $VERSION |tr - _)-${PKGARCH}-${SRCDIRBUILD}.txz
|
|
|
|
fi
|
|
|
|
# We will continue with the fresh packages installed:
|
|
|
|
upgradepkg --install-new --reinstall ${SLACK_KDE_BUILD_DIR}/${kde_module}/${kde_module}-${VERSION}-${PKGARCH}-${SRCDIRBUILD}.txz
|
|
|
|
# Keep MIME database current:
|
|
|
|
/usr/bin/update-mime-database /usr/share/mime 1>/dev/null 2>/dev/null &
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
# Process the module queue. Format is:
|
|
|
|
# module[:subpackage[,subpackage]] [module...]
|
|
|
|
deterministic_build() {
|
|
|
|
RET=0
|
|
|
|
for ENTRY in $1 ; do
|
|
|
|
KDE_MOD=$(echo "$ENTRY": | cut -f1 -d:)
|
|
|
|
KDE_PKGS=$(echo "$ENTRY": | cut -f2 -d:)
|
|
|
|
if [ -z "$KDE_PKGS" ]; then
|
|
|
|
build_mod_pkg $KDE_MOD
|
|
|
|
let RET=$RET+$?
|
|
|
|
else
|
|
|
|
for KDE_PKG in $(echo $KDE_PKGS |tr ',' ' ') ; do
|
|
|
|
build_mod_pkg $KDE_MOD $KDE_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:
|
2018-05-28 21:12:29 +02:00
|
|
|
[ -r ./kde.options ] && . ./kde.options
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
# This avoids compiling a version number into KDE's .la files:
|
|
|
|
QTDIR=/usr/lib${LIBDIRSUFFIX}/qt ; export QTDIR
|
|
|
|
|
|
|
|
# Get the kde environment variables
|
2012-09-26 03:10:42 +02:00
|
|
|
[ -d post-install/kdebase ] && eval $(sed -e "s#/lib#/lib${LIBDIRSUFFIX}#" ./post-install/kdebase/profile.d/kde.sh)
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
# Yes, we know kde-workspace is built twice. kdebase needs the
|
|
|
|
# plasma bits from it, and then we build it again for good measure...
|
|
|
|
# Same goes for kdelibs (at least during KDE 4.8.x) kdeutils:ksecrets needs
|
|
|
|
# kdelibs and then kdelibs needs a rebuild to pick up ksecretservice
|
|
|
|
# (this will no longer be required in KDE 4.9).
|
2013-11-04 18:08:47 +01:00
|
|
|
# And kde-baseapps is rebuilt after kdewebdev because it can then pickup
|
|
|
|
# libtidy and enable the Konqueror validators plugin to validate HTML.
|
2009-08-26 17:00:38 +02:00
|
|
|
KDEMODS=" \
|
|
|
|
kdelibs \
|
2013-11-04 18:08:47 +01:00
|
|
|
kdebase:nepomuk-core \
|
2009-08-26 17:00:38 +02:00
|
|
|
kdepimlibs \
|
|
|
|
kdebase \
|
2010-05-19 10:58:23 +02:00
|
|
|
kdesdk \
|
2016-06-30 22:26:57 +02:00
|
|
|
extragear:libkscreen \
|
2010-05-19 10:58:23 +02:00
|
|
|
kdegraphics \
|
|
|
|
kdebindings \
|
2012-09-26 03:10:42 +02:00
|
|
|
kdebase:kde-workspace \
|
2009-08-26 17:00:38 +02:00
|
|
|
kdeaccessibility \
|
|
|
|
kdeutils \
|
2012-09-26 03:10:42 +02:00
|
|
|
kdelibs \
|
2009-08-26 17:00:38 +02:00
|
|
|
kdemultimedia \
|
2012-09-26 03:10:42 +02:00
|
|
|
extragear:libktorrent \
|
2009-08-26 17:00:38 +02:00
|
|
|
kdenetwork \
|
2010-05-19 10:58:23 +02:00
|
|
|
oxygen-icons \
|
2009-08-26 17:00:38 +02:00
|
|
|
kdeadmin \
|
|
|
|
kdeartwork \
|
|
|
|
kdegames \
|
|
|
|
kdetoys \
|
|
|
|
kdepim \
|
2010-05-19 10:58:23 +02:00
|
|
|
kdepim-runtime \
|
2016-06-30 22:26:57 +02:00
|
|
|
kdenetwork:kopete \
|
2009-08-26 17:00:38 +02:00
|
|
|
kdeedu \
|
|
|
|
kdewebdev \
|
2013-11-04 18:08:47 +01:00
|
|
|
kdebase:kde-baseapps \
|
2010-05-19 10:58:23 +02:00
|
|
|
kdeplasma-addons \
|
2012-09-26 03:10:42 +02:00
|
|
|
polkit-kde \
|
|
|
|
extragear \
|
|
|
|
"
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
# Allow for specification of individual packages to be built:
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
MODQUEUE=$KDEMODS
|
|
|
|
else
|
2012-09-26 03:10:42 +02:00
|
|
|
MODQUEUE="$*"
|
2009-08-26 17:00:38 +02:00
|
|
|
fi
|
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
# 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!
|
2009-08-26 17:00:38 +02:00
|
|
|
for module in \
|
|
|
|
$MODQUEUE ;
|
|
|
|
do
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo "SlackBuild processing module '$module'"
|
|
|
|
fi
|
2012-09-26 03:10:42 +02:00
|
|
|
deterministic_build $module
|
2009-08-26 17:00:38 +02:00
|
|
|
if [ $? = 0 ]; then
|
2012-09-26 03:10:42 +02:00
|
|
|
# Move the created packages up into the KDE build directory:
|
2018-05-28 21:12:29 +02:00
|
|
|
mv ${SLACK_KDE_BUILD_DIR}/$(echo $module |cut -f1 -d:)/*.t?z ${SLACK_KDE_BUILD_DIR}/ 2> /dev/null
|
2012-09-26 03:10:42 +02:00
|
|
|
if [ "$CLEANUP" = "yes" -o "$CLEANUP" = "YES" ]; then
|
|
|
|
# Clean out package and build directories:
|
|
|
|
rm -rf ${SLACK_KDE_BUILD_DIR}/$(echo $module |cut -f1 -d:)
|
|
|
|
fi
|
2009-08-26 17:00:38 +02:00
|
|
|
else
|
2018-05-28 21:12:29 +02:00
|
|
|
if [ -z "$PRINT_PACKAGE_NAME" ]; then
|
|
|
|
echo "${module} failed to build."
|
|
|
|
fi
|
2009-08-26 17:00:38 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2018-05-28 21:12:29 +02:00
|
|
|
cd - > /dev/null
|
2009-08-26 17:00:38 +02:00
|
|
|
done
|
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
|