diff --git a/CHANGELOG b/CHANGELOG index 3a91f8a..a3321f9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ changed: * improved and colorized wrapper error/warning/debug/info messages added: +* 'osxcross-man' man page tool * p7zip sdk packaging script * a minimalistic xcrun tool * support for ccache symlinks diff --git a/tools/gen_sdk_package.sh b/tools/gen_sdk_package.sh index 99cdd42..0a5fbfd 100755 --- a/tools/gen_sdk_package.sh +++ b/tools/gen_sdk_package.sh @@ -98,6 +98,9 @@ LIBCXXDIR1="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v # Xcode 6 LIBCXXDIR2="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1" +# Manual directory +MANDIR="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man" + for SDK in $SDKS; do echo -n "packaging $(echo "$SDK" | sed -E "s/(.sdk|.pkg)//g") SDK " echo "(this may take several minutes) ..." @@ -119,6 +122,11 @@ for SDK in $SDKS; do cp -rf $LIBCXXDIR2 "$TMP/$SDK/usr/include/c++" fi + if [ -d $MANDIR ]; then + mkdir -p $TMP/$SDK/usr/share/man + cp -rf $MANDIR/* $TMP/$SDK/usr/share/man + fi + popd &>/dev/null pushd $TMP &>/dev/null diff --git a/wrapper/Makefile b/wrapper/Makefile index 3350569..0c2da2c 100644 --- a/wrapper/Makefile +++ b/wrapper/Makefile @@ -44,6 +44,7 @@ SRCS= \ programs/osxcross-env.cpp \ programs/osxcross-conf.cpp \ programs/osxcross-cmp.cpp \ + programs/osxcross-man.cpp \ programs/sw_vers.cpp \ programs/pkg-config.cpp \ programs/xcrun.cpp diff --git a/wrapper/build.sh b/wrapper/build.sh index a673e98..381b414 100755 --- a/wrapper/build.sh +++ b/wrapper/build.sh @@ -144,6 +144,7 @@ create_wrapper_link osxcross 1 create_wrapper_link osxcross-conf 1 create_wrapper_link osxcross-env 1 create_wrapper_link osxcross-cmp 1 +create_wrapper_link osxcross-man 1 create_wrapper_link pkg-config if [ "$PLATFORM" != "Darwin" ]; then diff --git a/wrapper/programs/osxcross-conf.cpp b/wrapper/programs/osxcross-conf.cpp index fc5b936..003f99f 100644 --- a/wrapper/programs/osxcross-conf.cpp +++ b/wrapper/programs/osxcross-conf.cpp @@ -32,11 +32,8 @@ int conf(Target &target) { OSVersion OSXVersionMin = getDefaultMinTarget(); const char *ltopath = getLibLTOPath(); - if (!target.getSDKPath(SDKPath)) { - err << "cannot find Mac OS X SDK (expected in: " << SDKPath << ")" - << err.endl(); + if (!target.getSDKPath(SDKPath)) return 1; - } if (!OSXVersionMin.Num()) OSXVersionMin = target.getSDKOSNum(); diff --git a/wrapper/programs/osxcross-man.cpp b/wrapper/programs/osxcross-man.cpp new file mode 100644 index 0000000..ae1f148 --- /dev/null +++ b/wrapper/programs/osxcross-man.cpp @@ -0,0 +1,61 @@ +/*********************************************************************** + * OSXCross Compiler Wrapper * + * Copyright (C) 2014, 2015 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" + +#ifndef _WIN32 +#include +#endif + +using namespace tools; +using namespace target; + +namespace program { +namespace osxcross { + +int man(int argc, char **argv, Target &target) { + std::string SDKPath; + target.getSDKPath(SDKPath); + std::string manpath = SDKPath + "/usr/share/man"; + + if (!dirExists(manpath)) { + err << "directory '" << manpath << "' does not exist" << err.endl(); + return 1; + } + + std::vector args; + + args.push_back(const_cast("man")); + args.push_back(const_cast("--manpath")); + args.push_back(const_cast(manpath.c_str())); + + for (int i = 1; i < argc; ++i) + args.push_back(argv[i]); + + args.push_back(nullptr); + + execvp(args[0], args.data()); + err << "cannot execute '" << args[0] << "'" << err.endl(); + return 1; +} + +} // namespace osxcross +} // namespace program diff --git a/wrapper/programs/xcrun.cpp b/wrapper/programs/xcrun.cpp index 24ce0e6..e9ede49 100644 --- a/wrapper/programs/xcrun.cpp +++ b/wrapper/programs/xcrun.cpp @@ -32,14 +32,6 @@ namespace program { static bool showCommand = false; -bool getSDKPath(Target &target, std::string &SDKPath) { - if (!target.getSDKPath(SDKPath)) { - err << "xcrun: cannot find MacOSX SDK" << err.endl(); - return false; - } - return true; -} - bool getToolPath(Target &target, std::string &toolpath, const char *tool) { toolpath = target.execpath; toolpath += "/"; @@ -127,7 +119,7 @@ int run(Target &target, char **argv) { int showSDKPath(Target &target, char **) { std::string SDKPath; - if (!getSDKPath(target, SDKPath)) + if (!target.getSDKPath(SDKPath)) return 1; std::cout << SDKPath << std::endl; return 0; diff --git a/wrapper/progs.h b/wrapper/progs.h index 9d1b660..4777ffa 100644 --- a/wrapper/progs.h +++ b/wrapper/progs.h @@ -82,6 +82,7 @@ int version(); int env(int argc, char **argv); int conf(Target &target); int cmp(int argc, char **argv); +int man(int argc, char **argv, Target &target); int pkg_config(int argc, char **argv, Target &target); } // namespace osxcross @@ -94,6 +95,7 @@ constexpr prog programs[] = { { "sw_vers", sw_vers }, { "osxcross-env", osxcross::env }, { "osxcross-conf", osxcross::conf }, { "osxcross-cmp", osxcross::cmp }, + { "osxcross-man", osxcross::man }, { "pkg-config", osxcross::pkg_config }, { "wrapper", dummy } }; diff --git a/wrapper/target.cpp b/wrapper/target.cpp index 8eef5fe..39e727e 100644 --- a/wrapper/target.cpp +++ b/wrapper/target.cpp @@ -56,7 +56,14 @@ bool Target::getSDKPath(std::string &path) const { path += "u"; path += ".sdk"; - return dirExists(path); + + if (!dirExists(path)) { + err << "cannot find Mac OS X SDK (expected in: " << path << ")" + << err.endl(); + return false; + } + + return true; } bool Target::getMacPortsDir(std::string &path) const { @@ -429,11 +436,8 @@ bool Target::setup() { if (!isKnownCompiler()) warn << "unknown compiler '" << compilername << "'" << warn.endl(); - if (!getSDKPath(SDKPath)) { - err << "cannot find Mac OS X SDK (expected in: " << SDKPath << ")" - << err.endl(); + if (!getSDKPath(SDKPath)) return false; - } if (targetarch.empty()) targetarch.push_back(arch); diff --git a/wrapper/wrapper.project b/wrapper/wrapper.project index 25f4d51..8961c3d 100644 --- a/wrapper/wrapper.project +++ b/wrapper/wrapper.project @@ -36,6 +36,7 @@ +