diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/COPYING | 24 | ||||
-rw-r--r-- | Build/TODO | 11 | ||||
l--------- | Build/build.sh | 1 | ||||
-rwxr-xr-x | Build/lib/arch.sh | 97 | ||||
-rwxr-xr-x | Build/lib/build.sh | 50 | ||||
-rwxr-xr-x | Build/lib/color.sh | 98 | ||||
-rwxr-xr-x | Build/lib/defines.sh | 86 | ||||
-rwxr-xr-x | Build/lib/display.sh | 64 | ||||
-rwxr-xr-x | Build/lib/error.sh | 30 | ||||
-rwxr-xr-x | Build/lib/post/10-rmla.sh | 48 | ||||
-rwxr-xr-x | Build/lib/post/20-strip.sh | 55 | ||||
-rwxr-xr-x | Build/lib/post/30-info.sh | 39 | ||||
-rwxr-xr-x | Build/lib/post/40-man.sh | 35 | ||||
-rwxr-xr-x | Build/lib/post/50-depends.sh | 31 | ||||
-rwxr-xr-x | Build/lib/post/60-package.sh | 48 | ||||
-rwxr-xr-x | Build/lib/pre/10-download.sh | 60 | ||||
-rw-r--r-- | Build/lib/pre/20-check.sh | 28 | ||||
-rwxr-xr-x | Build/lib/pre/30-unpack.sh | 60 | ||||
-rwxr-xr-x | Build/lib/pre/40-patch.sh | 39 | ||||
-rwxr-xr-x | Build/lib/pre/50-build.sh | 46 | ||||
-rwxr-xr-x | Build/lib/pre/60-docs.sh | 48 | ||||
-rwxr-xr-x | Build/lib/script.sh | 91 | ||||
-rwxr-xr-x | Build/lib/util.sh | 70 | ||||
-rw-r--r-- | Build/profile/build.conf.slackware64 | 66 | ||||
-rw-r--r-- | Build/profile/build.conf.tightware | 68 | ||||
-rwxr-xr-x | Build/sample.build | 58 |
26 files changed, 1351 insertions, 0 deletions
diff --git a/Build/COPYING b/Build/COPYING new file mode 100644 index 0000000..ca5e05e --- /dev/null +++ b/Build/COPYING @@ -0,0 +1,24 @@ +Copyright (c) 2012, Deposite Pirate +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. diff --git a/Build/TODO b/Build/TODO new file mode 100644 index 0000000..587f760 --- /dev/null +++ b/Build/TODO @@ -0,0 +1,11 @@ +* checksums SHA-* +* isolate slackware stuff (post/*-depends.sh & post/*-package.sh = post/*-slackware.sh) +* make generic functions for distro specific stuff that can be used as needed +* create pacman{-g2} packages +* fix $(libdirsuffix) mess +* allow switching compiler +* GIT support +* user ${package##*/} as the patch basename +* If VERSION is not set then use a CONFIG VARIABLE whose default is set to $(date '+YYmmdd') + if PKGVERS[*] is not set, then set it to VERSION +* a configure function/macro which factors the most used stuff diff --git a/Build/build.sh b/Build/build.sh new file mode 120000 index 0000000..2c6be06 --- /dev/null +++ b/Build/build.sh @@ -0,0 +1 @@ +lib/build.sh
\ No newline at end of file diff --git a/Build/lib/arch.sh b/Build/lib/arch.sh new file mode 100755 index 0000000..e7fde97 --- /dev/null +++ b/Build/lib/arch.sh @@ -0,0 +1,97 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +function def_subarch() +{ + case "${1}" in + x86) + echo -n "${DEFAULT_SUBARCH[x86]}" + ;; + x86_64) + echo -n "${DEFAULT_SUBARCH[x86_64]}" + ;; + esac +} + +function def_flags() +{ + case "${1}" in + noarch) + return + ;; + i386) + echo -n "${DIST_FLAGS[i386]}" + ;; + i486) + echo -n "${DIST_FLAGS[i486]}" + ;; + i586) + echo -n "${DIST_FLAGS[i586]}" + ;; + i686) + echo -n "${DIST_FLAGS[i686]}" + ;; + x86_64) + echo -n "${DIST_FLAGS[x86_64]}" + ;; + *) + echo -n "${DIST_FLAGS[all]}" + ;; + esac + + if [[ "${DEBUG}" == yes ]]; then + echo -n " ${DEBUG_FLAGS[all]}" + fi +} + +function cpufamily() +{ + case "${1}" in + i386) + echo -n "x86" + ;; + i486) + echo -n "x86" + ;; + i586) + echo -n "x86" + ;; + i686) + echo -n "x86" + ;; + x86_64) + echo -n "x86_64" + ;; + esac +} + +function libdirsuffix() +{ + case "${HOST_ARCH}" in + x86_64) + echo -n "64" + ;; + esac +} diff --git a/Build/lib/build.sh b/Build/lib/build.sh new file mode 100755 index 0000000..ca760ac --- /dev/null +++ b/Build/lib/build.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +readonly SELFPATH="${BASH_SOURCE[0]%/*}" + +source "${SELFPATH}/lib/defines.sh" +source "${SELFPATH}/lib/color.sh" +source "${SELFPATH}/lib/display.sh" +source "${SELFPATH}/lib/error.sh" +source "${SELFPATH}/lib/script.sh" +source "${SELFPATH}/lib/arch.sh" +source "${SELFPATH}/lib/util.sh" + +#TODO: Change all that shit to getopt +if [[ "${*}" == *--verbose* ]]; then + DISPLAY[debug]=yes +fi + +if [[ "${*}" == *--debug* ]]; then + DEBUG=yes +fi + +# Create package root +dir.make "${PKG}/install" + +trap "build ${*}" EXIT diff --git a/Build/lib/color.sh b/Build/lib/color.sh new file mode 100755 index 0000000..4ae8b95 --- /dev/null +++ b/Build/lib/color.sh @@ -0,0 +1,98 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +function color() +{ + + local color="" + + # If requested, don't display colors + if [[ "${DISPLAY[color]}" == "no" ]]; then + return + fi + + case "${1}" in + "") + return + ;; + end) + color="\e[0;0m" + ;; + black) + color="\e[0;30m" + ;; + red) + color="\e[0;31m" + ;; + green) + color="\e[0;32m" + ;; + brown) + color="\e[0;33m" + ;; + blue) + color="\e[0;34m" + ;; + purple) + color="\e[0;35m" + ;; + cyan|debug) + color="\e[0;36m" + ;; + lightgray) + color="\e[0;37m" + ;; + darkgray) + color="\e[1;30m" + ;; + lightred|error) + color="\e[1;31m" + ;; + lightgreen|info) + color="\e[1;32m" + ;; + yellow) + color="\e[1;33m" + ;; + lightblue) + color="\e[1;34m" + ;; + pink|warning) + color="\e[1;35m" + ;; + lightcyan) + color="\e[1;36m" + ;; + white) + color="\e[1;37m" + ;; + *) + return + ;; + esac + + echo -ne "${color}" + +} diff --git a/Build/lib/defines.sh b/Build/lib/defines.sh new file mode 100755 index 0000000..6f7d177 --- /dev/null +++ b/Build/lib/defines.sh @@ -0,0 +1,86 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +### Tools + +shopt -s expand_aliases + +alias host.arch='uname -m' + +alias src.download='curl -f -# -O -L' +alias src.download.git='git clone --depth 0' +alias src.unpack='bsdtar xf' +alias src.checksum='sha256sum' +alias src.patch='patch -p1 -s -f' + +alias pkg.pack='/sbin/makepkg -l y -c n' + +alias dir.make.temp='mktemp -d' + +alias link='ln -sf' + +alias install.doc='install -m 0644' +alias install.man='install -m 0644' +alias install.cfg='install -m 0644' +alias install.dat='install -m 0644' +alias install.bin='install -m 0755' +alias install.dir='install -m 0755 -d -D' + +alias z.doc='xz -9f' +alias z.man='xz -9f' +alias z.info='xz -9f' + +alias unz.patch='xzcat' + +### Initialize associative arrays + +declare -A DEFAULT_SUBARCH +declare -A DIST_FLAGS +declare -A SYS_DIR +declare -A URL +declare -A BUILD +declare -A DISPLAY + +### Constants + +readonly CWD="${PWD}" +readonly PRE_SCRIPT_PATH="${SELFPATH}/lib/pre" +readonly PST_SCRIPT_PATH="${SELFPATH}/lib/post" +readonly CONFIG="${SELFPATH}/build.conf" +readonly HOST_ARCH="$(host.arch)" + +### Settings + +source "${CONFIG}" + +### Defaults + +BUILD[root]="${SYS_DIR[tmp]:-'/var/tmp'}" +BUILD[dir]="$(dir.make.temp ${BUILD[root]}/build-XXXXXX)" +BUILD[pkg]="${BUILD[dir]}/package-root" +BUILD[log]="${BUILD[dir]}/build.log" + +PKGREPO="${PKGREPO:-${CWD}}" +readonly PKG="${BUILD[pkg]}" diff --git a/Build/lib/display.sh b/Build/lib/display.sh new file mode 100755 index 0000000..845cdc9 --- /dev/null +++ b/Build/lib/display.sh @@ -0,0 +1,64 @@ +function prefix() +{ + + local prefix="" + + # If requested, don't display prefixes + if [[ "${DISPLAY[prefix]}" == "no" ]]; then + return + fi + + case "${1}" in + "") + return + ;; + error) + prefix="!!!" + ;; + warning) + prefix="+++" + ;; + info) + prefix=">>>" + ;; + debug) + prefix="%%%" + ;; + *) + return + ;; + esac + + echo -ne "${prefix}" + +} + +function display() +{ + echo -e "$(color ${1})$(prefix ${1}) ${2}$(color end)" +} + +function error() +{ + display error "${1}" +} + +function debug() +{ + # If requested don't display debug messages + if [[ "${DISPLAY[debug]}" == "no" ]]; then + return + fi + + display debug "${1}" +} + +function warning() +{ + display warning "${1}" +} + +function info() +{ + display info "${1}" +} diff --git a/Build/lib/error.sh b/Build/lib/error.sh new file mode 100755 index 0000000..75f6c2a --- /dev/null +++ b/Build/lib/error.sh @@ -0,0 +1,30 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +function abort() +{ + error "ERROR in ${FUNCNAME[1]}(): ${1}" + exit 1 +} diff --git a/Build/lib/post/10-rmla.sh b/Build/lib/post/10-rmla.sh new file mode 100755 index 0000000..6db809f --- /dev/null +++ b/Build/lib/post/10-rmla.sh @@ -0,0 +1,48 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ ! "${OPTIONS}" == *normla* ]]; then + + info "Removing any libtool library (.la) files" + + # Allow the for loop to work on files with spaces + saveifs="${IFS}" + IFS="$(echo -en "\n\b")" + + for file in $(find ${PKG} -name "*.la"); do + + filetype="$(file ${file})" + + case "${filetype}" in + *"libtool library file"*) + rm -f "${file}" + ;; + esac + + done + + IFS="${saveifs}" + +fi diff --git a/Build/lib/post/20-strip.sh b/Build/lib/post/20-strip.sh new file mode 100755 index 0000000..323288c --- /dev/null +++ b/Build/lib/post/20-strip.sh @@ -0,0 +1,55 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ ! "${OPTIONS}" == *nostrip* ]]; then + + if [[ ! "${DEBUG}" == yes ]]; then + + info "Stripping debugging symbols from binaries" + + # Allow the for loop to work on files with spaces + saveifs="${IFS}" + IFS=$(echo -en "\n\b") + + for file in $(find ${PKG}); do + + filetype="$(file -bi ${file})" + + case "${filetype}" in + *"application/x-executable; charset=binary"*) + strip "${file}" + ;; + *"application/x-sharedlib; charset=binary"*) + strip --strip-unneeded "${file}" + ;; + esac + + done + + IFS="${saveifs}" + + fi + +fi diff --git a/Build/lib/post/30-info.sh b/Build/lib/post/30-info.sh new file mode 100755 index 0000000..170b971 --- /dev/null +++ b/Build/lib/post/30-info.sh @@ -0,0 +1,39 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ ! "${OPTIONS}" == *noinfoz* ]]; then + + info "Compressing info files" + + rm -f \ + "${PKG}/usr/info/dir" \ + "${PKG}/usr/share/info/dir" + + for file in $(find ${PKG} -path '*usr*info/*.info*'); do + chmod 0644 "${file}" + z.info "${file}" + done + +fi diff --git a/Build/lib/post/40-man.sh b/Build/lib/post/40-man.sh new file mode 100755 index 0000000..21f3dd2 --- /dev/null +++ b/Build/lib/post/40-man.sh @@ -0,0 +1,35 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ ! "${OPTIONS}" == *nomanz* ]]; then + + info "Compressing manual pages" + + for file in $(find ${PKG} -path '*usr*/man*/man*/*.*'); do + chmod 0644 "${file}" + z.man "${file}" + done + +fi diff --git a/Build/lib/post/50-depends.sh b/Build/lib/post/50-depends.sh new file mode 100755 index 0000000..1f4e584 --- /dev/null +++ b/Build/lib/post/50-depends.sh @@ -0,0 +1,31 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ "${DEPENDS}" ]]; then + info "Adding runtime dependencies" + for ((n = 0; n < ${#DEPENDS[@]}; n++)); do + echo "${DEPENDS[${n}]}" >> "${PKG}/install/slack-required" + done +fi diff --git a/Build/lib/post/60-package.sh b/Build/lib/post/60-package.sh new file mode 100755 index 0000000..3c0ed89 --- /dev/null +++ b/Build/lib/post/60-package.sh @@ -0,0 +1,48 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +PKGBASENAME=${NAME}-${VERSION}-${ARCH}-${BUILD} + +info "Packing ${PKGBASENAME}" + +if [ ! -d "${PKGREPO}" -o ! -w "${PKGREPO}" ]; then + PKGREPO="${HOME}" +fi + +pushd "${PKG}" >/dev/null + +PACKAGE="${PKGREPO}/${PKGBASENAME}" + +debug "Creating ${PACKAGE}.txz" + +if [[ ! "${OPTIONS}" == *symprepend* ]]; then + pkg.pack "${PACKAGE}.txz" +else + pkg.pack -p "${PACKAGE}.txz" +fi + +cat install/slack-desc | grep "${NAME}:" > "${PACKAGE}.txt" + +popd >/dev/null diff --git a/Build/lib/pre/10-download.sh b/Build/lib/pre/10-download.sh new file mode 100755 index 0000000..17c02c6 --- /dev/null +++ b/Build/lib/pre/10-download.sh @@ -0,0 +1,60 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +SRCPKG="${SRCPACK[${source}]##*/}" +SRCURL="${SRCPACK[${source}]%/*}" +SRCSCH="${SRCPACK[${source}]%://*}" + +debug "SRCPKG=${SRCPKG}" +debug "SRCURL=${SRCURL}" +debug "SRCSCH=${SRCSCH}" + +if [ ! -e "${SRCPKG}" ]; then + if [[ "${SRCURL}" ]]; then + info "Downloading ${SRCPACK[${source}]}" + case "${SRCSCH}" in + 'git') + pushd "${BUILD[dir]}" >/dev/null + src.download.git ${SRCPACK[${source}]} + checkstatus ${?} + popd >/dev/null + SRCROOT[${source}]="${SRCPKG%*.git}" + SRCOPTS[${source}]="${SRCOPTS[${source}]} nounpack" + ;; + *) + src.download ${SRCPACK[${source}]} + # Throw a newline because curl doesn't + echo + # Since curl returns 0 even when it failed to download something, then + # just check if we can find the source. + if [ ! -e "${SRCPKG}" ]; then + abort "No source" + fi + ;; + esac + else + abort "No source" + fi +fi diff --git a/Build/lib/pre/20-check.sh b/Build/lib/pre/20-check.sh new file mode 100644 index 0000000..494deea --- /dev/null +++ b/Build/lib/pre/20-check.sh @@ -0,0 +1,28 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +#if [[ ! SRCCKSM[${source}] == $(src.checksum ${SRC}) ]]; then +# warning "Checksum does not match" +#fi diff --git a/Build/lib/pre/30-unpack.sh b/Build/lib/pre/30-unpack.sh new file mode 100755 index 0000000..edb11ae --- /dev/null +++ b/Build/lib/pre/30-unpack.sh @@ -0,0 +1,60 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ ! "${SRCROOT[${source}]}" ]]; then + if [[ "${SRCOPTS[${source}]}" == *pkgunpack* ]]; then + debug "PKG=${PKG}" + SRC="${PKG}" + else + SRC="${BUILD[dir]}/${SRCNAME[${source}]}-${SRCVERS[${source}]}" + fi +else + SRC="${BUILD[dir]}/${SRCROOT[${source}]}" +fi + +debug "SRC=${SRC}" + +if [[ "${SRCOPTS[${source}]}" == *nosrcroot* ]]; then + dir.make "${SRC}" + pushd "${SRC}" >/dev/null +else + if [[ "${SRCOPTS[${source}]}" == *pkgunpack* ]]; then + pushd "${SRC}" >/dev/null + else + if [[ ! "${SRCOPTS[${source}]}" == *skipsrcroot* ]]; then + pushd "${BUILD[dir]}" >/dev/null + fi + fi +fi + +if [[ ! "${SRCOPTS[${source}]}" == *nounpack* ]]; then + info "Unpacking ${SRCPKG} in ${SRC}" + src.unpack ${CWD}/${SRCPKG} + checkstatus ${?} +fi + +if [[ ! "${SRCOPTS[${source}]}" == *skipsrcroot* ]]; then + popd >/dev/null +fi diff --git a/Build/lib/pre/40-patch.sh b/Build/lib/pre/40-patch.sh new file mode 100755 index 0000000..fde64f3 --- /dev/null +++ b/Build/lib/pre/40-patch.sh @@ -0,0 +1,39 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ ! "${SRCOPTS[${source}]}" == *skipsrcroot* ]]; then + +QUERY=$(find ${CWD} -name ${SRCNAME[${source}]}-${SRCVERS[${source}]}-\*.patch.xz -maxdepth 1 | sort) + +pushd "${SRC}" >/dev/null + +for patch in ${QUERY}; do + info "Applying ${patch##*/} to ${SRCNAME[${source}]}-${SRCVERS[${source}]}" + unz.patch "${patch}" | src.patch +done + +popd >/dev/null + +fi diff --git a/Build/lib/pre/50-build.sh b/Build/lib/pre/50-build.sh new file mode 100755 index 0000000..6b2fde9 --- /dev/null +++ b/Build/lib/pre/50-build.sh @@ -0,0 +1,46 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. +info "Building ${SRCNAME[${source}]}-${SRCVERS[${source}]}" + +# Create the documentation directory now so that we are able to install stuff +# into it. +if [[ ! "${SRCOPTS[${source}]}" == *shareddoc* ]]; then + SRCDOCDIR[${source}]="${PKG}/${SYS_DIR[doc]}/${SRCNAME[${source}],,}-${SRCVERS[${source}]}" +else + SRCDOCDIR[${source}]="${PKG}/${SYS_DIR[doc]}/${NAME}-${VERSION}" +fi +DOC="${SRCDOCDIR[${source}]}" + +if [[ ! "${SRCOPTS[${source}]}" == *skipsrcroot* ]]; then + pushd "${SRC}" >/dev/null +fi + +#build${source} &>> "${BUILD[log]}" + +build${source} + +if [[ ! "${SRCOPTS[${source}]}" == *skipsrcroot* ]]; then + popd >/dev/null +fi diff --git a/Build/lib/pre/60-docs.sh b/Build/lib/pre/60-docs.sh new file mode 100755 index 0000000..ec26db0 --- /dev/null +++ b/Build/lib/pre/60-docs.sh @@ -0,0 +1,48 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +if [[ "${SRCCOPY[${source}]}" ]]; then + info "Adding license information" + dir.make "${SRCDOCDIR[${source}]}" + pushd "${SRCDOCDIR[${source}]}" 2>/dev/null + for license in ${SRCCOPY[${source}]}; do + link -v "${SYS_DIR[license]}/${license}.xz" "COPYING.${license}.xz" + done + popd 2>/dev/null +fi + +if [[ ! "${SRCOPTS[${source}]}" == *nodocz* ]]; then + if [ -d "${SRCDOCDIR[${source}]}" ]; then + info "Compressing documentation" + for file in $(find "${SRCDOCDIR[${source}]}" -maxdepth 1 -size +10k); do + type="$(file -bi ${file})" + case "${type}" in + *"text/plain"*) + z.doc "${file}" + ;; + esac + done + fi +fi diff --git a/Build/lib/script.sh b/Build/lib/script.sh new file mode 100755 index 0000000..f80ca3f --- /dev/null +++ b/Build/lib/script.sh @@ -0,0 +1,91 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +function run() +{ + local -i status=0 + + debug "Running command: ${*}" + + # Execute the command + #${*} &>> "${BUILD[log]}" + ${*} + + # Get what the command returns + status=${?} + + debug "Command returned status: ${status}" + + # If the command returned something greater than 0 then bail out + if [ ${status} -gt 0 ]; then + abort "${1}: command failed" + fi +} + +function checkstatus() +{ + debug "Command returned status: ${1}" + + if [ ${1} -gt 0 ]; then + abort "command failed" + fi +} + +function runscripts() +{ + local script + + for script in "${1}"/*.sh; do + # Only run a script if it's executable. This allows quickly disabling a + # script. + if [ -x "${script}" ]; then + debug "Running script: ${script}" + source "${script}" + fi + done +} + +function build() +{ + debug "Arguments: ${*}" + debug "Build directory: ${BUILD[dir]}" + debug "Package root: ${BUILD[pkg]}" + + readonly ARCH=${ARCH:-$(def_subarch ${HOST_ARCH})} + readonly FLAGS=${FLAGS:-$(def_flags ${ARCH})} + + debug "ARCH=${ARCH}" + debug "FLAGS=${FLAGS}" + + # Handle the sources + for ((source = 0; source < ${#SRCNAME[@]}; source++)); do + runscripts "${PRE_SCRIPT_PATH}" + done + + # Handle the package + runscripts "${PST_SCRIPT_PATH}" + + # Clean up +} diff --git a/Build/lib/util.sh b/Build/lib/util.sh new file mode 100755 index 0000000..0df68b4 --- /dev/null +++ b/Build/lib/util.sh @@ -0,0 +1,70 @@ +# Copyright (c) 2012, Deposite Pirate +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER 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. + +function padd() +{ + for ((space = 0; space < ${#NAME}; space++)); do + echo -n ' ' + done +} + +function dir.make() +{ + if [ ! -d "${1}" ]; then + mkdir -p "${1}" + fi +} + +function config() +{ + for file in ${*}; do + mv "${file}" "${file}.new" + done +} + +function doc() +{ + dir.make "${SRCDOCDIR[${source}]}" + install.doc ${*} "${SRCDOCDIR[${source}]}" +} + +function changelog() +{ + dir.make "${SRCDOCDIR[${source}]}" + install.doc "${1}" "${SRCDOCDIR[${source}]}/ChangeLog" + z.doc "${SRCDOCDIR[${source}]}/ChangeLog" +} + +function license() +{ + dir.make "${SRCDOCDIR[${source}]}" + if [[ ! "${2}" ]]; then + install.doc "${1}" "${SRCDOCDIR[${source}]}/COPYING" + z.doc "${SRCDOCDIR[${source}]}/COPYING" + else + install.doc "${1}" "${SRCDOCDIR[${source}]}/${2}" + z.doc "${SRCDOCDIR[${source}]}/${2}" + fi +} diff --git a/Build/profile/build.conf.slackware64 b/Build/profile/build.conf.slackware64 new file mode 100644 index 0000000..b95277a --- /dev/null +++ b/Build/profile/build.conf.slackware64 @@ -0,0 +1,66 @@ +# What is the name of this distro + +DISTRONAME="Slackware Linux" + +# Where to store built packages + +PKGREPO=/usr/src/packages + +# What to show + +DISPLAY[color]=yes +DISPLAY[prefix]=yes +DISPLAY[debug]=no + +# Compiler settings + +DEFAULT_SUBARCH[x86]="i586" +DEFAULT_SUBARCH[x86_64]="x86_64" + +CPU_FLAGS[i386]="-march=i386 -mtune=i386" +CPU_FLAGS[i486]="-march=i486 -mtune=i486" +CPU_FLAGS[i586]="-march=i586 -mtune=i586" +CPU_FLAGS[i686]="-march=i686 -mtune=i686" +CPU_FLAGS[x86_64]="" +DIST_FLAGS[all]="-O2 -fno-strength-reduce -fomit-frame-pointer -ffast-math" +DIST_FLAGS[i386]="${CPU_FLAGS[i386]} ${DIST_FLAGS[all]}" +DIST_FLAGS[i486]="${CPU_FLAGS[i486]} ${DIST_FLAGS[all]}" +DIST_FLAGS[i586]="${CPU_FLAGS[i586]} ${DIST_FLAGS[all]}" +DIST_FLAGS[i686]="${CPU_FLAGS[i686]} ${DIST_FLAGS[all]}" +DIST_FLAGS[x86_64]="${CPU_FLAGS[x86_64]} ${DIST_FLAGS[all]}" +DEBUG_FLAGS[all]="-g" + +JOBS="-j 2" +DEBUG="no" + +# Filesystem layout + +SYS_DIR[etc]="/etc" +SYS_DIR[conf]="${SYS_DIR[etc]}/conf.d" +SYS_DIR[dev]="/dev" +SYS_DIR[var]="/var" +SYS_DIR[tmp]="/var/tmp" +SYS_DIR[run]="/run" +SYS_DIR[usr]="/usr" +SYS_DIR[bin]="${SYS_DIR[usr]}/bin" +SYS_DIR[sbin]="${SYS_DIR[usr]}/sbin" +SYS_DIR[lib]="${SYS_DIR[usr]}/lib64" +SYS_DIR[include]="${SYS_DIR[usr]}/include" +SYS_DIR[share]="${SYS_DIR[usr]}/share" +SYS_DIR[doc]="${SYS_DIR[usr]}/doc" +SYS_DIR[man]="${SYS_DIR[usr]}/man" +SYS_DIR[info]="${SYS_DIR[usr]}/info" +SYS_DIR[html]="${SYS_DIR[share]}/html" +SYS_DIR[license]="${SYS_DIR[share]}/common-licenses" +SYS_DIR[systemdsystemunitdir]="${SYS_DIR[share]}/systemd/system" +SYS_DIR[systemdsystemscriptdir]="${SYS_DIR[share]}/systemd/scripts" +SYS_DIR[bashcompletiondir]="${SYS_DIR[share]}/bash-completion/completions" + +BUILD[dir]="/var/tmp" + +# Common download URLs + +URL[sf]=http://downloads.sourceforge.net/project +URL[gnu]=http://ftp.gnu.org/gnu +URL[gnome]=http://ftp.gnome.org/pub/GNOME/sources +URL[savannah]=http://download.savannah.nongnu.org/releases diff --git a/Build/profile/build.conf.tightware b/Build/profile/build.conf.tightware new file mode 100644 index 0000000..c2eb56c --- /dev/null +++ b/Build/profile/build.conf.tightware @@ -0,0 +1,68 @@ +# What is the name of this distro + +DISTRONAME="Tightware GNU/Linux" + +# Where to store built packages + +PKGREPO=/usr/src/packages + +# What to show + +DISPLAY[color]=yes +DISPLAY[prefix]=yes +DISPLAY[debug]=no + +# Compiler settings + +DEFAULT_SUBARCH[x86]="i586" +DEFAULT_SUBARCH[x86_64]="x86_64" + +CPU_FLAGS[i386]="-march=i386 -mtune=i386" +CPU_FLAGS[i486]="-march=i486 -mtune=i486" +CPU_FLAGS[i586]="-march=i586 -mtune=i586" +CPU_FLAGS[i686]="-march=i686 -mtune=i686" +CPU_FLAGS[x86_64]="" +DIST_FLAGS[all]="-O2 -fno-strength-reduce -fomit-frame-pointer -ffast-math" +DIST_FLAGS[i386]="${CPU_FLAGS[i386]} ${DIST_FLAGS[all]}" +DIST_FLAGS[i486]="${CPU_FLAGS[i486]} ${DIST_FLAGS[all]}" +DIST_FLAGS[i586]="${CPU_FLAGS[i586]} ${DIST_FLAGS[all]}" +DIST_FLAGS[i686]="${CPU_FLAGS[i686]} ${DIST_FLAGS[all]}" +DIST_FLAGS[x86_64]="${CPU_FLAGS[x86_64]} ${DIST_FLAGS[all]}" +DEBUG_FLAGS[all]="-g" + +JOBS="-j 2" +DEBUG="no" + +# Filesystem layout + +SYS_DIR[etc]="/etc" +SYS_DIR[conf]="${SYS_DIR[etc]}/conf.d" +SYS_DIR[dev]="/dev" +SYS_DIR[var]="/var" +SYS_DIR[tmp]="/tmp" +SYS_DIR[run]="/run" +SYS_DIR[usr]="/usr" +SYS_DIR[bin]="${SYS_DIR[usr]}/bin" +SYS_DIR[sbin]="${SYS_DIR[usr]}/sbin" +SYS_DIR[lib]="${SYS_DIR[usr]}/lib" +SYS_DIR[include]="${SYS_DIR[usr]}/include" +SYS_DIR[share]="${SYS_DIR[usr]}/share" +SYS_DIR[doc]="${SYS_DIR[share]}/doc" +SYS_DIR[man]="${SYS_DIR[share]}/man" +SYS_DIR[info]="${SYS_DIR[share]}/info" +SYS_DIR[html]="${SYS_DIR[share]}/html" +SYS_DIR[license]="${SYS_DIR[share]}/common-licenses" +SYS_DIR[udevrules]="${SYS_DIR[lib]}/data/udev/rules" +SYS_DIR[udevscripts]="${SYS_DIR[lib]}/exec/udev" +SYS_DIR[systemdsystemunitdir]="${SYS_DIR[share]}/systemd/system" +SYS_DIR[systemdsystemscriptdir]="${SYS_DIR[share]}/systemd/scripts" +SYS_DIR[bashcompletiondir]="${SYS_DIR[share]}/bash-completion/completions" + +BUILD[dir]="/var/tmp" + +# Common download URLs + +URL[sf]=http://downloads.sourceforge.net/project +URL[gnu]=http://ftp.gnu.org/gnu +URL[gnome]=http://ftp.gnome.org/pub/GNOME/sources +URL[savannah]=http://download.savannah.nongnu.org/releases diff --git a/Build/sample.build b/Build/sample.build new file mode 100755 index 0000000..8349150 --- /dev/null +++ b/Build/sample.build @@ -0,0 +1,58 @@ +#!/bin/bash +# +# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd> + +source /usr/src/ports/Build/build.sh + +NAME=sample +VERSION=1.0.0 +BUILD=1 + +# Description + +cat > ${PKG}/install/slack-desc <<EOF +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + +$(padd)|-----handy-ruler------------------------------------------------------| +${NAME}: +${NAME}: +${NAME}: +${NAME}: +${NAME}: +${NAME}: +${NAME}: +${NAME}: +${NAME}: +${NAME}: +${NAME}: +EOF + +# Sources + +SRCNAME[0]=${NAME} +SRCVERS[0]=${VERSION} +SRCPACK[0]=/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz + +build0() +{ +CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \ +./configure \ + --build="${ARCH}-slackware-linux" \ + --disable-dependency-tracking \ + --enable-static=no \ + --enable-shared=yes \ + --prefix="${SYS_DIR[usr]}" \ + --mandir="${SYS_DIR[man]}" \ + --sysconfdir="${SYS_DIR[etc]}" \ + --libdir="${SYS_DIR[lib]}" \ + --localstatedir="${SYS_DIR[var]}" +make ${JOBS} +make install DESTDIR="${PKG}" +doc AUTHORS +changelog ChangeLog +} |