Skip to content

Commit

Permalink
Update for 12.2.0 on aarch64.
Browse files Browse the repository at this point in the history
  * README.md: included templates_parser.sh in list of scripts to run.
      Noted that gdb.sh isn't needed on aarch64.
      Noted that libadalang and langkit sources need to be kept
      synchronised.
  * release_notes.md: new (edited from externally-prepared 12.1.0 version).
  * common.sh (VERSION): updated.
    (MACOSX_DEPLOYMENT_TARGET): new, exported (as 12).
    (TEMPLATES_PARSER_SRC): new.
  * gcc.sh (XPREFIX): lost the meaningless '-8' suffix.
  * gprbuild.sh: do an initial 'make clean'.
  * gprconfig.sh: copy all the database files (the previous setting left out
      gprconfig.xsd).
  * templates-parser.sh: new.
  * xmlada.sh: leave out --host, --build (they don't affect the configuration,
      at any rate after necessary mods to the package's Makefile.in).
      Update the package version to v23.0.0.
  • Loading branch information
simonjwright committed Nov 20, 2022
1 parent 9bdc996 commit fc0cdf4
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ would be
* `gnatcoll-bindings.sh`
* `gnatcoll-db.sh`
* `libadalang.sh`
* `templates-parser.sh`
* `libadalang-tools.sh`
* `gdb.sh`
* `gdb.sh` (not useful on aarch64?)

## Notes ##

* *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 8.1.0 *XML/Ada* built OK with the GCC 7.1.0 *gprbuild*). If not, check out `bootstrap.sh` in the *gprbuild* sources.
* `gprbuild`: update `{gprbuild}/gpr/src/gpr-version.ads` to match the current release state.
* `gnatmetric`, `gnatpp`, `gnatstub`, `gnattest`: update `{libadalang-tools}/src/utils-versions.ads` likewise.
* `libadalang` and `langkit` sources need to be kept synchronised.
6 changes: 5 additions & 1 deletion common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

set -eu

VERSION=12.1.0
VERSION=12.2.0
PREFIX=/opt/gcc-$VERSION
BUILD=aarch64-apple-darwin21

# exported so GCC sees it while compiling/linking: Monterey
export MACOSX_DEPLOYMENT_TARGET=12

TOP=/Volumes/Miscellaneous1

# override the above version if necessary
Expand All @@ -30,4 +33,5 @@ GPRCONFIG_SRC=$SRC_PATH/gprconfig_kb
LANGKIT_SRC=$SRC_PATH/langkit
LIBADALANG_SRC=$SRC_PATH/libadalang
LIBADALANG_TOOLS_SRC=$SRC_PATH/libadalang-tools
TEMPLATES_PARSER_SRC=$SRC_PATH/templates-parser
XMLADA_SRC=$SRC_PATH/xmlada
2 changes: 1 addition & 1 deletion gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SDKROOT=$(xcrun --show-sdk-path)
X86=x86_64-apple-darwin21
ARM=aarch64-apple-darwin21

XPREFIX=~/tmp/aarch64-apple-darwin-cross-8
XPREFIX=~/tmp/aarch64-apple-darwin-cross

