mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-03 22:45:56 +01:00
add support for the 10.10 SDK (DP1)
get rid of bc dependency
This commit is contained in:
parent
270f6d73f6
commit
0d9ba01d5b
@ -7,6 +7,7 @@ changed:
|
|||||||
added:
|
added:
|
||||||
* support for new '-arch x86_64h' (requires clang 3.5+)
|
* support for new '-arch x86_64h' (requires clang 3.5+)
|
||||||
* support for multiple '-arch' flags with gcc
|
* support for multiple '-arch' flags with gcc
|
||||||
|
* OS X 10.10 support (DP1)
|
||||||
|
|
||||||
/******************************* v0.7 *******************************/
|
/******************************* v0.7 *******************************/
|
||||||
|
|
||||||
|
@ -145,13 +145,13 @@ However, there are several ways to override the default value:
|
|||||||
\>= 10.9 also defaults to `libc++` instead of `libstdc++`, this behavior
|
\>= 10.9 also defaults to `libc++` instead of `libstdc++`, this behavior
|
||||||
can be overriden by explicitly passing `-stdlib=libstdc++` to clang.
|
can be overriden by explicitly passing `-stdlib=libstdc++` to clang.
|
||||||
|
|
||||||
x86_64h defaults to `Mac OS X 10.9` and requires clang 3.5+.
|
x86\_64h defaults to `Mac OS X 10.9` and requires clang 3.5+.
|
||||||
|
x86\_64h = x86\_64 with optimizations for the Intel Haswell Architecture.
|
||||||
|
|
||||||
### LICENSE: ####
|
### LICENSE: ####
|
||||||
* scripts/wrapper: GPLv2
|
* scripts/wrapper: GPLv2
|
||||||
* cctools/ld64: APSL 2.0
|
* cctools/ld64: APSL 2.0
|
||||||
* xar: New BSD
|
* xar: New BSD
|
||||||
* bc: GPLv3
|
|
||||||
|
|
||||||
### CREDITS: ####
|
### CREDITS: ####
|
||||||
* [cjacker for the cctools linux port](https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/source/browse/#svn%2Ftrunk%2Fcctools-porting%2Fpatches)
|
* [cjacker for the cctools linux port](https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/source/browse/#svn%2Ftrunk%2Fcctools-porting%2Fpatches)
|
||||||
|
27
build.sh
27
build.sh
@ -96,6 +96,7 @@ case $SDK_VERSION in
|
|||||||
10.7*) TARGET=darwin11 ;;
|
10.7*) TARGET=darwin11 ;;
|
||||||
10.8*) TARGET=darwin12 ;;
|
10.8*) TARGET=darwin12 ;;
|
||||||
10.9*) TARGET=darwin13 ;;
|
10.9*) TARGET=darwin13 ;;
|
||||||
|
10.10*) TARGET=darwin14 ;;
|
||||||
*) echo "Invalid SDK Version" && exit 1 ;;
|
*) echo "Invalid SDK Version" && exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -166,7 +167,6 @@ if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
|
|||||||
|
|
||||||
rm -rf cctools*
|
rm -rf cctools*
|
||||||
rm -rf xar*
|
rm -rf xar*
|
||||||
rm -rf bc*
|
|
||||||
|
|
||||||
extract $CCTOOLS_TARBALL 1
|
extract $CCTOOLS_TARBALL 1
|
||||||
|
|
||||||
@ -217,25 +217,6 @@ LINKER_VERSION="`get_ld_version`"
|
|||||||
fi
|
fi
|
||||||
# CCTOOLS END
|
# CCTOOLS END
|
||||||
|
|
||||||
# BC
|
|
||||||
set +e
|
|
||||||
which bc &>/dev/null
|
|
||||||
NEED_BC=$?
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ $NEED_BC -ne 0 ]; then
|
|
||||||
|
|
||||||
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
|
|
||||||
popd &>/dev/null
|
|
||||||
|
|
||||||
fi
|
|
||||||
# BC END
|
|
||||||
|
|
||||||
SDK=`ls $TARBALL_DIR/MacOSX$SDK_VERSION*`
|
SDK=`ls $TARBALL_DIR/MacOSX$SDK_VERSION*`
|
||||||
|
|
||||||
# XAR
|
# XAR
|
||||||
@ -344,11 +325,11 @@ $BASE_DIR/wrapper/build.sh 1>/dev/null
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ "$OSX_VERSION_MIN" != "default" ]; then
|
if [ "$OSX_VERSION_MIN" != "default" ]; then
|
||||||
if [ `echo "${SDK_VERSION/u/}<$OSX_VERSION_MIN" | bc -l` -eq 1 ]; then
|
if [ `osxcross-cmp ${SDK_VERSION/u/} "<" $OSX_VERSION_MIN` -eq 1 ]; then
|
||||||
echo "OSX_VERSION_MIN must be <= SDK_VERSION"
|
echo "OSX_VERSION_MIN must be <= SDK_VERSION"
|
||||||
trap "" EXIT
|
trap "" EXIT
|
||||||
exit 1
|
exit 1
|
||||||
elif [ `echo "$OSX_VERSION_MIN<10.4" | bc -l` -eq 1 ]; then
|
elif [ `osxcross-cmp $OSX_VERSION_MIN "<" 10.4` -eq 1 ]; then
|
||||||
echo "OSX_VERSION_MIN must be >= 10.4"
|
echo "OSX_VERSION_MIN must be >= 10.4"
|
||||||
trap "" EXIT
|
trap "" EXIT
|
||||||
exit 1
|
exit 1
|
||||||
@ -361,7 +342,7 @@ test_compiler o64-clang $BASE_DIR/oclang/test.c
|
|||||||
test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp
|
test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp
|
||||||
test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp
|
test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp
|
||||||
|
|
||||||
if [ `echo "${SDK_VERSION/u/}>=10.7" | bc -l` -eq 1 ]; then
|
if [ `osxcross-cmp ${SDK_VERSION/u/} ">=" 10.7` -eq 1 ]; then
|
||||||
if [ ! -d "$SDK_DIR/MacOSX$SDK_VERSION.sdk/usr/include/c++/v1" ]; then
|
if [ ! -d "$SDK_DIR/MacOSX$SDK_VERSION.sdk/usr/include/c++/v1" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "Given SDK does not contain libc++ headers "
|
echo -n "Given SDK does not contain libc++ headers "
|
||||||
|
Binary file not shown.
@ -4,22 +4,22 @@
|
|||||||
# This script must be run on OS X
|
# This script must be run on OS X
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ $(uname -s) != "Darwin" ]; then
|
if [ -z "$XCODEDIR" -a $(uname -s) != "Darwin" ]; then
|
||||||
echo "This script must be run on OS X"
|
echo "This script must be run on OS X"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
elif [ -z "$XCODEDIR" ]; then
|
||||||
|
|
||||||
XCODEDIR=$(ls /Volumes | grep Xcode | head -n1)
|
XCODEDIR=$(ls /Volumes | grep Xcode | head -n1)
|
||||||
|
|
||||||
if [ -z "$XCODEDIR" ]; then
|
if [ -z "$XCODEDIR" ]; then
|
||||||
if [ -d "/Applications/Xcode.app" ]; then
|
if [ -d "/Applications/Xcode.app" ]; then
|
||||||
XCODEDIR="/Applications/Xcode.app"
|
XCODEDIR="/Applications/Xcode*.app"
|
||||||
else
|
else
|
||||||
echo "please mount Xcode.dmg"
|
echo "please mount Xcode.dmg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
XCODEDIR="/Volumes/$XCODEDIR/Xcode.app"
|
XCODEDIR="/Volumes/$XCODEDIR/Xcode*.app"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -d $XCODEDIR ] && exit 1
|
[ ! -d $XCODEDIR ] && exit 1
|
||||||
|
@ -41,6 +41,7 @@ SRCS= \
|
|||||||
programs/osxcross-version.cpp \
|
programs/osxcross-version.cpp \
|
||||||
programs/osxcross-env.cpp \
|
programs/osxcross-env.cpp \
|
||||||
programs/osxcross-conf.cpp \
|
programs/osxcross-conf.cpp \
|
||||||
|
programs/osxcross-cmp.cpp \
|
||||||
programs/sw_vers.cpp
|
programs/sw_vers.cpp
|
||||||
|
|
||||||
OBJS=$(subst .cpp,.o,$(SRCS))
|
OBJS=$(subst .cpp,.o,$(SRCS))
|
||||||
|
@ -490,7 +490,7 @@ void generateMultiArchObjectFile(int &rc, int argc, char **argv, Target &target,
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
++num;
|
++num;
|
||||||
|
|
||||||
obj.str(std::string());
|
clear(obj);
|
||||||
obj << "/tmp/" << getNanoSeconds() << "_" << outputname << "_" << archname;
|
obj << "/tmp/" << getNanoSeconds() << "_" << outputname << "_" << archname;
|
||||||
|
|
||||||
objs.push_back(obj.str());
|
objs.push_back(obj.str());
|
||||||
|
57
wrapper/programs/osxcross-cmp.cpp
Normal file
57
wrapper/programs/osxcross-cmp.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
* OSXCross Compiler Wrapper *
|
||||||
|
* Copyright (C) 2014 by Thomas Poechtrager *
|
||||||
|
* t.poechtrager@gmail.com *
|
||||||
|
* *
|
||||||
|
* 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 2 *
|
||||||
|
* 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, write to the Free Software *
|
||||||
|
* Foundation, Inc., *
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#include "proginc.h"
|
||||||
|
|
||||||
|
using namespace tools;
|
||||||
|
|
||||||
|
namespace program {
|
||||||
|
namespace osxcross {
|
||||||
|
|
||||||
|
int cmp(int argc, char **argv) {
|
||||||
|
if (argc < 4)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
OSVersion a = parseOSVersion(argv[1]);
|
||||||
|
OSVersion b = parseOSVersion(argv[3]);
|
||||||
|
|
||||||
|
const char *op = argv[2];
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
if (!strcmp(op, ">"))
|
||||||
|
res = a > b;
|
||||||
|
else if (!strcmp(op, "<"))
|
||||||
|
res = a < b;
|
||||||
|
else if (!strcmp(op, ">="))
|
||||||
|
res = a >= b;
|
||||||
|
else if (!strcmp(op, "<="))
|
||||||
|
res = a <= b;
|
||||||
|
else if (!strcmp(op, "=="))
|
||||||
|
res = a == b;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
std::cout << (res ? "1" : "0");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace osxcross
|
||||||
|
} // namespace program
|
@ -80,6 +80,7 @@ namespace osxcross {
|
|||||||
int version();
|
int version();
|
||||||
int env(int argc, char **argv);
|
int env(int argc, char **argv);
|
||||||
int conf(const Target &target);
|
int conf(const Target &target);
|
||||||
|
int cmp(int argc, char **argv);
|
||||||
} // namespace osxcross
|
} // namespace osxcross
|
||||||
|
|
||||||
static int dummy() { return 0; }
|
static int dummy() { return 0; }
|
||||||
@ -89,6 +90,7 @@ constexpr prog programs[] = { { "sw_vers", sw_vers },
|
|||||||
{ "osxcross", osxcross::version },
|
{ "osxcross", osxcross::version },
|
||||||
{ "osxcross-env", osxcross::env },
|
{ "osxcross-env", osxcross::env },
|
||||||
{ "osxcross-conf", osxcross::conf },
|
{ "osxcross-conf", osxcross::conf },
|
||||||
|
{ "osxcross-cmp", osxcross::cmp },
|
||||||
{ "wrapper", dummy } };
|
{ "wrapper", dummy } };
|
||||||
|
|
||||||
template <class T> const prog *getprog(const T &name) {
|
template <class T> const prog *getprog(const T &name) {
|
||||||
|
@ -214,7 +214,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
|||||||
static ClangVersion clangversion;
|
static ClangVersion clangversion;
|
||||||
static std::string pathtmp;
|
static std::string pathtmp;
|
||||||
|
|
||||||
dir.str(std::string());
|
clear(dir);
|
||||||
clangversion = ClangVersion();
|
clangversion = ClangVersion();
|
||||||
pathtmp.clear();
|
pathtmp.clear();
|
||||||
|
|
||||||
@ -227,10 +227,9 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
|||||||
|
|
||||||
if (cv != ClangVersion()) {
|
if (cv != ClangVersion()) {
|
||||||
static std::stringstream tmp;
|
static std::stringstream tmp;
|
||||||
tmp.str(std::string());
|
clear(tmp);
|
||||||
|
|
||||||
auto checkDir = [&](std::stringstream &dir)
|
auto checkDir = [&](std::stringstream &dir) {
|
||||||
{
|
|
||||||
static std::string intrindir;
|
static std::string intrindir;
|
||||||
auto &file = dir;
|
auto &file = dir;
|
||||||
|
|
||||||
@ -251,7 +250,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
|||||||
tmp << dir.str() << "/" << file << "/include";
|
tmp << dir.str() << "/" << file << "/include";
|
||||||
|
|
||||||
if (!checkDir(tmp)) {
|
if (!checkDir(tmp)) {
|
||||||
tmp.str(std::string());
|
clear(tmp);
|
||||||
tmp << dir.str() << "/" << file;
|
tmp << dir.str() << "/" << file;
|
||||||
checkDir(tmp);
|
checkDir(tmp);
|
||||||
}
|
}
|
||||||
@ -269,7 +268,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
|||||||
dir << clangbin << "/../lib/clang";
|
dir << clangbin << "/../lib/clang";
|
||||||
|
|
||||||
if (!check()) {
|
if (!check()) {
|
||||||
dir.str(std::string());
|
clear(dir);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
constexpr const char *OSXIntrinDirs[] = {
|
constexpr const char *OSXIntrinDirs[] = {
|
||||||
@ -283,7 +282,7 @@ bool Target::findClangIntrinsicHeaders(std::string &path) const {
|
|||||||
if (check()) {
|
if (check()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dir.str(std::string());
|
clear(dir);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -306,7 +305,6 @@ void Target::setupGCCLibs(Arch arch) {
|
|||||||
std::string SDKPath;
|
std::string SDKPath;
|
||||||
std::stringstream GCCLibSTDCXXPath;
|
std::stringstream GCCLibSTDCXXPath;
|
||||||
std::stringstream GCCLibPath;
|
std::stringstream GCCLibPath;
|
||||||
std::stringstream tmp;
|
|
||||||
|
|
||||||
getSDKPath(SDKPath);
|
getSDKPath(SDKPath);
|
||||||
|
|
||||||
@ -314,6 +312,13 @@ void Target::setupGCCLibs(Arch arch) {
|
|||||||
GCCLibPath << SDKPath << "/../../lib/gcc/" << otriple << "/"
|
GCCLibPath << SDKPath << "/../../lib/gcc/" << otriple << "/"
|
||||||
<< gccversion.Str();
|
<< gccversion.Str();
|
||||||
|
|
||||||
|
auto addLib = [&](const std::stringstream &path, const char *lib) {
|
||||||
|
static std::stringstream tmp;
|
||||||
|
clear(tmp);
|
||||||
|
tmp << path.str() << "/lib" << lib << ".a";
|
||||||
|
fargs.push_back(tmp.str());
|
||||||
|
};
|
||||||
|
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case Arch::i386:
|
case Arch::i386:
|
||||||
case Arch::i486:
|
case Arch::i486:
|
||||||
@ -327,20 +332,10 @@ void Target::setupGCCLibs(Arch arch) {
|
|||||||
|
|
||||||
fargs.push_back("-Qunused-arguments");
|
fargs.push_back("-Qunused-arguments");
|
||||||
|
|
||||||
tmp << GCCLibSTDCXXPath.str() << "/libstdc++.a";
|
addLib(GCCLibSTDCXXPath, "stdc++");
|
||||||
fargs.push_back(tmp.str());
|
addLib(GCCLibSTDCXXPath, "supc++");
|
||||||
|
addLib(GCCLibPath, "gcc");
|
||||||
tmp.str(std::string());
|
addLib(GCCLibPath, "gcc_eh");
|
||||||
tmp << GCCLibSTDCXXPath.str() << "/libsupc++.a";
|
|
||||||
fargs.push_back(tmp.str());
|
|
||||||
|
|
||||||
tmp.str(std::string());
|
|
||||||
tmp << GCCLibPath.str() << "/libgcc.a";
|
|
||||||
fargs.push_back(tmp.str());
|
|
||||||
|
|
||||||
tmp.str(std::string());
|
|
||||||
tmp << GCCLibPath.str() << "/libgcc_eh.a";
|
|
||||||
fargs.push_back(tmp.str());
|
|
||||||
|
|
||||||
fargs.push_back("-lc");
|
fargs.push_back("-lc");
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ const std::string &getParentProcessName() {
|
|||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
} else {
|
} else {
|
||||||
file.str(std::string());
|
clear(file);
|
||||||
file << "/proc/" << ppid << "/exe";
|
file << "/proc/" << ppid << "/exe";
|
||||||
char buf[PATH_MAX + 1];
|
char buf[PATH_MAX + 1];
|
||||||
if (readlink(file.str().c_str(), buf, sizeof(buf)) > 0) {
|
if (readlink(file.str().c_str(), buf, sizeof(buf)) > 0) {
|
||||||
|
@ -21,8 +21,18 @@
|
|||||||
|
|
||||||
namespace tools {
|
namespace tools {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Misc helper tools
|
||||||
|
//
|
||||||
|
|
||||||
typedef std::vector<std::string> string_vector;
|
typedef std::vector<std::string> string_vector;
|
||||||
|
|
||||||
|
static inline void clear(std::stringstream &sstr)
|
||||||
|
{
|
||||||
|
sstr.clear();
|
||||||
|
sstr.str(std::string());
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Executable path
|
// Executable path
|
||||||
//
|
//
|
||||||
@ -38,7 +48,7 @@ std::string &fixPathDiv(std::string &path);
|
|||||||
void concatEnvVariable(const char *var, const std::string val);
|
void concatEnvVariable(const char *var, const std::string val);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Files and Directories
|
// Files and directories
|
||||||
//
|
//
|
||||||
|
|
||||||
std::string *getFileContent(const std::string &file, std::string &content);
|
std::string *getFileContent(const std::string &file, std::string &content);
|
||||||
@ -130,6 +140,10 @@ struct OSVersion {
|
|||||||
return Num() <= OSNum.Num();
|
return Num() <= OSNum.Num();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr bool operator==(const OSVersion &OSNum) const {
|
||||||
|
return Num() == OSNum.Num();
|
||||||
|
}
|
||||||
|
|
||||||
constexpr bool operator!=(const OSVersion &OSNum) const {
|
constexpr bool operator!=(const OSVersion &OSNum) const {
|
||||||
return Num() != OSNum.Num();
|
return Num() != OSNum.Num();
|
||||||
}
|
}
|
||||||
@ -239,7 +253,7 @@ inline Arch parseArch(const char *arch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Stdlib
|
// Standard Library
|
||||||
//
|
//
|
||||||
|
|
||||||
enum StdLib {
|
enum StdLib {
|
||||||
|
Loading…
Reference in New Issue
Block a user