├── .gitattributes ├── LICENSE ├── Makefile ├── README.md ├── adasat.sh ├── aunit.sh ├── common.sh ├── fix_executable_rpaths.sh ├── fix_library_rpaths.sh ├── gcc-14.2.0-3-patches.zip ├── gcc-for-alire.sh ├── gcc.sh ├── gdb.sh ├── gmp.sh ├── gnatcoll-bindings.sh ├── gnatcoll-core.sh ├── gnatcoll-db.sh ├── gpr2.sh ├── gprbuild-for-alire.sh ├── gprbuild.sh ├── gprconfig.sh ├── langkit.sh ├── libadalang-tools.sh ├── libadalang.sh ├── make-dependencies.dot ├── make-dependencies.png ├── mpc.sh ├── mpfr.sh ├── prettier-ada.sh ├── release_notes.md ├── templates-parser.sh ├── vss.sh ├── xmlada.gpr └── xmlada.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.png binary 2 | *.zip binary 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) Simon Wright . 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the copyright holder nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to build a full GCC suite. 2 | # 3 | # The idea is to make each phase depend on the successful completion 4 | # of the previous phase. 5 | 6 | location := $(shell echo $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) \ 7 | | sed -e "s;/$$;;") 8 | 9 | # what architecture are we running? (will get arm64 or i386) 10 | current_arch = $(shell arch) 11 | 12 | # what architecture was the compiler built for? 13 | aarch64 = $(findstring aarch64, $(shell gcc -print-libgcc-file-name)) 14 | x86_64 = $(findstring x86_64, $(shell gcc -print-libgcc-file-name)) 15 | 16 | # check that the compiler matches the architecture 17 | ifeq ($(current_arch),arm64) 18 | ifeq ($(aarch64),) 19 | $(error shell is aarch64 but current gcc is not) 20 | else 21 | export ARCH=aarch64 22 | endif 23 | else 24 | ifeq ($(current_arch),i386) 25 | ifeq ($(x86_64),) 26 | $(error shell is x86_64 but current gcc is not) 27 | else 28 | export ARCH=x86_64 29 | endif 30 | else 31 | $(error unexpected architecure $(current_arch), expecting i386) 32 | endif 33 | endif 34 | 35 | # This doesn't build the -for-alire targets, or mpfr, mpc, for which 36 | # there aren't any bindings. 37 | all: basic libadalang-tools 38 | basic: aunit gnatcoll-bindings gnatcoll-db 39 | 40 | gcc: gcc-stamp 41 | .PHONY: gcc 42 | gcc-stamp: $(location)/common.sh $(location)/gcc.sh 43 | rm -f $@ 44 | -mkdir gcc 45 | (cd gcc; $(location)/gcc.sh) && touch $@ 46 | 47 | gcc-for-alire: gcc-for-alire-stamp 48 | .PHONY: gcc-for-alire 49 | gcc-for-alire-stamp: $(location)/common.sh $(location)/gcc-for-alire.sh 50 | rm -f $@ 51 | -mkdir gcc-for-alire 52 | (cd gcc-for-alire; $(location)/gcc-for-alire.sh) && touch $@ 53 | 54 | gmp: gmp-stamp 55 | .PHONY: gmp 56 | gmp-stamp: gcc-stamp $(location)/common.sh $(location)/gmp.sh 57 | rm -f $@ 58 | -mkdir gmp 59 | (cd gmp; $(location)/gmp.sh) && touch $@ 60 | 61 | mpfr: mpfr-stamp 62 | .PHONY: mpfr 63 | mpfr-stamp: gmp-stamp $(location)/common.sh $(location)/mpfr.sh 64 | rm -f $@ 65 | -mkdir mpfr 66 | (cd mpfr; $(location)/mpfr.sh) && touch $@ 67 | 68 | mpc: mpc-stamp 69 | .PHONY: mpc 70 | mpc-stamp: mpfr-stamp $(location)/common.sh $(location)/mpc.sh 71 | rm -f $@ 72 | -mkdir mpc 73 | (cd mpc; $(location)/mpc.sh) && touch $@ 74 | 75 | gprconfig: gprconfig-stamp 76 | .PHONY: gprconfig 77 | gprconfig-stamp: gcc-stamp $(location)/common.sh $(location)/gprconfig.sh 78 | rm -f $@ 79 | -mkdir gprconfig 80 | (cd gprconfig; $(location)/gprconfig.sh) && touch $@ 81 | 82 | xmlada: xmlada-stamp 83 | .PHONY: xmlada 84 | # xmlada gets built by the build compiler 85 | xmlada-stamp: gprconfig-stamp $(location)/common.sh $(location)/xmlada.sh 86 | rm -f $@ 87 | -mkdir xmlada 88 | (cd xmlada; $(location)/xmlada.sh) && touch $@ 89 | 90 | gprbuild: gprbuild-stamp 91 | .PHONY: gprbuild 92 | gprbuild-stamp: xmlada-stamp gprconfig-stamp $(location)/common.sh $(location)/gprbuild.sh 93 | rm -f $@ 94 | -mkdir gprbuild 95 | (cd gprbuild; $(location)/gprbuild.sh) && touch $@ 96 | 97 | gprbuild-for-alire: gprbuild-for-alire-stamp 98 | .PHONY: gprbuild-for-alire 99 | # The script installs gprconfig itself. 100 | gprbuild-for-alire-stamp: gcc-for-alire-stamp \ 101 | $(location)/common.sh $(location)/gprbuild-for-alire.sh \ 102 | $(location)/xmlada.gpr 103 | rm -f $@ 104 | -mkdir gprbuild-for-alire 105 | (cd gprbuild-for-alire; $(location)/gprbuild-for-alire.sh) && touch $@ 106 | 107 | aunit: aunit-stamp 108 | .PHONY: aunit 109 | aunit-stamp: gprbuild-stamp $(location)/common.sh $(location)/aunit.sh 110 | rm -f $@ 111 | -mkdir aunit 112 | (cd aunit; $(location)/aunit.sh) && touch $@ 113 | 114 | gnatcoll-core: gnatcoll-core-stamp 115 | .PHONY: gnatcoll-core 116 | gnatcoll-core-stamp: gprbuild-stamp $(location)/common.sh $(location)/gnatcoll-core.sh 117 | rm -f $@ 118 | -mkdir gnatcoll-core 119 | (cd gnatcoll-core; $(location)/gnatcoll-core.sh) && touch $@ 120 | 121 | gnatcoll-bindings: gnatcoll-bindings-stamp 122 | .PHONY: gnatcoll-bindings 123 | gnatcoll-bindings-stamp: gmp-stamp gnatcoll-core-stamp $(location)/common.sh $(location)/gnatcoll-bindings.sh 124 | rm -f $@ 125 | -mkdir gnatcoll-bindings 126 | (cd gnatcoll-bindings; $(location)/gnatcoll-bindings.sh) && touch $@ 127 | 128 | gnatcoll-db: gnatcoll-db-stamp 129 | .PHONY: gnatcoll-db 130 | gnatcoll-db-stamp: gnatcoll-core-stamp $(location)/common.sh $(location)/gnatcoll-db.sh 131 | rm -f $@ 132 | -mkdir gnatcoll-db 133 | (cd gnatcoll-db; $(location)/gnatcoll-db.sh) && touch $@ 134 | 135 | adasat: adasat-stamp 136 | .PHONY: adasat 137 | adasat-stamp: gprbuild-stamp $(location)/common.sh $(location)/adasat.sh 138 | rm -f $@ 139 | -mkdir adasat 140 | (cd adasat; $(location)/adasat.sh) && touch $@ 141 | 142 | prettier-ada: prettier-ada-stamp 143 | .PHONY: prettier-ada 144 | prettier-ada-stamp: gprbuild-stamp gnatcoll-core-stamp vss-stamp $(location)/common.sh $(location)/prettier-ada.sh 145 | rm -f $@ 146 | -mkdir prettier-ada 147 | (cd prettier-ada; $(location)/prettier-ada.sh) && touch $@ 148 | 149 | langkit: langkit-stamp 150 | .PHONY: langkit 151 | langkit-stamp: gprbuild-stamp adasat-stamp $(location)/common.sh $(location)/langkit.sh 152 | rm -f $@ 153 | -mkdir langkit 154 | (cd langkit; $(location)/langkit.sh) && touch $@ 155 | 156 | gpr2: gpr2-stamp 157 | .PHONY: gpr2 158 | gpr2-stamp: langkit-stamp $(location)/common.sh $(location)/gpr2.sh 159 | rm -f $@ 160 | -mkdir gpr2 161 | (cd gpr2; $(location)/gpr2.sh) && touch $@ 162 | 163 | libadalang: libadalang-stamp 164 | .PHONY: libadalang 165 | libadalang-stamp: \ 166 | gnatcoll-bindings-stamp \ 167 | adasat-stamp \ 168 | langkit-stamp \ 169 | gpr2-stamp \ 170 | $(location)/common.sh $(location)/libadalang.sh 171 | rm -f $@ 172 | -mkdir libadalang 173 | (cd libadalang; $(location)/libadalang.sh) && touch $@ 174 | 175 | templates-parser: templates-parser-stamp 176 | .PHONY: templates-parser 177 | templates-parser-stamp: gprbuild-stamp $(location)/common.sh $(location)/templates-parser.sh 178 | rm -f $@ 179 | -mkdir templates-parser 180 | (cd templates-parser; $(location)/templates-parser.sh) && touch $@ 181 | 182 | vss: vss-stamp 183 | .PHONY: vss 184 | vss-stamp: gprbuild-stamp $(location)/common.sh $(location)/vss.sh 185 | rm -f $@ 186 | -mkdir vss 187 | (cd vss; $(location)/vss.sh) && touch $@ 188 | 189 | libadalang-tools: libadalang-tools-stamp 190 | .PHONY: libadalang-tools 191 | libadalang-tools-stamp: libadalang-stamp templates-parser-stamp vss-stamp $(location)/common.sh $(location)/libadalang-tools.sh 192 | rm -f $@ 193 | -mkdir libadalang-tools 194 | (cd libadalang-tools; $(location)/libadalang-tools.sh) && touch $@ 195 | 196 | #################################### 197 | 198 | images : make-dependencies.png 199 | 200 | %.png: %.dot 201 | dot -o $@ -T png $< 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Building GCC for macOS # 2 | 3 | This set of scripts supports building GCC Ada, or GNAT, on macOS as a native compiler, and then its supporting tools. 4 | 5 | `python3` is required. If not installed, you can download a binary from [python.org](https://www.python.org). 6 | 7 | ## Ready-built binaries 8 | If you are simply interested in the resulting builds you can check out the releases of [simonjwright/distributing-gcc](https://github.com/simonjwright/distributing-gcc/releases). 9 | 10 | ## Building ## 11 | 12 | Building is done in a set of shell scripts. The scripts are to some extent order-dependent, and this is catered for here by a Makefile. 13 | 14 | The Makefile's targets are shown in the diagram (_all_ and _basic_ are organisational, _basic_ builds everything except the _libadalang_-related components). 15 | ![Dependencies](make-dependencies.png) 16 | 17 | Also, to support in particular `aarch64` builds of the two compiler components for Alire, 18 | * `gcc-for-alire` 19 | * `gprbuild-for-alire` 20 | 21 | The scripts are named by adding `.sh` to the target. 22 | 23 | Additionally, the script `gdb.sh` builds GDB (not useful on aarch64?) 24 | 25 | ### Building ### 26 | 27 | The common information is in [`common.sh`](common.sh), which is sourced by the other scripts and sets environment variables. Please study `common.sh` and edit for your circumstances. 28 | 29 | ### Building on Apple silicon ### 30 | 31 | Building for `aarch64` is natural. Building for `x86_64` requires a little more work. 32 | 33 | The Software Development Kits (SDKs) support both architectures. Once you have an `x86_64` compiler, you don't need to worry about this (fingers crossed), but for the GCC build you have to be running an `x86_64` shell: 34 | ``` 35 | arch -x86_64 /bin/bash 36 | ``` 37 | (you may need to set some environment variables, expecially the `PATH` that picks up the build compiler). 38 | 39 | ### Making ### 40 | 41 | Some variables can be overridden during the `make` invocation: 42 | * `VERSION`, e.g. `14.2.0-3` - the default is `14.2.0`. This controls where the built components are installed. 43 | * `BOOTSTRAP`, e.g. `disable` - the default is `enable`; this controls the GCC build via the `configure` option `--$BOOTSTRAP-bootstrap`. 44 | 45 | Assuming you've got this directory in `~/building-gcc-macos-native`, all your source code in ~/gcc-src/package-src, `common.sh` is set up,and you're going to build just `gprbuild` under `~/tmp/arch64`, you would say in `~/tmp/aarch64` 46 | ``` 47 | make -f ~/building-gcc-macos-native/Makefile gprbuild \ 48 | VERSION=14.2.0-3 BOOTSTRAP=disable 49 | ``` 50 | The individual components will appear in `gcc/`, `gprconfig/`, `xmlada/` and `gprbuild/`. 51 | 52 | ### Additional considerations for sources ### 53 | 54 | * GCC relies on external maths libraries. To download and set them up, go to the top level of the GCC source directory and say 55 | ``` 56 | contrib/download_prerequisites 57 | ``` 58 | * *XML/Ada* requires *gprbuild*. In order to have built GCC, you must have had a compatible GNAT on your `PATH` already. Assuming that that GNAT contains a *gprbuild*, that should do (for example, the GCC 14.1.0 *XML/Ada* built OK with the GCC 13.1.0 *gprbuild*). If not, check out `bootstrap.sh` in the *gprbuild* sources. 59 | * `gprbuild`: update `{gprbuild}/gpr/src/gpr-version.ads` to match the current release state. 60 | * `gnatmetric`, `gnatpp`, `gnatstub`, `gnattest`: update `{libadalang-tools}/src/utils-versions.ads` likewise. 61 | * `libadalang` and `langkit` sources need to be kept synchronised. 62 | -------------------------------------------------------------------------------- /adasat.sh: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | PATH=$NEW_PATH 8 | 9 | ( 10 | library_types="static static-pic relocatable" 11 | 12 | cd $ADASAT_SRC 13 | 14 | for type in $library_types; do 15 | make clean LIBRARY_TYPE=$type BUILD_MODE=prod 16 | done 17 | 18 | make all-libs BUILD_MODE=prod 19 | 20 | for type in $library_types; do 21 | make install INSTALL_DIR=$PREFIX LIBRARY_TYPE=$type BUILD_MODE=prod 22 | done 23 | ) 24 | -------------------------------------------------------------------------------- /aunit.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | make -w -j$CORES \ 8 | -C $AUNIT_SRC \ 9 | clean all 10 | 11 | make -w \ 12 | -C $AUNIT_SRC \ 13 | install 14 | -------------------------------------------------------------------------------- /common.sh: -------------------------------------------------------------------------------- 1 | # Ensure the GCC source tree already has required versions of GMP, 2 | # MPFR, MPC installed via contrib/download_prerequisites. 3 | 4 | set -eu 5 | 6 | VERSION=${VERSION:=14.2.0} 7 | BUILD=$ARCH-apple-darwin23 8 | BOOTSTRAP=${BOOTSTRAP:=enable} # or disable 9 | 10 | SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)} 11 | PYTHON=/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 12 | CORES=$(sysctl -n hw.ncpu) 13 | 14 | # Exported so GCC sees it while compiling/linking: Monterey 15 | export MACOSX_DEPLOYMENT_TARGET=14 16 | 17 | # Everything is under this directory (it's an external USB disk, named 18 | # Miscellaneous3). I do the builds on this disk, too, with the thought 19 | # that it should reduce wear on the system disk. 20 | TOP=/Volumes/Miscellaneous3 21 | 22 | ###################################################################### 23 | # Where's the build going to be targeted? 24 | # There are various possibilities, which, if set, will override the 25 | # default. 26 | 27 | # Override the default version if necessary 28 | # PREFIX=/opt/gcc-$VERSION-20232226-$ARCH 29 | 30 | # For gcc-for-alire, gprbuild-for-alire 31 | # PREFIX=$TOP/alire-$ARCH/gcc 32 | 33 | # To keep the build away from the eventual target (this assumes the 34 | # code is relocatable! which, now, it is. 35 | PREFIX=${PREFIX:-$TOP/$ARCH/gcc-$VERSION-$ARCH} 36 | 37 | # The default version (e.g. /opt-gcc-13.2.0-x86_64) is overridable. 38 | PREFIX=${PREFIX:-/opt/gcc-$VERSION-$ARCH} 39 | ###################################################################### 40 | 41 | ###################################################################### 42 | # Where is the source stored? 43 | 44 | #This assumes that all the source has been extracted under the one 45 | # directory. 46 | SRC_PATH=$TOP/src 47 | 48 | #--------------------------------------------------------------------- 49 | # GCC source; there are lots of compiler options. 50 | 51 | # Building gcc-mirror 52 | # releases/gcc-14 53 | # GCC_SRC=$SRC_PATH/gcc 54 | 55 | # Building gcc-13 for aarch64; the actual tag in that clone is 56 | # gcc-13-3-darwin-r0 !!! 57 | # GCC_SRC=$SRC_PATH/gcc-13-branch 58 | 59 | # Building gcc-14 for aarch64; the actual branch in that clone is 60 | # gcc-14-2-darwin-r2 61 | # GCC_SRC=$SRC_PATH/gcc-14-branch 62 | 63 | # Building iains's WIP for aarch64 64 | # This is 15.0.1. 65 | GCC_SRC=$SRC_PATH/gcc-darwin-arm64 66 | 67 | # Building the latest FSF snapshot 68 | # SNAPSHOT=gcc-15-20241110 69 | # GCC_SRC=$SRC_PATH/$SNAPSHOT 70 | 71 | # Building FSF 14.2.0 72 | # GCC_SRC=$SRC_PATH/gcc-14.2.0 73 | 74 | # The default for an FSF releaase 75 | GCC_SRC=${GCC_SRC:-$SRC_PATH/gcc-$VERSION} 76 | #--------------------------------------------------------------------- 77 | 78 | #--------------------------------------------------------------------- 79 | # Pick up the new compiler for building all the other components 80 | NEW_PATH=$PREFIX/bin:$PATH 81 | #--------------------------------------------------------------------- 82 | 83 | #--------------------------------------------------------------------- 84 | # Where all the other component sources are to be found. I use Git 85 | # clones mostly, in case I need to patch them, but you may prefer to 86 | # use releases. As an example, gnatcoll-db's 23.0.0 release unpacks to 87 | # gnatcoll-db-23.0.0/, whereas a clone would naturally unpack to just 88 | # gnatcoll-db/ as below. 89 | ADASAT_SRC=$SRC_PATH/AdaSAT 90 | AUNIT_SRC=$SRC_PATH/aunit 91 | GDB_SRC=$SRC_PATH/binutils-gdb 92 | GNATCOLL_BINDINGS_SRC=$SRC_PATH/gnatcoll-bindings 93 | GNATCOLL_CORE_SRC=$SRC_PATH/gnatcoll-core 94 | GNATCOLL_DB_SRC=$SRC_PATH/gnatcoll-db 95 | GPR2_SRC=$SRC_PATH/gpr 96 | GPRBUILD_SRC=$SRC_PATH/gprbuild 97 | GPRCONFIG_SRC=$SRC_PATH/gprconfig_kb 98 | LANGKIT_SRC=$SRC_PATH/langkit 99 | LIBADALANG_SRC=$SRC_PATH/libadalang 100 | LIBADALANG_TOOLS_SRC=$SRC_PATH/libadalang-tools 101 | PRETTIER_ADA_SRC=$SRC_PATH/prettier-ada 102 | TEMPLATES_PARSER_SRC=$SRC_PATH/templates-parser 103 | VSS_SRC=$SRC_PATH/VSS 104 | XMLADA_SRC=$SRC_PATH/xmlada 105 | #--------------------------------------------------------------------- 106 | 107 | ###################################################################### 108 | -------------------------------------------------------------------------------- /fix_executable_rpaths.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # because of the wierd reading of the lines array at the end. 3 | 4 | # This script takes one parameter, the file name of an executable. 5 | # 6 | # The executable contains paths to the dynamic libraries (dylibs) 7 | # which it uses (dependencies), so that the dylib can be found at run 8 | # time. 9 | # 10 | # Clearly the path can be just the full name of the dylib (as it will 11 | # be after installation), but this will likely cause problems if the 12 | # distribution tree gets relocated. 13 | # 14 | # To avoid this, Darwin provides the symbolic names @executable_path 15 | # and @rpath. 16 | 17 | # If an executable requires a dynamic library, it'll be tagged by its 18 | # identity (id), as determined when the library was built. By default, 19 | # that'll be the path name of the library; alternatively, it can be 20 | # e.g. '@rpath/libfoo.dylib', which tells the loader to look for the 21 | # library along the 'run path' baked into the executable at build 22 | # time. 23 | # 24 | # All well and good, until the suite is moved. The standard solution 25 | # does require that the whole suite, executables and dylibs, be moved 26 | # as a unit. 27 | # 28 | # GNAT builds libraries and executables using @rpath: in some cases 29 | # GCC doesn't. 30 | # 31 | # Names are manipulated using the install_name_tool. For dependencies, 32 | # the syntax is 33 | # 34 | # install_name_tool \ 35 | # -change installed_path/libfoo.dylib @rpath/libfoo.dylib \ 36 | # executable 37 | # 38 | # The run path in the executable can be added to by the 39 | # install_name_tool switch -add_rpath. What we need to link are the 40 | # lib/ and adalib/ directories: e.g. 41 | # 42 | # install_name_tool -add_rpath @executable_path/../lib executable 43 | # 44 | # where @executable_path translates to the directory from which 45 | # 'executable' was loaded. 46 | # 47 | 48 | set -eu 49 | 50 | script_loc=`cd $(dirname $0) && pwd -P` 51 | 52 | . $script_loc/common.sh 53 | 54 | ########################## 55 | 56 | function handle_dependency () { 57 | # $1 is the full nane of the depended-on dylib 58 | if [[ $1 == *$PREFIX* ]]; then 59 | base_name=$(basename $1) 60 | echo "install_name_tool -change $1 @rpath/$base_name $target_file" 61 | eval "install_name_tool -change $1 @rpath/$base_name $target_file" 62 | fi 63 | } 64 | ########################## 65 | 66 | function set_rpath () { 67 | # $1 is the name of the executable 68 | adalib=$(cd $PREFIX; find lib -type d -name adalib) 69 | echo "install_name_tool -add_rpath @executable_path/../lib $1" 70 | install_name_tool -add_rpath @executable_path/../lib $1 71 | echo "install_name_tool -add_rpath @executable_path/../$adalib $1" 72 | install_name_tool -add_rpath @executable_path/../$adalib $1 73 | } 74 | 75 | ########################## 76 | 77 | set_rpath $1 78 | 79 | unset -v lines 80 | 81 | target_file=$1 82 | 83 | while IFS= read -r; do 84 | lines+=("$REPLY") 85 | done < <(otool -L $target_file) 86 | 87 | for line in "${lines[@]:1:${#lines[@]}}"; do 88 | handle_dependency "$(echo $line | cut -d " " -f1)" 89 | done 90 | 91 | -------------------------------------------------------------------------------- /fix_library_rpaths.sh: -------------------------------------------------------------------------------- 1 | # This script takes one parameter, the file name of a dynamic library 2 | # (dylib). 3 | # 4 | # The dylib contains two kinds of naming information: its 5 | # identification, and paths to the other dylibs which it uses 6 | # (dependencies). The identification is what is used when building 7 | # another dylib or an executable so that this dylib can be found at 8 | # run time. 9 | # 10 | # Clearly the identification can be just the file name of the dylib 11 | # (as it will be after installation), but this will likely cause 12 | # problems if the distribution tree gets relocated. To avoid this, 13 | # Darwin provides the name @rpath (e.g. @rpath/libfoo.dylib) which 14 | # means that relative path information is baked into the executable as 15 | # it is built, and used at run time to find the actual location of the 16 | # dylib. This does require that the whole suite, executabls and 17 | # dylibs, be moved as a unit. 18 | # 19 | # GNAT builds libraries using @rpath: GCC doesn't. 20 | # 21 | # Names are manipulated using the install_name_tool. For 22 | # identification, the syntax is 23 | # 24 | # install_name_tool -id @rpath/libfoo.dylib current_path/foo.dylib 25 | # 26 | # and for dependencies 27 | # 28 | # install_name_tool \ 29 | # -change installed_path/libfoo.dylib @rpath/libfoo.dylib \ 30 | # current_path/foo.dylib 31 | 32 | set -eu 33 | 34 | script_loc=`cd $(dirname $0) && pwd -P` 35 | 36 | . $script_loc/common.sh 37 | 38 | ########################## 39 | 40 | # This is used for dylibs only. 41 | function handle_identification () { 42 | # $1 is the dylib's identification name. 43 | if [[ $1 == *$PREFIX* ]]; then 44 | base_name=$(basename $1) 45 | echo "install_name_tool -id @rpath/$base_name $target_file" 46 | eval "install_name_tool -id @rpath/$base_name $target_file" 47 | fi 48 | } 49 | 50 | # This can be used for dylibs and executables. 51 | function handle_dependency () { 52 | # $1 is the full nane of the depended-on dylib 53 | if [[ $1 == *$PREFIX* ]]; then 54 | base_name=$(basename $1) 55 | echo "install_name_tool -change $1 @rpath/$base_name $target_file" 56 | eval "install_name_tool -change $1 @rpath/$base_name $target_file" 57 | fi 58 | } 59 | 60 | ########################## 61 | 62 | target_file=$1 63 | 64 | lines=() 65 | while IFS= read -r; do 66 | lines+=("$REPLY") 67 | done < <(otool -L $target_file) 68 | 69 | echo "id line: ${lines[1]}" 70 | 71 | handle_identification "$(echo ${lines[1]} | cut -d " " -f1)" 72 | 73 | for line in "${lines[@]:2:${#lines[@]}}"; do 74 | handle_dependency "$(echo $line | cut -d " " -f1)" 75 | done 76 | 77 | -------------------------------------------------------------------------------- /gcc-14.2.0-3-patches.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simonjwright/building-gcc-macos-native/555d083f046762cc589a63aabbe7d9a48ddff338/gcc-14.2.0-3-patches.zip -------------------------------------------------------------------------------- /gcc-for-alire.sh: -------------------------------------------------------------------------------- 1 | # Build using extant GCC. 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | XCODE=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk 8 | CLT=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk 9 | 10 | BUGURL=https://github.com/simonjwright/building-gcc-macos-native 11 | 12 | echo "BUILDING THE COMPILER IN $PREFIX" 13 | 14 | set -eu 15 | rm -rf * 16 | 17 | $GCC_SRC/configure \ 18 | --prefix=$PREFIX/gcc \ 19 | --enable-languages=c,c++,ada \ 20 | --build=$BUILD \ 21 | --with-sysroot=$SDKROOT/../MacOSX14.sdk \ 22 | --with-specs="%{!-sysroot:--sysroot=%:if-exists-else($XCODE $CLT)}" \ 23 | --with-bugurl=$BUGURL \ 24 | --$BOOTSTRAP-bootstrap 25 | 26 | # CFLAGS=-Wno-deprecated-declarations \ 27 | # CXXFLAGS=-Wno-deprecated-declarations 28 | 29 | make -w -j$CORES 30 | 31 | make -w -j$CORES install 32 | -------------------------------------------------------------------------------- /gcc.sh: -------------------------------------------------------------------------------- 1 | # Build using extant GCC. 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | XCODE=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk 8 | CLT=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk 9 | 10 | BUGURL=https://github.com/simonjwright/building-gcc-macos-native 11 | 12 | echo "BUILDING THE COMPILER IN $PREFIX" 13 | 14 | set -eu 15 | rm -rf * 16 | 17 | $GCC_SRC/configure \ 18 | --prefix=$PREFIX \ 19 | --enable-languages=c,c++,ada \ 20 | --build=$BUILD \ 21 | --with-sysroot=$SDKROOT/../MacOSX14.sdk \ 22 | --with-specs="%{!-sysroot:--sysroot=%:if-exists-else($XCODE $CLT)}" \ 23 | --with-bugurl=$BUGURL \ 24 | --$BOOTSTRAP-bootstrap 25 | 26 | make -w -j$CORES 27 | 28 | make -w -j$CORES install 29 | -------------------------------------------------------------------------------- /gdb.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | $GDB_SRC/configure \ 8 | --build=$BUILD \ 9 | --prefix=$PREFIX \ 10 | --disable-werror 11 | 12 | make -w all -j$CORES 13 | 14 | cd gdb 15 | make install 16 | -------------------------------------------------------------------------------- /gmp.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | rm -rf * 8 | 9 | $GCC_SRC/gmp/configure \ 10 | --prefix=$PREFIX \ 11 | --host=$BUILD \ 12 | --target=$BUILD \ 13 | --build=$BUILD \ 14 | --enable-cxx \ 15 | --enable-shared \ 16 | M4=gm4 17 | 18 | make -w -j$CORES 19 | 20 | for lib in .libs/*.dylib; do 21 | if [[ $(file $lib) == *shared\ library* ]]; then 22 | bash $script_loc/fix_library_rpaths.sh $lib 23 | fi 24 | done 25 | 26 | make install 27 | -------------------------------------------------------------------------------- /gnatcoll-bindings.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | export C_INCLUDE_PATH=$PREFIX/include 7 | export CPLUS_INCLUDE_PATH=$PREFIX/include 8 | 9 | cd $GNATCOLL_BINDINGS_SRC 10 | 11 | binding="gmp iconv lzma omp python3 readline syslog zlib" 12 | 13 | # Reduce from the full list because: 14 | # o We can't do LZMA, because macOS doesn't support the multithreading 15 | # option and the GNATCOLL code doesn't make it optional. 16 | # o There's a Python (probably 3.10) issue with omp, "Object of type 17 | # bytes is not JSON serializable." 18 | binding="gmp iconv python3 readline syslog zlib" 19 | 20 | for bnd in $binding; do 21 | (cd $bnd 22 | set -eu 23 | rm -f setup.json 24 | find . -name \*.o | xargs rm 25 | $PYTHON ./setup.py clean 26 | case $bnd in 27 | readline) 28 | $PYTHON ./setup.py build --accept-gpl --reconfigure 29 | ;; 30 | *) 31 | $PYTHON ./setup.py build --reconfigure 32 | ;; 33 | esac 34 | $PYTHON ./setup.py install 35 | ) 36 | done 37 | -------------------------------------------------------------------------------- /gnatcoll-core.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | for prj in minimal core projects; do 8 | $GNATCOLL_CORE_SRC/$prj/gnatcoll_$prj.gpr.py \ 9 | build \ 10 | --jobs 0 \ 11 | --prefix $PREFIX \ 12 | --enable-constant-updates \ 13 | --install 14 | done 15 | 16 | cp $GNATCOLL_CORE_SRC/gnatcoll.gpr $PREFIX/share/gpr/ 17 | -------------------------------------------------------------------------------- /gnatcoll-db.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | START=$PWD 6 | 7 | PATH=$NEW_PATH 8 | 9 | cd $GNATCOLL_DB_SRC 10 | 11 | components="sql sqlite xref gnatinspect gnatcoll_db2ada" 12 | 13 | for cmp in $components; do 14 | make -w -C $cmp setup prefix=$PREFIX BUILD=PROD TARGET=$BUILD 15 | make -w -j$CORES -C $cmp clean build 16 | make -w -C $cmp install 17 | done 18 | -------------------------------------------------------------------------------- /gpr2.sh: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | PATH=$NEW_PATH 8 | 9 | make -f $GPR2_SRC/Makefile \ 10 | prefix=$PREFIX \ 11 | ENABLE_SHARED=yes \ 12 | GPR2_BUILD=release \ 13 | PROCESSORS=0 \ 14 | PROFILER=no \ 15 | LOCAL_GPR2=yes \ 16 | GPR2KBDIR=$GPRCONFIG_SRC/db \ 17 | setup 18 | 19 | make -w -j$CORES -f $GPR2_SRC/Makefile build-libs 20 | 21 | make -w -f $GPR2_SRC/Makefile install-libs 22 | -------------------------------------------------------------------------------- /gprbuild-for-alire.sh: -------------------------------------------------------------------------------- 1 | # Build and install gprconfig & gprbuild (but not libgpr) for use in 2 | # Alire, using an existing compiler on PATH. 3 | 4 | script_loc=`cd $(dirname $0) && pwd -P` 5 | 6 | . $script_loc/common.sh 7 | 8 | # Build next to gcc. 9 | # The Alire-downloadable archive needs to have gprbuild/ as its top level. 10 | GPRBUILD_PREFIX=$PREFIX/../gprbuild 11 | 12 | # Install gprconfig first. 13 | 14 | gprconfig_install_loc=$GPRBUILD_PREFIX/share/gprconfig 15 | 16 | mkdir -p $gprconfig_install_loc 17 | 18 | cp -p $GPRCONFIG_SRC/db/* $gprconfig_install_loc/ 19 | 20 | rm -rf * 21 | 22 | # Use the compiler we've already built. 23 | PATH=$NEW_PATH 24 | 25 | echo "*** cleaning ***" 26 | make -w -f $GPRBUILD_SRC/Makefile \ 27 | TARGET=$BUILD \ 28 | ENABLE_SHARED=no \ 29 | clean || true # otherwise, fail because there's no Fortran 30 | 31 | echo "*** setting up ***" 32 | make -w -f $GPRBUILD_SRC/Makefile \ 33 | TARGET=$BUILD \ 34 | ENABLE_SHARED=no \ 35 | setup 36 | 37 | echo "*** building ***" 38 | make -w -j$CORES \ 39 | -f $GPRBUILD_SRC/Makefile \ 40 | all 41 | 42 | echo "*** installing ***" 43 | make -w \ 44 | -f $GPRBUILD_SRC/Makefile \ 45 | prefix=$GPRBUILD_PREFIX \ 46 | install 47 | 48 | # Remove the highly-misleading script installed in the top-level directory. 49 | rm -f $GPRBUILD_PREFIX/doinstall 50 | -------------------------------------------------------------------------------- /gprbuild.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | rm -rf * 8 | 9 | echo "*** cleaning ***" 10 | make -w -f $GPRBUILD_SRC/Makefile \ 11 | TARGET=$BUILD \ 12 | ENABLE_SHARED=yes \ 13 | clean || true # otherwise, fail because there's no Fortran 14 | 15 | echo "*** setting up ***" 16 | make -w -f $GPRBUILD_SRC/Makefile \ 17 | TARGET=$BUILD \ 18 | ENABLE_SHARED=yes \ 19 | setup 20 | 21 | echo "*** building ***" 22 | make -w -j$CORES \ 23 | -f $GPRBUILD_SRC/Makefile \ 24 | all 25 | 26 | echo "*** building libgpr ***" 27 | make -w -j$CORES \ 28 | -f $GPRBUILD_SRC/Makefile \ 29 | libgpr.build 30 | 31 | echo "*** installing ***" 32 | make -w \ 33 | -f $GPRBUILD_SRC/Makefile \ 34 | install 35 | 36 | echo "*** installing libgpr ***" 37 | make -w \ 38 | -f $GPRBUILD_SRC/Makefile \ 39 | libgpr.install 40 | 41 | # Remove the highly-misleading script installed in the top-level directory. 42 | rm -f $PREFIX/doinstall 43 | -------------------------------------------------------------------------------- /gprconfig.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | install_loc=$PREFIX/share/gprconfig 6 | 7 | mkdir -p $install_loc 8 | 9 | cp -p $GPRCONFIG_SRC/db/* $install_loc/ 10 | -------------------------------------------------------------------------------- /langkit.sh: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | PATH=$NEW_PATH 8 | 9 | rm -rf venv 10 | $PYTHON -m venv venv 11 | 12 | source venv/bin/activate 13 | pip install --upgrade pip 14 | 15 | ( 16 | cd $LANGKIT_SRC 17 | 18 | # Don't really want to clone adasat at possibly-different version. 19 | rm -rf langkit/adasat 20 | ln -s $ADASAT_SRC langkit/adasat 21 | 22 | rm -rf build 23 | 24 | pip install -r requirements-pypi.txt 25 | 26 | pip install . 27 | 28 | python \ 29 | manage.py \ 30 | make \ 31 | --no-mypy \ 32 | --generate-auto-dll-dirs \ 33 | --build-mode=prod \ 34 | --library-types relocatable,static-pic,static \ 35 | --gargs '-cargs -fPIC' 36 | 37 | # no --force in install-langkit-support 38 | gprinstall --prefix=$PREFIX --uninstall langkit_support || true 39 | 40 | python manage.py \ 41 | install-langkit-support \ 42 | --build-mode=prod \ 43 | --library-types relocatable,static-pic,static \ 44 | $PREFIX 45 | 46 | ( 47 | cd contrib/python \ 48 | 49 | # manage.py install --force doesn't work 50 | gprinstall --prefix=$PREFIX --uninstall libpythonlang || true 51 | 52 | python \ 53 | ./manage.py \ 54 | install \ 55 | --force \ 56 | $PREFIX \ 57 | --library-types=relocatable,static-pic,static \ 58 | --build-mode=prod \ 59 | --disable-all-mains 60 | ) 61 | 62 | pip install contrib/python/build/python 63 | 64 | ( 65 | cd contrib/lkt 66 | 67 | # manage.py install --force doesn't work 68 | gprinstall --prefix=$PREFIX --uninstall liblktlang || true 69 | 70 | python \ 71 | ./manage.py \ 72 | install \ 73 | --force \ 74 | $PREFIX \ 75 | --library-types=relocatable,static-pic,static \ 76 | --build-mode=prod \ 77 | --disable-all-mains 78 | ) 79 | 80 | pip install contrib/lkt/build/python 81 | 82 | ) 83 | 84 | deactivate 85 | -------------------------------------------------------------------------------- /libadalang-tools.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | # N.B. the upstream Makefile isn't a reference for good practice! 8 | 9 | # Have to use BUILD_MODE=prod to avoid a warning-treated-as-error 10 | 11 | make -w -C $LIBADALANG_TOOLS_SRC \ 12 | BUILD_MODE=prod \ 13 | clean 14 | 15 | gprinstall --prefix=$PREFIX --uninstall lal_tools || true 16 | 17 | make -w -j$CORES -C $LIBADALANG_TOOLS_SRC \ 18 | BUILD_MODE=prod \ 19 | lib 20 | 21 | make -w -C $LIBADALANG_TOOLS_SRC \ 22 | BUILD_MODE=prod \ 23 | DESTDIR=$PREFIX \ 24 | install-lib 25 | 26 | make -w -j$CORES -C $LIBADALANG_TOOLS_SRC \ 27 | LIBRARY_TYPE=static \ 28 | BUILD_MODE=prod \ 29 | bin 30 | 31 | # The runpaths in executables are unhelpful if $PREFIX isn't a 32 | # top-level directory, so use @executable_path. 33 | for f in $(find $LIBADALANG_TOOLS_SRC/bin -type f); do 34 | if [[ $(file $f) == *executable* ]]; then 35 | $script_loc/fix_executable_rpaths.sh $f 36 | fi 37 | done 38 | 39 | # Don't want to do this! 40 | # make -w -C $SRC_PATH/libadalang-tools install-strip DESTDIR=$PREFIX/bin 41 | # Instead, 42 | 43 | export 44 | function install() 45 | { 46 | mkdir -p $PREFIX/bin 47 | strip $LIBADALANG_TOOLS_SRC/bin/gnat* 48 | cp $LIBADALANG_TOOLS_SRC/bin/gnat* $PREFIX/bin/ 49 | } 50 | 51 | install 52 | -------------------------------------------------------------------------------- /libadalang.sh: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | PATH=$NEW_PATH 8 | 9 | source ../langkit/venv/bin/activate 10 | 11 | ( 12 | cd $LIBADALANG_SRC 13 | 14 | rm -rf build 15 | 16 | pip install --upgrade pip 17 | 18 | pip install wheel 19 | 20 | pip install -r requirements-pypi.txt 21 | 22 | # For lib{lkt,python}lang.dylib 23 | # We need lib and lib/gcc/*/adalib 24 | libgcc=$(gcc -print-libgcc-file-name) 25 | adalib=$(dirname $libgcc)/adalib 26 | export DYLD_LIBRARY_PATH=$PREFIX/lib:$adalib 27 | 28 | python manage.py \ 29 | make \ 30 | --build-mode=prod \ 31 | --library-types=relocatable,static-pic,static \ 32 | --disable-java 33 | 34 | # The runpaths in executables are unhelpful if $PREFIX isn't a 35 | # top-level directory, so use @executable_path. 36 | for f in $(find build/obj-mains/prod -type f); do 37 | if [[ $(file $f) == *executable* ]]; then 38 | $script_loc/fix_executable_rpaths.sh $f 39 | fi 40 | done 41 | 42 | # manage.py install --force didn't work (but saw -f ??) 43 | gprinstall --prefix=$PREFIX --uninstall libadalang || true 44 | 45 | python manage.py \ 46 | install \ 47 | --build-mode=prod \ 48 | --force \ 49 | --library-types=relocatable,static-pic,static \ 50 | $PREFIX 51 | ) 52 | 53 | deactivate 54 | -------------------------------------------------------------------------------- /make-dependencies.dot: -------------------------------------------------------------------------------- 1 | digraph { 2 | all [style=dotted] 3 | basic [style=dotted] 4 | 5 | all -> basic 6 | all -> libadalang_tools 7 | basic -> aunit 8 | basic -> gnatcoll_bindings 9 | basic -> gnatcoll_db 10 | adasat -> gprbuild 11 | aunit -> gprbuild 12 | gcc 13 | gmp -> gcc 14 | gnatcoll_bindings -> gmp 15 | gnatcoll_bindings -> gnatcoll_core 16 | gnatcoll_core -> gprbuild 17 | gnatcoll_db -> gnatcoll_core 18 | gpr2 -> langkit 19 | gprbuild -> gprconfig 20 | gprbuild -> xmlada 21 | gprconfig -> gcc 22 | prettier_ada -> gprbuild 23 | prettier_ada -> gnatcoll_core 24 | prettier_ada -> vss 25 | langkit -> gprbuild 26 | langkit -> prettier_ada 27 | langkit -> adasat 28 | libadalang -> gnatcoll_bindings 29 | libadalang -> gpr2 30 | libadalang -> langkit 31 | libadalang_tools -> libadalang 32 | libadalang_tools -> templates_parser 33 | libadalang_tools -> vss 34 | templates_parser -> gprbuild 35 | vss -> gprbuild 36 | xmlada -> gprconfig 37 | } -------------------------------------------------------------------------------- /make-dependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simonjwright/building-gcc-macos-native/555d083f046762cc589a63aabbe7d9a48ddff338/make-dependencies.png -------------------------------------------------------------------------------- /mpc.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | rm -rf * 8 | 9 | $GCC_SRC/mpc/configure \ 10 | --prefix=$PREFIX \ 11 | --host=$BUILD \ 12 | --target=$BUILD \ 13 | --build=$BUILD \ 14 | --with-mpfr=$PREFIX \ 15 | --enable-shared 16 | 17 | make -w -j3 18 | 19 | make install 20 | -------------------------------------------------------------------------------- /mpfr.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | rm -rf * 8 | 9 | $GCC_SRC/mpfr/configure \ 10 | --prefix=$PREFIX \ 11 | --host=$BUILD \ 12 | --target=$BUILD \ 13 | --build=$BUILD \ 14 | --with-gmp=$PREFIX \ 15 | --enable-shared 16 | 17 | make -w -j3 18 | 19 | make install 20 | -------------------------------------------------------------------------------- /prettier-ada.sh: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | PATH=$NEW_PATH 8 | 9 | ( 10 | cd $PRETTIER_ADA_SRC 11 | 12 | echo cleaning 13 | make clean 14 | 15 | echo building 16 | make all BUILD_MODE=prod 17 | 18 | echo installing 19 | make install-all PREFIX=$PREFIX BUILD_MODE=prod 20 | ) 21 | 22 | -------------------------------------------------------------------------------- /release_notes.md: -------------------------------------------------------------------------------- 1 | This is GCC 14.2.0 built on macOS Sonoma (14, Darwin 23) for Apple silicon, with Command Line Utilities 15.3.0 and Python 3.9.13. 2 | 3 | It will also run on Sequoia (15, Darwin24) and with Xcode/Command Line Tools 16, **but it will not run on Monterey**. 4 | 5 | Compilers included: Ada, C, C++. 6 | 7 | Compiler sources are from https://github.com/iains/gcc-14-branch at tag `gcc-14.2-darwin-r2`. 8 | 9 | Tools included (all at version 25.0.0, and all with the [Runtime Library Exception][RLE]): 10 | 11 | * AdaSAT from https://github.com/AdaCore/AdaSAT 12 | * AUnit from https://github.com/AdaCore/aunit 13 | * GNATCOLL from: 14 | * https://github.com/AdaCore/gnatcoll-core 15 | * https://github.com/AdaCore/gnatcoll-bindings (ZLIB is included, OMP and LZMA are not (the GNATCOLL version for LZMA requires thread support in the system library, not available on macOS)) 16 | * https://github.com/AdaCore/gnatcoll-db (only the SQLite backend) 17 | * Gprbuild from https://github.com/AdaCore/gprbuild 18 | * Gprconfig\_kb from https://github.com/AdaCore/gprconfig_kb 19 | * GPR2 from https://github.com/AdaCore/gpr (but not the tools, some don't quite match the behaviour of corresponding tools in GPRbuild) 20 | * Langkit from https://github.com/AdaCore/langkit 21 | * Libadalang from https://github.com/AdaCore/libadalang 22 | * Libadalang tools from https://github.com/AdaCore/libadalang-tools 23 | * Prettier-Ada from https://github.com/AdaCore/prettier-ada 24 | * Templates Parser from https://github.com/AdaCore/templates-parser 25 | * VSS from https://github.com/AdaCore/VSS 26 | * XMLAda from https://github.com/AdaCore/xmlada 27 | 28 | Configured with: 29 | ``` 30 | --prefix=/Volumes/Miscellaneous3/aarch64/gcc-14.2.0-3-aarch64 31 | --enable-languages=c,c++,ada 32 | --build=aarch64-apple-darwin23 33 | --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/../MacOSX14.sdk 34 | --with-specs='%{!-sysroot:--sysroot=%:if-exists-else(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk)}' 35 | --with-bugurl=https://github.com/simonjwright/building-gcc-macos-native 36 | --enable-bootstrap 37 | ``` 38 | 39 | [RLE]: http://www.gnu.org/licenses/gcc-exception-faq.html 40 | 41 | ## Installation, setting PATH ## 42 | 43 | Please see the [Wiki](https://github.com/simonjwright/distributing-gcc/wiki). 44 | 45 | ## Notes ## 46 | 47 | The software was built using the [building-gcc-macos-native][BUILDING] scripts at Github, tag `gcc-14.2.0-3-aarch64`. 48 | 49 | All compilations were done with `export MACOSX_DEPLOYMENT_TARGET=14` so that libraries and executables are compatible with macOS Sonoma and later. 50 | 51 | [BUILDING]:https://github.com/simonjwright/building-gcc-macos-native 52 | 53 | ### Compiler ### 54 | 55 | The compiler is GPL version 3. The runtime has the GCC Runtime Exception, so executables built with it can be released on proprietary terms. 56 | 57 | ### GMP ### 58 | 59 | This library (release 6.2.1) is installed with the compiler. 60 | 61 | ### Other sources ### 62 | 63 | The necessary patches to the v25.0.0 tools are included in the release in the file `gcc-14.2.0-3-patches.zip`. 64 | 65 | ### Include, library paths ### 66 | 67 | As noted [here][SDKS], Apple have changed the location of system include files and libraries; they used to be copied from the SDKs to the "standard" `/usr/include` and `/usr/lib` either automatically or on command. 68 | 69 | This compiler has been built so you don't need to take any related action to use it: unfortunately, this means that paths in `/usr/local` and `/Library/Frameworks` aren't searched. 70 | 71 | [SDKS]: https://forward-in-code.blogspot.com/2022/03/which-sdk-choices-choices.html 72 | -------------------------------------------------------------------------------- /templates-parser.sh: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | PATH=$NEW_PATH 8 | 9 | make -w -C $TEMPLATES_PARSER_SRC clean 10 | 11 | # Have to separate the following, because install doesn't depend on 12 | # build. Not sure about setup, but won't take long. 13 | 14 | make -w -C $TEMPLATES_PARSER_SRC \ 15 | DEFAULT_LIBRARY_TYPE=relocatable \ 16 | prefix=$PREFIX \ 17 | setup 18 | 19 | make -w -j$CORES -C $TEMPLATES_PARSER_SRC \ 20 | DEFAULT_LIBRARY_TYPE=relocatable \ 21 | prefix=$PREFIX \ 22 | build 23 | 24 | make -w -C $TEMPLATES_PARSER_SRC \ 25 | DEFAULT_LIBRARY_TYPE=relocatable \ 26 | prefix=$PREFIX \ 27 | install 28 | -------------------------------------------------------------------------------- /vss.sh: -------------------------------------------------------------------------------- 1 | set -eu 2 | 3 | script_loc=`cd $(dirname $0) && pwd -P` 4 | 5 | . $script_loc/common.sh 6 | 7 | PATH=$NEW_PATH 8 | 9 | ( 10 | cd $VSS_SRC 11 | 12 | make clean 13 | 14 | make build-all-libs 15 | 16 | make install-all-libs PREFIX=$PREFIX 17 | ) 18 | -------------------------------------------------------------------------------- /xmlada.gpr: -------------------------------------------------------------------------------- 1 | -- This project file is used in the build of gprbuild for Alire. 2 | -- It just picks up the XMLAda sources, without making a library 3 | -- or supporting installation. 4 | 5 | project Xmlada is 6 | 7 | Base := external ("XMLADA_SRC"); 8 | 9 | for Source_Dirs use 10 | (Base & "/dom", 11 | Base & "/input_sources", 12 | Base & "/sax", 13 | Base & "/schema", 14 | Base & "/unicode", 15 | Base & "/unicode/importer"); 16 | 17 | -- the aarch64 build didn't seem to need this; the x86_64 build does. 18 | for Object_Dir use external ("TMPDIR") & "/xmlada"; 19 | 20 | end Xmlada; 21 | -------------------------------------------------------------------------------- /xmlada.sh: -------------------------------------------------------------------------------- 1 | script_loc=`cd $(dirname $0) && pwd -P` 2 | 3 | . $script_loc/common.sh 4 | 5 | PATH=$NEW_PATH 6 | 7 | cd $XMLADA_SRC 8 | 9 | make distclean || true 10 | 11 | ./configure \ 12 | --prefix=$PREFIX \ 13 | --target=$BUILD \ 14 | --enable-shared \ 15 | PACKAGE_VERSION=v25.0.0 16 | 17 | make -w -j$CORES 18 | 19 | make -w install 20 | --------------------------------------------------------------------------------