Last active
August 30, 2019 21:41
-
-
Save johalun/6d81f3e69411edfe4b08269bae14eec1 to your computer and use it in GitHub Desktop.
Script to cross compile drm packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Requires: | |
# pkg install devel/powerpc64-xtoolchain-gcc (gcc in base is too old) | |
# cd /usr/src; make kernel-toolchain TARGET_ARCH=aarch64 | |
CLEAN=no | |
UPDATE=no | |
PWD=`pwd` | |
OBJDIRPREFIX=/tmp/kms-drm- | |
while [ "$1" != "" ]; do | |
ARG=`echo $1 | awk -F= '{print $1}'` | |
VAL=`echo $1 | awk -F= '{print $2}'` | |
echo Got ${ARG}=${VAL} | |
case $ARG in | |
clean) | |
CLEAN=yes | |
;; | |
update-toolchains) | |
UPDATE=yes | |
;; | |
*) | |
echo "ERROR: unknown argument \"$ARG\"" | |
exit 1 | |
;; | |
esac | |
shift | |
done | |
if [ ${CLEAN} == "no" ]; then | |
CMD="/bin/sh -c 'cd ${PWD}; make -s -j8'" | |
else | |
CMD="/bin/sh -c 'cd ${PWD}; make clean cleandepend -s -j16; make -s -j8'" | |
fi | |
if [ ${UPDATE} == "yes" ]; then | |
sudo pkg install -y devel/powerpc64-xtoolchain-gcc | |
cd /usr/src && sudo make -s -j8 kernel-toolchain TARGET_ARCH=aarch64 || exit 1 | |
cd ${PWD} | |
fi | |
SUCCESS= | |
FAIL= | |
dobuild() | |
{ | |
local target=$1 | |
local options=$2 | |
echo "Building ${target} ${options}..." | |
(cd /usr/src; make buildenv MAKEOBJDIRPREFIX=${OBJDIRPREFIX}${target} TARGET_ARCH=${target} ${options} BUILDENV_SHELL="${CMD}") \ | |
&& SUCCESS="${SUCCESS} ${target}" || FAIL="${FAIL} ${target}" | |
} | |
# TARGET OPTIONS | |
dobuild "amd64" | |
dobuild "i386" | |
dobuild "powerpc64" "CROSS_TOOLCHAIN=powerpc64-gcc" | |
dobuild "aarch64" | |
echo | |
echo SUCCESS: ${SUCCESS} | |
echo FAIL: ${FAIL} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment