aboutsummaryrefslogtreecommitdiff
path: root/Build/lib
diff options
context:
space:
mode:
authorDeposite Pirate2018-09-16 18:48:36 +0200
committerDeposite Pirate2018-09-16 18:48:36 +0200
commitd150a5f3e462fa7fe194a805a4aa0076f4d03ab9 (patch)
treece5e44d69c5f3175bfdbd1e3717b52c5dcca5638 /Build/lib
parentf29d3519ce073ec30f99754d93304324f7f26d65 (diff)
Add ports.
Diffstat (limited to 'Build/lib')
-rwxr-xr-xBuild/lib/arch.sh97
-rwxr-xr-xBuild/lib/build.sh50
-rwxr-xr-xBuild/lib/color.sh98
-rwxr-xr-xBuild/lib/defines.sh86
-rwxr-xr-xBuild/lib/display.sh64
-rwxr-xr-xBuild/lib/error.sh30
-rwxr-xr-xBuild/lib/post/10-rmla.sh48
-rwxr-xr-xBuild/lib/post/20-strip.sh55
-rwxr-xr-xBuild/lib/post/30-info.sh39
-rwxr-xr-xBuild/lib/post/40-man.sh35
-rwxr-xr-xBuild/lib/post/50-depends.sh31
-rwxr-xr-xBuild/lib/post/60-package.sh48
-rwxr-xr-xBuild/lib/pre/10-download.sh60
-rw-r--r--Build/lib/pre/20-check.sh28
-rwxr-xr-xBuild/lib/pre/30-unpack.sh60
-rwxr-xr-xBuild/lib/pre/40-patch.sh39
-rwxr-xr-xBuild/lib/pre/50-build.sh46
-rwxr-xr-xBuild/lib/pre/60-docs.sh48
-rwxr-xr-xBuild/lib/script.sh91
-rwxr-xr-xBuild/lib/util.sh70
20 files changed, 1123 insertions, 0 deletions
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
+}