[README] Update for 1.2.0 Release.
[darwin-xtools.git] / README.md
blob19018e791d0802e2d605754be67c7691f4ef1ad0
1 WHAT
2 ====
4 This is a project that collects together several Open Source sub-projects from the Darwin (OS X) opensource repository (http://www.opensource.apple.com/darwinsource/)
6 **NOTE**
7   This is code has been modified, although based on the posted sources.
8   problem reports should be filed to **https://github.com/iains/darwin-xtools/issues**
9   **Please do not** file problem reports for this code to Apple.
11 The sub-projects are
12  cctools ; providing as, nm, ar, ranlib, strip, etc.
13  ld64 ; providing the static linker and some test utils.
14  dyld ; actually only used for headers
15  several stub libraries used when support is needed on older systems.
17 The principal changes common to all versions are:
19 1. Build with CMAKE
20   - I wanted to avoid a clash with the build stuff contained in the original sources
21   - This is the same approach as used for other Darwin/OS X toolchain content (i.e. LLVM)
22 2. Support for PPC/PPC64.
23   - This is a heavily modified merge of the XCode 3.2.6 ppc support + my own additions to re-introduce ppc64.
24   - The branch islanding code has been almost completely re-written and it now supports multiple code sections (which GCC emits) and works for larger binaries (e.g. a Debug version of clang).
25 3. Bug-fixes for GCC-support.
26 4. Support for the content that LLVM/Clang emit on earlier Darwin.
27   - XCode tools <= 3.2.6 do not support the macosx-version-min load command in "ar, ranlib" etc.
28   - This means Darwin9/10 (OS X 10.5/6) need updated tools to handle LLVM.
30 PRE-REQUISITES
31 ==============
33 1. cmake - I've been using 3.4.1 without issue on Darwin9...Darwin14 (OS X 10.5 +)
35 2. **A C++11 compiler**
36   - on Darwin9, 10 and probably 11 that means building a compiler...
37   - [GCC-5.3](https://github.com/iains/darwin-gcc-5) works fine and can be built using the default XCode toolchain.
39 HOW TO BUILD
40 ============
42 1. Checkout the relevant composite branch.
44 2. I usually use a script file like this:
46 cmake -C /path/to/script/file.cmake /path/to/source
48 Example for 10.6 -- you will need to modify this as relevant to your case
50 darwin-xtools-10-6.cmake:
52 ```
53 ====== 8< =======
54 # Install to here.
55 SET(CMAKE_INSTALL_PREFIX /where/you/want/it CACHE PATH "put it here")
56 SET(CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "build style")
58 SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING "OS X Version")
60 # Default install place, change if you put it somehwere different.
61 set(SDK_BASE /Developer/SDKs)
62 SET(CMAKE_OSX_SYSROOT ${SDK_BASE}/MacOSX10.6.sdk CACHE PATH "system SDK 2")
63 SET(LLVM_DEFAULT_TARGET_TRIPLE x86_64-apple-darwin10 CACHE STRING "system triple")
65 SET(compilers /path/to/c++11/compiler/bin)
66 SET(CMAKE_C_COMPILER   ${compilers}/gcc CACHE PATH "C")
67 SET(CMAKE_CXX_COMPILER ${compilers}/g++ CACHE PATH "C++")
69 SET(CMAKE_C_FLAGS    "-mmacosx-version-min=10.6 -pipe" CACHE STRING "c flags")
70 SET(CMAKE_CXX_FLAGS  "-mmacosx-version-min=10.6 -pipe" CACHE STRING "cxx flags")
72 # This leaves assertions on.
73 SET(CMAKE_C_FLAGS_MINSIZEREL  "-Os" CACHE STRING "c   opt flags")
74 SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os" CACHE STRING "cxx opt flags")
76 # If we're building with my GCC, then avoid carrying around a shared lib.
77 set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ " CACHE STRING "toolchain exe ldflags")
78 set(CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ " CACHE STRING "toolchain shlib ldflags")
80 # If your host is 64b.
81 set(XTOOLS_HOST_IS_64B YES CACHE BOOL "host native bitwidth")
83 set(XTOOLS_BUGURL "https://githb.com/iains/darwin-xtools/issues" CACHE STRING "bug url")
84 ====== >8 =======
85 ```
87 You can set these things on the cmake invocation line like
88 ```
89 cmake -DCMAKE_C_COMPILER=/path/to/compiler ... etc.
90 ```
92 (but note that, unlike autoconf-based builds, I've not found a way to retrieve the command line used to configure the package, so files can be a useful record).
94 See the cmake documentation for the version you're using.
96 3. make, make install.
97  - at present there's not a usable test-suite (although using the resulting tools to build GCC/LLVM is a fairly good test).
99 Changes
100 =======
102 1.0.1
103 ld64 has been adjusted so that FDEs which correspond to 0-sized entities are ignored rather than asserting.  If an entity is 0-sized, then it can't be a call-site or participate in unwinding (given that aliasses are handled specifically).  I guess one could say that the assert from ld64 was alerting to a problem elsewhere; however GCC was (and unpatched versions will) producing 0-sized functions for the case that the function body was elided as unreachable.  There are probably better solutions to both, but this is a reasonable one for now.
105 1.0.2
106 libtool was asserting for 'libtool -static -o arc.a file1.o .. '
107 This seems to be an over-aggressive check in sprintf when FORTIFY\_SOURCE=2.
108 "Fixed" by setting FORTIFY\_SOURCE=1
109 If \_FORTIFY\_SOURCE is set to 1, with compiler optimization level >= 1, checks that shouldn't change the behavior of conforming programs are performed.
110 At the same time, enabled DEBUG for CMAKE\_BUILD\_STYLE=Debug
112 1.1.0 - May 2016.
113 Updated to cctools-877.8 and ld64-253.9 (from XCode 7.2 sources).
115 Improved the reporting for --version to include the xtools version (and any defined
116 PACKAGE_VERSION, for packagers).  Improved --help to include a bug-report-url if
117 one is provided.
119 Added --version and --help to all the installed tools that were missing them.  This
120 should help with configuration tests.
122 1.2.0 - October 2016
123 Updated to cctools-886 and ld64-264.3.102 (from XCode 7.3.1 sources).