-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/sh | ||
|
||
# Cross compile test for https://github.com/FreeBSDDesktop/kms-drm | ||
# Execute as non-root in root folder of repo | ||
|
||
# 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} | ||
|
||
if [ ! -z ${FAIL} ]; then exit 1; fi | ||
exit 0 |