mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 08:26:39 +00:00
The solution to get libgccjit properly working, and embedded in Emacs.app included: - The contents of GCC's lib folder (`/usr/local/opt/gcc/lib`) is copied into the `Contents/MacOS/lib-<arch>-<os_version>` folder. - Setting `LIBRARY_PATH` environment variable to correct GCC lib folders within Emacs.app. This is done through a bash launcher script which replaces the regular `Contents/MacOS/Emacs` executable. The main Emacs executable itself is named `Emacs-bin` now instead, so anything that depends on the exact process name will need updating. - The launcher script also adds `Content/MacOS/bin` and `Content/MacOS/libexec` folders to the PATH environment variable, to so ensure binary tools packaged into Emacs itself are available. This is done even when not doing a native-comp build. The launcher script skips setting LIBRARY_PATH if it's not a native-comp build. This should hopefully resolve both #5 and #7.
66 lines
1.3 KiB
Plaintext
Executable File
66 lines
1.3 KiB
Plaintext
Executable File
#!/bin/bash
|
|
# This launcher script is not part of Emacs proper. It is from the
|
|
# build-emacs-for-macos project (https://github.com/jimeh/build-emacs-for-macos)
|
|
# and helps facilitate proper startup of Emacs with environment varibales set as
|
|
# needed.
|
|
#
|
|
# Licensed under CC0 1.0 Universal:
|
|
# https://creativecommons.org/publicdomain/zero/1.0/
|
|
#
|
|
set -e
|
|
|
|
resolve_link() {
|
|
local file="$1"
|
|
|
|
while [ -L "$file" ]; do
|
|
file="$(readlink "$file")"
|
|
done
|
|
|
|
echo "$file"
|
|
}
|
|
|
|
realname() {
|
|
local path="$1"
|
|
local resolved
|
|
local cwd
|
|
|
|
cwd="$(pwd)"
|
|
resolved="$(resolve_link "$path")"
|
|
cd "$(dirname "$resolved")"
|
|
echo "$(pwd)/$(basename "$resolved")"
|
|
cd "$cwd"
|
|
}
|
|
|
|
join() {
|
|
local IFS="$1"
|
|
local parts=()
|
|
shift
|
|
|
|
for arg in "$@"; do
|
|
if [ "$arg" != "" ]; then
|
|
parts+=("$arg")
|
|
fi
|
|
done
|
|
|
|
echo "${parts[*]}"
|
|
}
|
|
|
|
DIR="$(dirname "$(realname "$0")")"
|
|
BIN="${DIR}/Emacs<%= bin_suffix %>"
|
|
|
|
export PATH="${DIR}/bin:${DIR}/libexec:${PATH}"
|
|
<% if library_paths.any? %>
|
|
LIB_PATHS=(
|
|
'<%= library_paths.map { |p| p.gsub('\'', "\"'\"") }.join("'\n '") %>'
|
|
)
|
|
for lib in "${LIB_PATHS[@]}"; do
|
|
if [ -d "${DIR}/<%= lib_dir_name %>/${lib}" ]; then
|
|
libs="$(join : "$libs" "${DIR}/<%= lib_dir_name %>/${lib}")"
|
|
fi
|
|
done
|
|
|
|
LIBRARY_PATH="$(join : "$libs" "$LIBRARY_PATH")"
|
|
export LIBRARY_PATH
|
|
<% end %>
|
|
exec "$BIN" "$@"
|