build.sh: ignore directories in tarballs/ (#37)

build.sh, tools.sh: add UNATTENDED option (#37)
xcrun.cpp: make local functions static
This commit is contained in:
Thomas Pöchtrager 2015-06-21 19:35:09 +02:00
parent 54d6ae9172
commit c1e2c3a6d6
4 changed files with 22 additions and 10 deletions

View File

@ -42,7 +42,7 @@ On debian like systems you can also use [llvm.org/apt](http://llvm.org/apt) to g
But be careful, that repository is known to cause [troubles](https://github.com/tpoechtrager/osxcross/issues/16).
\--
Then run `./build.sh` to build the cross toolchain.
Then run `[UNATTENDED=1] ./build.sh` to build the cross toolchain.
(It will search 'tarballs' for your SDK and then build in its own directory.)
**Do not forget** to add `<path>/target/bin` to your PATH variable.

View File

@ -18,14 +18,14 @@ function guess_sdk_version()
echo no SDK found in 'tarballs/'. please see README.md
exit 1
elif [ $sdkcount -gt 1 ]; then
sdks=`find tarballs/ | grep MacOSX`
sdks=`find tarballs/ -type f | grep MacOSX`
for sdk in $sdks; do echo $sdk; done
echo 'more than one MacOSX SDK tarball found. please set'
echo 'SDK_VERSION environment variable for the one you want'
echo '(for example: SDK_VERSION=10.x [OSX_VERSION_MIN=10.x] ./build.sh)'
exit 1
else
sdk=`find tarballs/ | grep MacOSX`
sdk=`find tarballs/ -type f | grep MacOSX`
tmp2=`echo ${sdk/bz2/} | sed s/[^0-9.]//g`
tmp3=`echo $tmp2 | sed s/\\\.*$//g`
guess_sdk_version_result=$tmp3
@ -44,7 +44,7 @@ function verify_sdk_version()
{
sdkv=$1
for file in tarballs/*; do
if [ `echo $file | grep OSX.*$sdkv` ]; then
if [ -f "$file" ] && [ `echo $file | grep OSX.*$sdkv` ]; then
echo "verified at "$file
sdk=$file
fi
@ -104,8 +104,10 @@ echo "Tarball Directory: $TARBALL_DIR"
echo "Build Directory: $BUILD_DIR"
echo "Install Directory: $TARGET_DIR"
echo "SDK Install Directory: $SDK_DIR"
echo ""
read -p "Press enter to start building"
if [ -z "$UNATTENDED" ]; then
echo ""
read -p "Press enter to start building"
fi
echo ""
export PATH=$TARGET_DIR/bin:$PATH
@ -267,7 +269,9 @@ do
echo "You can press ctrl-c to break the build process,"
echo "if you restart ./build.sh then we will continue from here"
echo ""
read -p "Press enter to continue"
if [ -z "$UNATTENDED" ]; then
read -p "Press enter to continue"
fi
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
done
set -e

View File

@ -48,8 +48,13 @@ function require()
which $1 &>/dev/null
while [ $? -ne 0 ]
do
echo ""
read -p "Please install $1 then press enter"
if [ -z "$UNATTENDED" ]; then
echo ""
read -p "Please install '$1' then press enter"
else
echo "Required dependency '$1' is not installed" 1>&2
exit 1
fi
which $1 &>/dev/null
done
set -e

View File

@ -29,8 +29,9 @@ using namespace tools;
using namespace target;
namespace program {
namespace {
static bool showCommand = false;
bool showCommand = false;
bool getToolPath(Target &target, std::string &toolpath, const char *tool) {
toolpath = target.execpath;
@ -130,6 +131,8 @@ int showSDKVersion(Target &target, char **) {
return 0;
}
} // anonymous namespace
int xcrun(int argc, char **argv, Target &target) {
if (getenv("xcrun_log"))
showCommand = true;