[ "x$arg" == xcross ] && (
set -eu
Expand Down
5 changes: 5 additions & 0 deletions gprbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ PATH=$NEW_PATH

rm -rf *

make -f $GPRBUILD_SRC/Makefile \
TARGET=$BUILD \
ENABLE_SHARED=yes \
clean

make -f $GPRBUILD_SRC/Makefile \
TARGET=$BUILD \
ENABLE_SHARED=yes \
Expand Down
2 changes: 1 addition & 1 deletion gprconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ install_loc=$PREFIX/share/gprconfig

mkdir -p $install_loc

cp -p $GPRCONFIG_SRC/db/*.{ent,xml} $install_loc/
cp -p $GPRCONFIG_SRC/db/* $install_loc/
165 changes: 165 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
This is GCC 12.2.0 built on macOS Ventura (13, Darwin 22) but able to run on Monterey, for Apple silicon (M1), with Command Line Utilities 14.1.0.

**gcc-12.2.0-aarch64-apple-darwin21.pkg**

Compiler sources are from https://github.com/iains/gcc-12-branch at tag `gcc-12.2-darwin-r0`.

Compilers included: Ada, C, C++.

Tools included (all at version 23.0.0, and all with the [Runtime Library Exception][RLE]):

* AUnit from https://github.com/AdaCore/aunit
* GNATCOLL from:
* https://github.com/AdaCore/gnatcoll-core
* 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))
* https://github.com/AdaCore/gnatcoll-db (only the SQLite backend)
* Gprbuild from https://github.com/AdaCore/gprbuild
* Gprconfig\_kb from https://github.com/AdaCore/gprconfig_kb
* Langkit from https://github.com/AdaCore/langkit
* Libadalang from https://github.com/AdaCore/libadalang
* Libadalang tools from https://github.com/AdaCore/libadalang-tools
* Template Parser from https://github.com/AdaCore/templates-parser
* XMLAda from https://github.com/AdaCore/xmlada

Target: aarch64-apple-darwin21

Configured with:
```
--prefix=/opt/gcc-12.2.0
--without-libiconv-prefix
--disable-libmudflap
--disable-libstdcxx-pch
--disable-libsanitizer
--disable-libcc1
--disable-libcilkrts
--disable-multilib
--disable-nls
--enable-languages=c,c++,ada
--host=aarch64-apple-darwin21
--target=aarch64-apple-darwin21
--build=aarch64-apple-darwin21
--without-isl
--with-build-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
--with-sysroot=
--with-specs='%{!sysroot=*:--sysroot=%:if-exists-else(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk)}'
--with-build-config=no
--enable-bootstrap
```

[RLE]: http://www.gnu.org/licenses/gcc-exception-faq.html

## Install ##

One of _Xcode_ or the Command Line Tools is required.

_Xcode_ can be downloaded from the App Store.
Install the Command Line Tools by `sudo xcode-select --install`.

If you suspect your copy of the Command Line Tools is old, you can delete it by
```
sudo rm -rf /Library/Developer/CommandLineTools
```
and re-install.

Download the binary `.pkg`. It's not signed, so **don't** double-click on it; instead, right-click on it and _Open_. Accept the warning. You will be guided through the installation.

### Setting PATH ###

`PATH` needs to be set to include `/opt/gcc-12.1.0-aarch64/bin` at the front:

#### `bash` ####

Insert
```
export PATH=/opt/gcc-12.2.0-aarch64/bin:$PATH
```
in your `~/.bash_profile_common`.

#### `zsh` ####

Likewise, but in `~/.zshrc`.

See [here][ZSH] for helpful information on moving to `zsh`.

[ZSH]: https://scriptingosx.com/2019/06/moving-to-zsh/

## Notes ##

The software was built using the [building-gcc-macos-native][BUILDING] scripts at Github, tag `gcc-12.2.0-aarch64`.

All compilations were done with `export MACOSX_DEPLOYMENT_TARGET=12` so that libraries and executables are compatible with macOS Monterey and later.

[BUILDING]:https://github.com/simonjwright/building-gcc-macos-native

### Compiler ###

The compiler is GPL version 3. The runtime has the GCC Runtime Exception, so executables built with it can be released on proprietary terms.

### GMP, MPFR, MPC ###

These libraries (releases 6.2.1, 4.1.0, 1.2.1 respectively) are installed with the compiler.

### Other sources ###

The following patches to the v23.0.0 versions were needed to allow the builds to see the new compiler.

#### XML/Ada ####

```
diff --git a/Makefile.in b/Makefile.in
index 14d3dc4..26707d7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -35,13 +35,9 @@ MODULES=unicode input_sources sax dom schema
MODULE_INSTALL=${MODULES:%=%_inst}
GPROPTS=-XXMLADA_BUILD_MODE=${MODE} -XPROCESSORS=${PROCESSORS}
+GPROPTS+=--target=${TARGET_ALIAS}
-ifeq (${HOST},${TARGET})
IPREFIX=${DESTDIR}${prefix}
-else
-GPROPTS+=--target=${TARGET_ALIAS}
-IPREFIX=${DESTDIR}${prefix}/${TARGET_ALIAS}
-endif
ifdef RTS
GPROPTS+=--RTS=${RTS}
```

#### Gprbuild ####

```
diff --git a/Makefile b/Makefile
index d4de8894..6fddd346 100644
--- a/Makefile
+++ b/Makefile
@@ -37,13 +37,7 @@ LIB_DIR = lib/
# Load current setup if any
-include makefile.setup
-# target options for cross-build
-ifeq ($(HOST),$(TARGET))
-GTARGET=
-# INSTALLER=exe/$(BUILD)/$(LIB_INSTALLER)
-else
GTARGET=--target=$(TARGET)
-endif
INSTALLER=$(LIB_INSTALLER)
EXEC_INSTALLER=$(INSTALLER) -XBUILD=${BUILD}
```

### Include, library paths ###

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.

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.

[SDKS]: https://forward-in-code.blogspot.com/2022/03/which-sdk-choices-choices.html

## Distribution ##

The distribution was prepared using the [distributing-gcc project][DIST] at Github, tag `gcc-12.2.0-aarch64`.

[DIST]: https://github.com/simonjwright/distributing-gcc
14 changes: 14 additions & 0 deletions templates-parser.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set -eu

script_loc=`cd $(dirname $0) && pwd -P`

. $script_loc/common.sh

PATH=$NEW_PATH

make -w -C $TEMPLATES_PARSER_SRC clean

make -w -C $TEMPLATES_PARSER_SRC \
DEFAULT_LIBRARY_TYPE=relocatable \
prefix=$PREFIX \
setup build install
4 changes: 1 addition & 3 deletions xmlada.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ make distclean || true

./configure \
--prefix=$PREFIX \
--host=$BUILD \
--target=$BUILD \
--build=$BUILD \
--enable-shared \
PACKAGE_VERSION=v22.0.0
PACKAGE_VERSION=v23.0.0

make -w -j7

Expand Down

0 comments on commit fc0cdf4

Please sign in to comment.