#!/bin/sh
## This program is not part of PSPP but is used to help build PSPP
## Copyright (C) 2021 John Darrington
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see .
# This script downloads (if necessary) and builds the required
# dependencies of PSPP. You may find it useful when cross building.
# Sadly, it it very likely that you'll have to tweak the order of the
# packages, the versions of the packages, their CFLAGS and other
# details in order to succesfully build for any particular
# architecture. In its current form, it has been tweaked for building
# for mingw archs.
required_native_programs="awk sha256sum tar sed gtk-encode-symbolic-svg ninja meson cat grep pkg-config"
for p in $required_native_programs; do
if ! type "$p" > /dev/null; then
echo $p must be installed and in PATH;
exit 1
fi
done
while test $# -gt 0; do
case $1 in
--arch=*)
arch=${1##--arch=};;
--sandbox=*)
SANDBOX=${1##--sandbox=};;
--tarballs=*)
SRC_TARBALL_DIR=${1##--tarballs=};;
--no-clean)
noclean=yes;;
*)
printf "Usage: $0 --arch= --sandbox= [--tarballs=]\n";
exit 1;
;;
esac
shift 1;
done
if test -z "$SANDBOX" -o -z "$arch"; then
printf "Usage: $0 --arch= --sandbox= [--tarballs=]\n";
exit 1;
fi
SANDBOX=`eval echo $SANDBOX`
if test -z "$SRC_TARBALL_DIR"; then
SRC_TARBALL_DIR="$SANDBOX/tarballs"
fi
SRC_TARBALL_DIR=`eval echo $SRC_TARBALL_DIR`
test "x$noclean" = "xyes" || rm -rIf $SANDBOX
default_build_procs=$(expr $(cat /proc/cpuinfo | grep -c '^processor') + 1)
mkdir -p $SRC_TARBALL_DIR
mkdir -p $SANDBOX
export DESTDIR=""
cat > $SANDBOX/cross-file.txt <