mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-08 02:55:56 +01:00
support NetBSD (https://github.com/tpoechtrager/osxcross/issues/7)
bump version (0.5 -> 0.6) update CHANGELOG misc adjustments
This commit is contained in:
parent
792b6aa470
commit
a829f523b8
@ -1,3 +1,7 @@
|
||||
0.6:
|
||||
- added: NetBSD support
|
||||
- added: dependencies installer script (Don Bright)
|
||||
|
||||
0.5:
|
||||
- fixed: help clang to find its own intrinsic headers (this issue appears to be fixed in clang 3.4+)
|
||||
- changed: attempt to make the toolchain less path dependent
|
||||
@ -8,7 +12,7 @@
|
||||
|
||||
0.4:
|
||||
- added: gcc support
|
||||
- added: a workaround for buggish unistd.h headers, no more need to edit /usr/include/unistd.h
|
||||
- added: a workaround for buggy unistd.h headers
|
||||
|
||||
0.3:
|
||||
- added: SDK download links to README
|
||||
|
11
README.md
11
README.md
@ -1,8 +1,8 @@
|
||||
## OS X Cross toolchain for Linux and FreeBSD ##
|
||||
## OS X Cross toolchain for Linux, FreeBSD and NetBSD ##
|
||||
|
||||
### WHAT IS THE GOAL OF OSXCROSS? ###
|
||||
|
||||
The goal of OSXCross is to provide a well working OS X cross toolchain for Linux and FreeBSD.
|
||||
The goal of OSXCross is to provide a well working OS X cross toolchain for Linux, FreeBSD and NetBSD.
|
||||
|
||||
### HOW DOES IT WORK? ###
|
||||
|
||||
@ -16,7 +16,7 @@ If you want, then you can build an up-to-date vanilla GCC as well.
|
||||
### WHAT IS NOT WORKING (YET)? ###
|
||||
|
||||
* GCC itself [doesn't build with GCC](https://github.com/tpoechtrager/osxcross/commit/12f5dcdde4bc1000180d25ffda229f0a13cf723d),
|
||||
but builds fine when clang is used to build GCC.
|
||||
but builds fine when clang is used to build GCC.
|
||||
|
||||
### WHAT CAN I BUILD WITH IT? ###
|
||||
|
||||
@ -28,13 +28,14 @@ Download the SDK version (links below) you want to the tarball/ (important!) dir
|
||||
|
||||
Then ensure you have the following installed on your Linux/FreeBSD box:
|
||||
|
||||
`Clang 3.2+`, `llvm-devel`, `automake`, `autogen`, `libtool`,
|
||||
`Clang 3.2+`, `llvm-devel`, `automake`, `autogen`, `libtool`, `patch`,
|
||||
`libxml2-devel` (<=10.5 only), `uuid-devel`, `openssl-devel` and the `bash shell`.
|
||||
|
||||
Hint 1: You can run 'sudo tools/get_dependencies.sh' to get these automatically.
|
||||
Hint 2: On Ubuntu 12.04 LTS you can use [llvm.org/apt](http://llvm.org/apt) to get a newer version of clang.
|
||||
|
||||
Then run `./build.sh` to build the cross toolchain (it will search 'tarballs' for your downloaded SDK and then build in its own directory).
|
||||
Then run `./build.sh` to build the cross toolchain.
|
||||
(It will search 'tarballs' for your downloaded SDK and then build in its own directory.)
|
||||
|
||||
**Don't forget** to add the printed `` `<path>/osxcross-env` `` to your `~/.profile` or `~/.bashrc`.
|
||||
Then either run `source ~/.profile` or restart your shell session.
|
||||
|
120
build.sh
120
build.sh
@ -5,7 +5,7 @@ pushd "${0%/*}" &>/dev/null
|
||||
source tools/tools.sh
|
||||
|
||||
# find sdk version to use
|
||||
guess_sdk_version()
|
||||
function guess_sdk_version()
|
||||
{
|
||||
tmp1=
|
||||
tmp2=
|
||||
@ -13,7 +13,7 @@ guess_sdk_version()
|
||||
file=
|
||||
sdk=
|
||||
guess_sdk_version_result=
|
||||
sdkcount=`find tarballs/ | grep MacOSX | wc -l`
|
||||
sdkcount=`find tarballs/ -type f | grep MacOSX | wc -l`
|
||||
if [ $sdkcount -eq 0 ]; then
|
||||
echo no SDK found in 'tarballs/'. please see README.md
|
||||
exit 1
|
||||
@ -22,14 +22,14 @@ guess_sdk_version()
|
||||
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: run SDK_VERSION=10.x build.sh )'
|
||||
echo '(for example: SDK_VERSION=10.x [OSX_VERSION_MIN=10.x] ./build.sh)'
|
||||
exit 1
|
||||
else
|
||||
sdk=`find tarballs/ | grep MacOSX`
|
||||
tmp2=`echo $sdk | sed s/[^0-9.]//g`
|
||||
tmp3=`echo $tmp2 | sed s/\\\.*$//g`
|
||||
guess_sdk_version_result=$tmp3
|
||||
echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'$sdk
|
||||
echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'`basename $sdk`
|
||||
fi
|
||||
if [ $guess_sdk_version_result ]; then
|
||||
if [ $guess_sdk_version_result = 10.4 ]; then
|
||||
@ -40,7 +40,7 @@ guess_sdk_version()
|
||||
}
|
||||
|
||||
# make sure there is actually a file with the given SDK_VERSION
|
||||
verify_sdk_version()
|
||||
function verify_sdk_version()
|
||||
{
|
||||
sdkv=$1
|
||||
for file in tarballs/*; do
|
||||
@ -56,7 +56,8 @@ verify_sdk_version()
|
||||
}
|
||||
|
||||
if [ $SDK_VERSION ]; then
|
||||
echo 'SDK VERSION set in environment variable: ' $SDK_VERSION
|
||||
echo 'SDK VERSION set in environment variable:' $SDK_VERSION
|
||||
test $SDK_VERSION = 10.4 && SDK_VERSION=10.4u
|
||||
else
|
||||
guess_sdk_version
|
||||
SDK_VERSION=$guess_sdk_version_result
|
||||
@ -66,14 +67,20 @@ verify_sdk_version $SDK_VERSION
|
||||
# Minimum targeted OS X version
|
||||
# Must be <= SDK_VERSION
|
||||
# You can comment this variable out,
|
||||
# if you want to use the compilers default value
|
||||
OSX_VERSION_MIN=10.5
|
||||
# if you want to use the compiler's default value
|
||||
if [ -z "$OSX_VERSION_MIN" ]; then
|
||||
if [ $SDK_VERSION = 10.4u ]; then
|
||||
OSX_VERSION_MIN=10.4
|
||||
else
|
||||
OSX_VERSION_MIN=10.5
|
||||
fi
|
||||
fi
|
||||
|
||||
# ld version
|
||||
LINKER_VERSION=134.9
|
||||
|
||||
# Don't change this
|
||||
OSXCROSS_VERSION=0.5
|
||||
OSXCROSS_VERSION=0.6
|
||||
|
||||
TARBALL_DIR=$BASE_DIR/tarballs
|
||||
BUILD_DIR=$BASE_DIR/build
|
||||
@ -114,11 +121,9 @@ mkdir -p $BUILD_DIR
|
||||
mkdir -p $TARGET_DIR
|
||||
mkdir -p $SDK_DIR
|
||||
|
||||
set +e
|
||||
require $CC
|
||||
require $CXX
|
||||
require clang
|
||||
require make
|
||||
require sed
|
||||
require patch
|
||||
require gunzip
|
||||
@ -126,7 +131,6 @@ require cpio
|
||||
require autogen
|
||||
require automake
|
||||
require libtool
|
||||
set -e
|
||||
|
||||
CLANG_TARGET_OPTION=`./oclang/check_target_option.sh`
|
||||
|
||||
@ -150,26 +154,31 @@ CCTOOLS_REVHASH=`ls $TARBALL_DIR/cctools*.tar.* | \
|
||||
tr '_' ' ' | tr '.' ' ' | \
|
||||
awk '{print $3}'`
|
||||
|
||||
# CCTOOLS
|
||||
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
|
||||
|
||||
rm -rf cctools*
|
||||
rm -rf xar*
|
||||
rm -rf bc*
|
||||
|
||||
xz -cd $TARBALL_DIR/cctools*.tar.xz | tar xvf -
|
||||
extract $TARBALL_DIR/cctools*.tar.xz 1 1 1
|
||||
|
||||
pushd cctools*/cctools &>/dev/null
|
||||
pushd .. &>/dev/null
|
||||
patch -p0 -l < $PATCH_DIR/cctools-63f6742.patch
|
||||
popd &>/dev/null
|
||||
patch -p0 < $PATCH_DIR/cctools-ld64-1.patch
|
||||
patch -p0 < $PATCH_DIR/cctools-ld64-2.patch
|
||||
patch -p0 < $PATCH_DIR/cctools-ld64-3.patch
|
||||
echo ""
|
||||
./autogen.sh
|
||||
echo ""
|
||||
echo "if you see automake warnings, ignore them"
|
||||
echo "automake 1.14+ is supposed to print a lot of warnings"
|
||||
echo ""
|
||||
./configure --prefix=$TARGET_DIR --target=x86_64-apple-$TARGET
|
||||
make -j$JOBS
|
||||
make install -j$JOBS
|
||||
$MAKE -j$JOBS
|
||||
$MAKE install -j$JOBS
|
||||
popd &>/dev/null
|
||||
|
||||
pushd $TARGET_DIR/bin &>/dev/null
|
||||
@ -181,48 +190,56 @@ for CCTOOL in ${CCTOOLS[@]}; do
|
||||
done
|
||||
popd &>/dev/null
|
||||
|
||||
fi # have cctools
|
||||
|
||||
fi
|
||||
# CCTOOLS END
|
||||
|
||||
# BC
|
||||
set +e
|
||||
which bc &>/dev/null
|
||||
NEED_BC=$?
|
||||
set -e
|
||||
|
||||
|
||||
if [ $NEED_BC -ne 0 ]; then
|
||||
|
||||
tar xfv $TARBALL_DIR/bc*.tar.bz2
|
||||
extract $TARBALL_DIR/bc*.tar.bz2 2
|
||||
|
||||
pushd bc* &>/dev/null
|
||||
CFLAGS="-w" ./configure --prefix=$TARGET_DIR --without-flex
|
||||
make -j$JOBS
|
||||
make install -j$JOBS
|
||||
$MAKE -j$JOBS
|
||||
$MAKE install -j$JOBS
|
||||
popd &>/dev/null
|
||||
|
||||
fi # NEED BC
|
||||
fi
|
||||
# BC END
|
||||
|
||||
SDK=`ls $TARBALL_DIR/MacOSX$SDK_VERSION*`
|
||||
|
||||
if [ ! -f "have_xar_$TARGET" ]; then
|
||||
if [ -n "$FORCE_XAR_BUILD" ] || [ `echo "$SDK_VERSION<=10.5" | bc -l` -eq 1 ]; then
|
||||
# XAR
|
||||
if [[ $SDK == *.pkg ]]; then
|
||||
|
||||
tar xzfv $TARBALL_DIR/xar*.tar.gz
|
||||
set +e
|
||||
which xar &>/dev/null
|
||||
NEED_XAR=$?
|
||||
set -e
|
||||
|
||||
if [ $NEED_XAR -ne 0 ]; then
|
||||
|
||||
extract $TARBALL_DIR/xar*.tar.gz 2
|
||||
|
||||
pushd xar* &>/dev/null
|
||||
set +e
|
||||
sed -i 's/-Wall/-w/g' configure
|
||||
set -e
|
||||
./configure --prefix=$TARGET_DIR
|
||||
make -j$JOBS
|
||||
make install -j$JOBS
|
||||
test "`uname -s`" = "NetBSD" && patch -p0 -l < $PATCH_DIR/xar-netbsd.patch
|
||||
CFLAGS+=" -w" ./configure --prefix=$TARGET_DIR
|
||||
$MAKE -j$JOBS
|
||||
$MAKE install -j$JOBS
|
||||
popd &>/dev/null
|
||||
|
||||
fi # SDK <= 10.5
|
||||
fi # have xar
|
||||
fi
|
||||
fi
|
||||
# XAR END
|
||||
|
||||
if [ ! -f "have_cctools_$TARGET" ]; then
|
||||
|
||||
function check_cctools
|
||||
function check_cctools()
|
||||
{
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-lipo" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-ld" ] || exit 1
|
||||
@ -237,6 +254,8 @@ check_cctools x86_64
|
||||
|
||||
touch "have_cctools_${CCTOOLS_REVHASH}_$TARGET"
|
||||
|
||||
echo ""
|
||||
|
||||
fi # HAVE_CCTOOLS
|
||||
|
||||
set +e
|
||||
@ -255,24 +274,7 @@ do
|
||||
done
|
||||
set -e
|
||||
|
||||
SDK=`ls $TARBALL_DIR/MacOSX$SDK_VERSION*`
|
||||
SDK_FILENAME=`basename $SDK`
|
||||
|
||||
echo "extracting $SDK_FILENAME ..."
|
||||
|
||||
case $SDK in
|
||||
*.pkg)
|
||||
which xar &>/dev/null || { echo "please build with: FORCE_XAR_BUILD=1 ./build.sh" && exit 1; }
|
||||
xar -xf $SDK
|
||||
cat Payload | gunzip -dc | cpio -i 2>/dev/null
|
||||
;;
|
||||
*.tar.xz)
|
||||
xz -cd $SDK | tar xvf -
|
||||
;;
|
||||
*.tar.gz)
|
||||
gunzip -dc $SDK | tar xvf -
|
||||
;;
|
||||
esac
|
||||
extract $SDK 1 1
|
||||
|
||||
rm -rf $SDK_DIR/MacOSX$SDK_VERSION* 2>/dev/null
|
||||
mv -f SDKs/*$SDK_VERSION* $SDK_DIR
|
||||
@ -363,12 +365,24 @@ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`cat $BUILD_DIR/cctools*/cctools/tmp/ld
|
||||
|
||||
echo ""
|
||||
|
||||
if [ `echo "$SDK_VERSION>=10.9" | bc -l` -eq 1 ] && ( [ $OSX_VERSION_MIN == "default" ] ||
|
||||
if [ -n $OSX_VERSION_MIN ]; then
|
||||
if [ `echo "${SDK_VERSION/u/}<$OSX_VERSION_MIN" | bc -l` -eq 1 ]; then
|
||||
echo "OSX_VERSION_MIN must be <= SDK_VERSION"
|
||||
trap "" EXIT
|
||||
exit 1
|
||||
elif [ `echo "$OSX_VERSION_MIN<10.4" | bc -l` -eq 1 ]; then
|
||||
echo "OSX_VERSION_MIN must be >= 10.4"
|
||||
trap "" EXIT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ `echo "${SDK_VERSION/u/}>=10.9" | bc -l` -eq 1 ] && ( [ $OSX_VERSION_MIN == "default" ] ||
|
||||
[ `echo "$OSX_VERSION_MIN>=10.9" | bc -l` -eq 1 ] );
|
||||
then
|
||||
export SCRIPT=`basename $0`
|
||||
./build_libcxx.sh || exit 0
|
||||
fi
|
||||
fi # OSX_VERSION_MIN set
|
||||
|
||||
test_compiler o32-clang $BASE_DIR/oclang/test.c
|
||||
test_compiler o64-clang $BASE_DIR/oclang/test.c
|
||||
|
22
build_gcc.sh
22
build_gcc.sh
@ -2,7 +2,7 @@
|
||||
|
||||
pushd "${0%/*}" &>/dev/null
|
||||
|
||||
export LIBRARY_PATH=""
|
||||
unset LIBRARY_PATH
|
||||
|
||||
DESC=gcc
|
||||
source tools/tools.sh
|
||||
@ -16,9 +16,7 @@ GCC_VERSION=4.8.2
|
||||
# GCC mirror
|
||||
GCC_MIRROR="ftp://ftp.gwdg.de/pub/misc/gcc/releases"
|
||||
|
||||
set +e
|
||||
require wget
|
||||
set -e
|
||||
|
||||
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||
|
||||
@ -38,8 +36,8 @@ popd &>/dev/null
|
||||
echo "cleaning up ..."
|
||||
rm -rf gcc* 2>/dev/null
|
||||
|
||||
echo "extracting gcc ..."
|
||||
tar xf "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.bz2"
|
||||
extract "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.bz2" 1
|
||||
echo ""
|
||||
|
||||
pushd gcc*$GCC_VERSION* &>/dev/null
|
||||
|
||||
@ -49,18 +47,12 @@ rm -f $OSXCROSS_TARGET_DIR/bin/*-g++*
|
||||
mkdir -p build
|
||||
pushd build &>/dev/null
|
||||
|
||||
if [ "`uname -s`" == "FreeBSD" ]; then
|
||||
export CPATH="/usr/local/include"
|
||||
export LDFLAGS="-L/usr/local/lib $LDFLAGS"
|
||||
MAKE=gmake
|
||||
IS_FREEBSD=1
|
||||
else
|
||||
MAKE=make
|
||||
IS_FREEBSD=0
|
||||
if [[ "`uname -s`" == *BSD ]]; then
|
||||
export CPATH="/usr/local/include:/usr/pkg/include:$CPATH"
|
||||
export LDFLAGS="-L/usr/local/lib -L/usr/pkg/lib $LDFLAGS"
|
||||
export LD_LIBRARY_PATH="/usr/local/lib:/usr/pkg/lib:$LD_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
require $MAKE
|
||||
|
||||
../configure \
|
||||
--target=x86_64-apple-$OSXCROSS_TARGET \
|
||||
--with-ld=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-ld \
|
||||
|
@ -13,10 +13,8 @@ fi
|
||||
# libc++ version to build
|
||||
LIBCXX_VERSION=3.4
|
||||
|
||||
set +e
|
||||
require wget
|
||||
require cmake
|
||||
set -e
|
||||
|
||||
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||
|
||||
@ -33,7 +31,7 @@ pushd $OSXCROSS_TARBALL_DIR &>/dev/null
|
||||
wget -c "http://llvm.org/releases/${LIBCXX_VERSION}/libcxx-${LIBCXX_VERSION}.src.tar.gz"
|
||||
popd &>/dev/null
|
||||
|
||||
tar xzfv "$OSXCROSS_TARBALL_DIR/libcxx-${LIBCXX_VERSION}.src.tar.gz"
|
||||
extract "$OSXCROSS_TARBALL_DIR/libcxx-${LIBCXX_VERSION}.src.tar.gz"
|
||||
pushd libcxx-${LIBCXX_VERSION}* &>/dev/null
|
||||
rm -rf build
|
||||
mkdir build
|
||||
@ -94,7 +92,7 @@ fi # have libcxx
|
||||
|
||||
popd &>/dev/null # build dir
|
||||
|
||||
function test_compiler_clang
|
||||
function test_compiler_clang()
|
||||
{
|
||||
echo -ne "testing $2 -stdlib=libc++ ... "
|
||||
$1 $3 -O2 -stdlib=libc++ -std=c++11 -Wall -o test
|
||||
@ -102,7 +100,7 @@ function test_compiler_clang
|
||||
echo "ok"
|
||||
}
|
||||
|
||||
function test_compiler_gcc
|
||||
function test_compiler_gcc()
|
||||
{
|
||||
echo -ne "testing $2 ... "
|
||||
$1 $3 -O2 -std=c++0x -Wall -o test
|
||||
|
@ -84,6 +84,7 @@ else
|
||||
fi
|
||||
|
||||
export COMPILER_PATH="$OSXCROSS_CCTOOLS_PATH:$COMPILER_PATH"
|
||||
export LD_LIBRARY_PATH="/usr/local/lib:/usr/pkg/lib:$LD_LIBRARY_PATH"
|
||||
|
||||
$COMPILER $OSX_VERSION_MIN_OPT $OSXCROSS_OPT_ARGS ${1+"$@"}
|
||||
|
||||
|
289
patches/cctools-63f6742.patch
Normal file
289
patches/cctools-63f6742.patch
Normal file
@ -0,0 +1,289 @@
|
||||
commit 63f674235b363b7d762d075b4f1eddc09d10686b
|
||||
Author: Thomas Pöchtrager <t.poechtrager@gmail.com>
|
||||
Date: Mon Mar 24 21:16:34 2014 +0100
|
||||
|
||||
support NetBSD
|
||||
|
||||
diff --git cctools/ar/contents.c cctools/ar/contents.c
|
||||
index b5bf05d..9df1a33 100644
|
||||
--- cctools/ar/contents.c
|
||||
+++ cctools/ar/contents.c
|
||||
@@ -81,7 +81,9 @@ static char rcsid[] = "$OpenBSD: contents.c,v 1.2 1996/06/26 05:31:19 deraadt Ex
|
||||
#include "archive.h"
|
||||
#include "extern.h"
|
||||
|
||||
+#ifndef HAVE_STRMODE
|
||||
extern void strmode(int mode, char *p);
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* contents --
|
||||
diff --git cctools/configure.ac cctools/configure.ac
|
||||
index 31f075b..17c0d09 100644
|
||||
--- cctools/configure.ac
|
||||
+++ cctools/configure.ac
|
||||
@@ -10,11 +10,10 @@ AC_ARG_PROGRAM
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
|
||||
-CFLAGS="$CFLAGS `cat tmp/cflags 2>/dev/null` -O3"
|
||||
-CXXFLAGS="$CXXFLAGS `cat tmp/cxxflags 2>/dev/null` -O3"
|
||||
+CFLAGS="$CFLAGS `cat tmp/cflags 2>/dev/null` -isystem /usr/local/include -isystem /usr/pkg/include -O3"
|
||||
+CXXFLAGS="$CXXFLAGS `cat tmp/cxxflags 2>/dev/null` -isystem /usr/local/include -isystem /usr/pkg/include -O3"
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib `cat tmp/ldflags 2>/dev/null`"
|
||||
export LD_LIBRARY_PATH="`cat tmp/ldpath 2>/dev/null`"
|
||||
-export C_INCLUDE_PATH="$C_INCLUDE_PATH:/usr/local/include"
|
||||
|
||||
CPP="clang -E"
|
||||
|
||||
@@ -225,6 +224,17 @@ AC_COMPILE_IFELSE(
|
||||
)
|
||||
CFLAGS=$ORIGCFLAGS
|
||||
|
||||
+ORIGCFLAGS=$CFLAGS
|
||||
+CFLAGS="$CFLAGS -Wno-char-subscripts"
|
||||
+AC_MSG_CHECKING([if -Wno-char-subscripts is supported])
|
||||
+AC_COMPILE_IFELSE(
|
||||
+ [AC_LANG_SOURCE([[const char hw[] = "Hello, World\n";]])],
|
||||
+ [WARNINGS="$WARNINGS -Wno-char-subscripts"
|
||||
+ AC_MSG_RESULT([yes])],
|
||||
+ [AC_MSG_RESULT([no])]
|
||||
+)
|
||||
+CFLAGS=$ORIGCFLAGS
|
||||
+
|
||||
AC_SUBST([WARNINGS], [$WARNINGS])
|
||||
|
||||
|
||||
@@ -251,6 +261,8 @@ AC_SUBST(CRYPT_LIBS)
|
||||
AC_C_BIGENDIAN([AC_SUBST([ENDIAN_FLAG],[-D__BIG_ENDIAN__=1])],
|
||||
[AC_SUBST([ENDIAN_FLAG],[-D__LITTLE_ENDIAN__=1])])
|
||||
|
||||
+AC_CHECK_FUNCS([strmode])
|
||||
+
|
||||
AC_CONFIG_FILES([Makefile libstuff/Makefile])
|
||||
AC_CONFIG_FILES([ar/Makefile])
|
||||
AC_CONFIG_FILES([as/Makefile])
|
||||
diff --git cctools/include/foreign/i386/endian.h cctools/include/foreign/i386/endian.h
|
||||
index 2dbebcb..2fbd938 100644
|
||||
--- cctools/include/foreign/i386/endian.h
|
||||
+++ cctools/include/foreign/i386/endian.h
|
||||
@@ -96,9 +96,9 @@
|
||||
|
||||
#define BYTE_ORDER __DARWIN_BYTE_ORDER
|
||||
|
||||
-#ifndef __FreeBSD__
|
||||
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/_endian.h>
|
||||
-#endif /* !__FreeBSD__ */
|
||||
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
|
||||
#endif /* !_I386__ENDIAN_H_ */
|
||||
diff --git cctools/include/foreign/i386/signal.h cctools/include/foreign/i386/signal.h
|
||||
index d729a28..5ddde95 100644
|
||||
--- cctools/include/foreign/i386/signal.h
|
||||
+++ cctools/include/foreign/i386/signal.h
|
||||
@@ -40,9 +40,9 @@ typedef int sig_atomic_t;
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
|
||||
-#ifndef __FreeBSD__
|
||||
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
#include <sys/appleapiopts.h>
|
||||
-#endif /* __FreeBSD__ */
|
||||
+#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
|
||||
|
||||
#ifdef __APPLE_API_OBSOLETE
|
||||
|
||||
diff --git cctools/include/foreign/i386/types.h cctools/include/foreign/i386/types.h
|
||||
index 80e9e80..13d95ec 100644
|
||||
--- cctools/include/foreign/i386/types.h
|
||||
+++ cctools/include/foreign/i386/types.h
|
||||
@@ -67,6 +67,9 @@
|
||||
#define _MACHTYPES_H_
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
+#include_next <machine/types.h> /* __cpu_simple_lock_t */
|
||||
+#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
#include <i386/_types.h>
|
||||
#include <sys/cdefs.h>
|
||||
/*
|
||||
@@ -90,9 +93,17 @@ typedef int int32_t;
|
||||
typedef unsigned int u_int32_t;
|
||||
#ifndef _INT64_T
|
||||
#define _INT64_T
|
||||
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
typedef long long int64_t;
|
||||
+#else
|
||||
+typedef long int64_t;
|
||||
+#endif /* ! __NetBSD__ && !__OpenBSD__ */
|
||||
#endif
|
||||
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
typedef unsigned long long u_int64_t;
|
||||
+#else
|
||||
+typedef unsigned long u_int64_t;
|
||||
+#endif /* ! __NetBSD__ && !__OpenBSD__ */
|
||||
|
||||
#if __LP64__
|
||||
typedef int64_t register_t;
|
||||
diff --git cctools/include/foreign/mach/vm_inherit.h cctools/include/foreign/mach/vm_inherit.h
|
||||
index d6440e4..27cf97b 100644
|
||||
--- cctools/include/foreign/mach/vm_inherit.h
|
||||
+++ cctools/include/foreign/mach/vm_inherit.h
|
||||
@@ -72,7 +72,11 @@
|
||||
* vm_inherit_t inheritance codes.
|
||||
*/
|
||||
|
||||
-typedef unsigned int vm_inherit_t; /* might want to change this */
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
+typedef int vm_inherit_t; /* might want to change this */
|
||||
+#else
|
||||
+typedef unsigned int vm_inherit_t; /* might want to change this */
|
||||
+#endif /* __NetBSD__ || __OpenBSD__ */
|
||||
|
||||
/*
|
||||
* Enumeration of valid values for vm_inherit_t.
|
||||
diff --git cctools/include/foreign/mach/vm_prot.h cctools/include/foreign/mach/vm_prot.h
|
||||
index 6fe17d4..e5c8c12 100644
|
||||
--- cctools/include/foreign/mach/vm_prot.h
|
||||
+++ cctools/include/foreign/mach/vm_prot.h
|
||||
@@ -88,6 +88,7 @@ typedef int vm_prot_t;
|
||||
* The default protection for newly-created virtual memory
|
||||
*/
|
||||
|
||||
+#undef VM_PROT_DEFAULT
|
||||
#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
|
||||
|
||||
/*
|
||||
diff --git cctools/include/foreign/machine/_limits.h cctools/include/foreign/machine/_limits.h
|
||||
index ef021a2..61ceec2 100644
|
||||
--- cctools/include/foreign/machine/_limits.h
|
||||
+++ cctools/include/foreign/machine/_limits.h
|
||||
@@ -25,7 +25,7 @@
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include_next <machine/_limits.h>
|
||||
#else
|
||||
#ifndef _BSD_MACHINE__LIMITS_H_
|
||||
@@ -42,4 +42,4 @@
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE__LIMITS_H_ */
|
||||
-#endif /* __FreeBSD__ */
|
||||
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
||||
diff --git cctools/include/foreign/machine/_types.h cctools/include/foreign/machine/_types.h
|
||||
index d1b89b4..789a323 100644
|
||||
--- cctools/include/foreign/machine/_types.h
|
||||
+++ cctools/include/foreign/machine/_types.h
|
||||
@@ -25,7 +25,7 @@
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined(__FreeBSD__)
|
||||
#include_next <machine/_types.h>
|
||||
#else
|
||||
#ifndef _BSD_MACHINE__TYPES_H_
|
||||
diff --git cctools/include/foreign/machine/endian.h cctools/include/foreign/machine/endian.h
|
||||
index 9fd936a..2341cdd 100644
|
||||
--- cctools/include/foreign/machine/endian.h
|
||||
+++ cctools/include/foreign/machine/endian.h
|
||||
@@ -28,7 +28,7 @@
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include_next <machine/endian.h>
|
||||
#else
|
||||
#ifndef _BSD_MACHINE_ENDIAN_H_
|
||||
@@ -45,4 +45,4 @@
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE_ENDIAN_H_ */
|
||||
-#endif /* __FreeBSD__ */
|
||||
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */
|
||||
diff --git cctools/ld64/src/3rd/helper.c cctools/ld64/src/3rd/helper.c
|
||||
index b75c215..d387c54 100644
|
||||
--- cctools/ld64/src/3rd/helper.c
|
||||
+++ cctools/ld64/src/3rd/helper.c
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <assert.h>
|
||||
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,8 @@ void __assert_rtn(const char *func, const char *file, int line, const char *msg)
|
||||
{
|
||||
#ifdef __FreeBSD__
|
||||
__assert(msg, file, line, func);
|
||||
+#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
+ __assert(msg, line, file);
|
||||
#else
|
||||
__assert(msg, file, line);
|
||||
#endif /* __FreeBSD__ */
|
||||
diff --git cctools/ld64/src/ld/ld.cpp cctools/ld64/src/ld/ld.cpp
|
||||
index ee337a0..45b7f95 100644
|
||||
--- cctools/ld64/src/ld/ld.cpp
|
||||
+++ cctools/ld64/src/ld/ld.cpp
|
||||
@@ -37,9 +37,9 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
-#ifndef __FreeBSD__
|
||||
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
#include <execinfo.h>
|
||||
-#endif /* __FreeBSD__ */
|
||||
+#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
|
||||
#include <mach/mach_time.h>
|
||||
#include <mach/vm_statistics.h>
|
||||
#include <mach/mach_init.h>
|
||||
@@ -757,7 +757,7 @@ int main(int argc, const char* argv[])
|
||||
// implement assert() function to print out a backtrace before aborting
|
||||
void __assert_rtn(const char* func, const char* file, int line, const char* failedexpr)
|
||||
{
|
||||
-#ifndef __FreeBSD__
|
||||
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
Snapshot *snapshot = Snapshot::globalSnapshot;
|
||||
|
||||
snapshot->setSnapshotMode(Snapshot::SNAPSHOT_DEBUG);
|
||||
@@ -783,7 +783,7 @@ void __assert_rtn(const char* func, const char* file, int line, const char* fail
|
||||
snapshot->recordAssertionMessage("%d %p %s + %ld\n", i, callStack[i], symboName, offset);
|
||||
}
|
||||
fprintf(stderr, "A linker snapshot was created at:\n\t%s\n", snapshot->rootDir());
|
||||
-#endif /* __FreeBSD__ */
|
||||
+#endif /* !__FreeBSD__ && !__NetBSD__ && !__OpenBSD__ */
|
||||
fprintf(stderr, "ld: Assertion failed: (%s), function %s, file %s, line %d.\n", failedexpr, func, file, line);
|
||||
exit(1);
|
||||
}
|
||||
diff --git cctools/libstuff/dylib_roots.c cctools/libstuff/dylib_roots.c
|
||||
index eb661b0..74b6519 100644
|
||||
--- cctools/libstuff/dylib_roots.c
|
||||
+++ cctools/libstuff/dylib_roots.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <fts.h>
|
||||
#endif
|
||||
#include <sys/errno.h>
|
||||
+#include <errno.h>
|
||||
#include "stuff/bool.h"
|
||||
#include "stuff/SymLoc.h"
|
||||
#include "stuff/ofile.h"
|
||||
diff --git tools/find_lto_header.sh tools/find_lto_header.sh
|
||||
index 665683d..6ce5979 100755
|
||||
--- tools/find_lto_header.sh
|
||||
+++ tools/find_lto_header.sh
|
||||
@@ -26,6 +26,7 @@ try "-3.2"
|
||||
try "-3.3"
|
||||
try "-3.4"
|
||||
try "-3.5"
|
||||
+try "-devel"
|
||||
|
||||
try "32"
|
||||
try "33"
|
92
patches/xar-netbsd.patch
Normal file
92
patches/xar-netbsd.patch
Normal file
@ -0,0 +1,92 @@
|
||||
--- lib/linuxattr.c
|
||||
+++ lib/linuxattr.c
|
||||
@@ -52,9 +52,7 @@
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_SYS_STATFS_H /* Nonexistant future OS needs this */
|
||||
-#include <sys/statfs.h>
|
||||
-#endif
|
||||
+#include <sys/statvfs.h>
|
||||
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
#include <sys/mount.h>
|
||||
@@ -138,7 +136,7 @@
|
||||
#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LGETXATTR) && !defined(__APPLE__)
|
||||
char *i, *buf = NULL;
|
||||
int ret, retval=0, bufsz = 1024;
|
||||
- struct statfs sfs;
|
||||
+ struct statvfs sfs;
|
||||
char *fsname = NULL;
|
||||
struct _linuxattr_context context;
|
||||
|
||||
@@ -165,8 +163,9 @@
|
||||
if( ret == 0 ) goto BAIL;
|
||||
|
||||
memset(&sfs, 0, sizeof(sfs));
|
||||
- statfs(file, &sfs);
|
||||
+ statvfs(file, &sfs);
|
||||
|
||||
+#if 0
|
||||
switch(sfs.f_type) {
|
||||
case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */
|
||||
case JFS_SUPER_MAGIC: fsname = "jfs" ; break;
|
||||
@@ -174,6 +173,15 @@
|
||||
case XFS_SUPER_MAGIC: fsname = "xfs" ; break;
|
||||
default: retval=0; goto BAIL;
|
||||
};
|
||||
+#endif
|
||||
+
|
||||
+ fsname = sfs.f_fstypename;
|
||||
+
|
||||
+ if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") &&
|
||||
+ strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) {
|
||||
+ retval=0;
|
||||
+ goto BAIL;
|
||||
+ }
|
||||
|
||||
for( i=buf; (i-buf) < ret; i += strlen(i)+1 ) {
|
||||
xar_ea_t e;
|
||||
@@ -202,7 +210,7 @@
|
||||
{
|
||||
#if defined HAVE_SYS_XATTR_H && defined(HAVE_LSETXATTR) && !defined(__APPLE__)
|
||||
const char *fsname = "bogus";
|
||||
- struct statfs sfs;
|
||||
+ struct statvfs sfs;
|
||||
int eaopt = 0;
|
||||
struct _linuxattr_context context;
|
||||
xar_prop_t p;
|
||||
@@ -217,19 +225,31 @@
|
||||
/* Check for EA extraction behavior */
|
||||
|
||||
memset(&sfs, 0, sizeof(sfs));
|
||||
- if( statfs(file, &sfs) != 0 ) {
|
||||
+ if( statvfs(file, &sfs) != 0 ) {
|
||||
char *tmp, *bname;
|
||||
tmp = strdup(file);
|
||||
bname = dirname(tmp);
|
||||
- statfs(bname, &sfs);
|
||||
+ statvfs(bname, &sfs);
|
||||
free(tmp);
|
||||
}
|
||||
+#if 0
|
||||
switch(sfs.f_type) {
|
||||
case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */
|
||||
case JFS_SUPER_MAGIC: fsname = "jfs" ; break;
|
||||
case REISERFS_SUPER_MAGIC:fsname = "reiser" ; break;
|
||||
case XFS_SUPER_MAGIC: fsname = "xfs" ; break;
|
||||
};
|
||||
+#endif
|
||||
+
|
||||
+ {
|
||||
+ const char *pp = fsname;
|
||||
+ fsname = sfs.f_fstypename;
|
||||
+
|
||||
+ if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") &&
|
||||
+ strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) {
|
||||
+ fsname = pp;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
for(p = xar_prop_pfirst(f); p; p = xar_prop_pnext(p)) {
|
||||
const char *fs = NULL;
|
@ -14,7 +14,7 @@ get_fedora_deps()
|
||||
get_freebsd_deps()
|
||||
{
|
||||
for pkgname in llvm-devel automake autogen libtool \
|
||||
libxml2 e2fsprogs-libuuid openssl bash make; do
|
||||
libxml2 e2fsprogs-libuuid openssl bash gmake; do
|
||||
echo $pkgname
|
||||
pkg install $pkgname
|
||||
done
|
||||
|
@ -21,8 +21,9 @@ if [ "`basename $0`" != "build.sh" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
function require
|
||||
function require()
|
||||
{
|
||||
set +e
|
||||
which $1 &>/dev/null
|
||||
while [ $? -ne 0 ]
|
||||
do
|
||||
@ -30,9 +31,54 @@ function require
|
||||
read -p "Please install $1 then press enter"
|
||||
which $1 &>/dev/null
|
||||
done
|
||||
set -e
|
||||
}
|
||||
|
||||
function test_compiler
|
||||
if [[ "`uname -s`" == *BSD ]]; then
|
||||
MAKE=gmake
|
||||
else
|
||||
MAKE=make
|
||||
fi
|
||||
|
||||
require $MAKE
|
||||
|
||||
function extract()
|
||||
{
|
||||
test $# -ge 2 -a $# -lt 4 && test $2 -eq 2 && echo ""
|
||||
echo "extracting `basename $1` ..."
|
||||
|
||||
local tarflags
|
||||
|
||||
tarflags="xf"
|
||||
test -n "$OCDEBUG" && tarflags+="v"
|
||||
|
||||
case $1 in
|
||||
*.pkg)
|
||||
which xar &>/dev/null || exit 1
|
||||
xar -xf $1
|
||||
cat Payload | gunzip -dc | cpio -i 2>/dev/null && rm Payload
|
||||
;;
|
||||
*.tar.xz)
|
||||
xz -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*.tar.gz)
|
||||
gunzip -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*.tar.bz2)
|
||||
bzip2 -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*)
|
||||
echo "Unhandled archive type"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $# -eq 2 -o $# -eq 4 ]; then
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function test_compiler()
|
||||
{
|
||||
echo -ne "testing $1 ... "
|
||||
$1 $2 -O2 -Wall -o test
|
||||
|
@ -22,7 +22,7 @@ function _exit()
|
||||
remove_locks
|
||||
echo "if it is happening the first time, then just re-run the script"
|
||||
echo ""
|
||||
check_for_bug_1242300
|
||||
test $SCRIPT = "build.sh" && check_for_bug_1242300
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user