Skip to content

Commit

Permalink
Updated for 'static SAL' fix.
Browse files Browse the repository at this point in the history
This affects AdaCore's implementation of langkit.sh, which expects to
be able to use objcopy to create an 'initialize-on-load' segment in a
static archive. Not possible on Darwin; (a) no objcopy, (b) restricted
structure of objects.

  * .gitattributes: marked *.zip as binary.
  * common.sh (PYTHON): be explicit about where it comes from (but still
      3.9).
  * gcc-14.2.0-3-patches.zip: patches to AdaCore components.
  * langkit.sh: install all library-types. Uninstall projects before
      installation; even if -f is carried through, it doesn't seem to work.
  * libadalang-tools.sh: build all library-types (by not specifying them),
      except for bin target, where specify LIBRARY_TYPE=static.
  * libadalang.sh: build & install all library-types. Uninstall libadalang
      before installation.
  • Loading branch information
simonjwright committed Nov 16, 2024
1 parent dbff06f commit 2d6ef4b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.png binary
*.zip binary
2 changes: 1 addition & 1 deletion common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BUILD=$ARCH-apple-darwin23
BOOTSTRAP=${BOOTSTRAP:=enable} # or disable

SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
PYTHON=python3.9
PYTHON=/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
CORES=$(sysctl -n hw.ncpu)

# Exported so GCC sees it while compiling/linking: Monterey
Expand Down
Binary file added gcc-14.2.0-3-patches.zip
Binary file not shown.
58 changes: 33 additions & 25 deletions langkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,55 @@ pip install --upgrade pip

pip install .

python \
manage.py \
make \
--no-mypy \
--generate-auto-dll-dirs \
--build-mode=prod \
--library-types relocatable \
python \
manage.py \
make \
--no-mypy \
--generate-auto-dll-dirs \
--build-mode=prod \
--library-types relocatable,static-pic,static \
--gargs '-cargs -fPIC'

# no --force in install-langkit-support
gprinstall --prefix=$PREFIX --uninstall langkit_support || true

python manage.py \
install-langkit-support \
--build-mode=prod \
--library-types relocatable \
python manage.py \
install-langkit-support \
--build-mode=prod \
--library-types relocatable,static-pic,static \
$PREFIX

(
cd contrib/python \
python \
./manage.py \
install \
--force \
$PREFIX \
--library-types=relocatable \
--build-mode=prod \

# manage.py install --force doesn't work
gprinstall --prefix=$PREFIX --uninstall libpythonlang || true

python \
./manage.py \
install \
--force \
$PREFIX \
--library-types=relocatable,static-pic,static \
--build-mode=prod \
--disable-all-mains
)

pip install contrib/python/build/python

(
cd contrib/lkt
python \
./manage.py \
install \
--force \
$PREFIX \
--library-types=relocatable \
--build-mode=prod \

# manage.py install --force doesn't work
gprinstall --prefix=$PREFIX --uninstall liblktlang || true

python \
./manage.py \
install \
--force \
$PREFIX \
--library-types=relocatable,static-pic,static \
--build-mode=prod \
--disable-all-mains
)

Expand Down
7 changes: 1 addition & 6 deletions libadalang-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,22 @@ PATH=$NEW_PATH
# Have to use BUILD_MODE=prod to avoid a warning-treated-as-error

make -w -C $LIBADALANG_TOOLS_SRC \
ALL_LIBRARY_TYPES=relocatable \
LIBRARY_TYPE=relocatable \
BUILD_MODE=prod \
clean

gprinstall --prefix=$PREFIX --uninstall lal_tools || true

make -w -j$CORES -C $LIBADALANG_TOOLS_SRC \
ALL_LIBRARY_TYPES=relocatable \
BUILD_MODE=prod \
lib

make -w -C $LIBADALANG_TOOLS_SRC \
ALL_LIBRARY_TYPES=relocatable \
BUILD_MODE=prod \
DESTDIR=$PREFIX \
install-lib

make -w -j$CORES -C $LIBADALANG_TOOLS_SRC \
ALL_LIBRARY_TYPES=relocatable \
LIBRARY_TYPE=relocatable \
LIBRARY_TYPE=static \
BUILD_MODE=prod \
bin

Expand Down
21 changes: 12 additions & 9 deletions libadalang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ source ../langkit/venv/bin/activate
adalib=$(dirname $libgcc)/adalib
export DYLD_LIBRARY_PATH=$PREFIX/lib:$adalib

python manage.py \
make \
--build-mode=prod \
--library-types=relocatable \
python manage.py \
make \
--build-mode=prod \
--library-types=relocatable,static-pic,static \
--disable-java

# The runpaths in executables are unhelpful if $PREFIX isn't a
Expand All @@ -39,11 +39,14 @@ source ../langkit/venv/bin/activate
fi
done

python manage.py \
install \
--build-mode=prod \
--force \
--library-types=relocatable \
# manage.py install --force didn't work (but saw -f ??)
gprinstall --prefix=$PREFIX --uninstall libadalang || true

python manage.py \
install \
--build-mode=prod \
--force \
--library-types=relocatable,static-pic,static \
$PREFIX
)

Expand Down

0 comments on commit 2d6ef4b

Please sign in to comment.