This post lists steps that build
ada-mode
for Emacs. The build
depends on the GNAT FSF compiler being available on the build system. On
Arch Linux, the compiler is available as the
gcc-ada
package.
# build-ada-mode.sh
# Run as: sh build-ada-mode.sh
set -e
set -u
DOWNLOAD=true
SRC=/tmp/src
TOOLS=$HOME/tools/ada
LR1_SRC=ada_annex_p_lr1_parse_table.txt-8.1.0
LR1_TAB=ada_annex_p_lr1_re2c_parse_table.txt
LR1_URL=https://download.savannah.nongnu.org/releases/ada-mode/$LR1_SRC
SAVE=$PATH
mkdir -p $SRC
if [ "$DOWNLOAD" == "true" ]; then
cd $SRC
git clone --depth 1 https://github.com/AdaCore/gprbuild.git
git clone --depth 1 https://github.com/AdaCore/xmlada.git
git clone --depth 1 https://github.com/AdaCore/gprconfig_kb.git
git clone --depth 1 https://github.com/AdaCore/gnatcoll-core.git
git clone --depth 1 --single-branch --branch externals/wisi \
https://git.savannah.gnu.org/git/emacs/elpa.git wisi
git clone --depth 1 --single-branch --branch externals/ada-mode \
https://git.savannah.gnu.org/git/emacs/elpa.git ada-mode
git clone --depth 1 --single-branch --branch externals/gpr-mode \
https://git.savannah.gnu.org/git/emacs/elpa.git gpr-mode
sed -i '/wisitoken-bnf-generate/d' $SRC/ada-mode/build.sh
wget --show-progress -O $LR1_TAB $LR1_URL
fi
# Bootstrap GPRbuild
cd $SRC/gprbuild
./bootstrap.sh --with-xmlada=../xmlada --with-kb=../gprconfig_kb \
--prefix=$TOOLS/bgprb
export PATH=$SAVE:$TOOLS/bgprb/bin
# XML/Ada
cd $SRC/xmlada
./configure --prefix=$TOOLS/xmlada --enable-shared
make
make install
export GPR_PROJECT_PATH=$TOOLS/xmlada/share/gpr
# GPRbuild
cd $SRC/gprbuild
make prefix=$TOOLS/gprb setup
make LIBRARY_TYPE=relocatable all
make libgpr.build
make install
make libgpr.install
export PATH=$SAVE:$TOOLS/gprb/bin
export GPR_PROJECT_PATH=$GPR_PROJECT_PATH:$TOOLS/gprb/share/gpr
# GNATcoll-Core
cd $SRC/gnatcoll-core
make prefix=$TOOLS/gc setup
make
make install
export GPR_PROJECT_PATH=$GPR_PROJECT_PATH:$TOOLS/gc/share/gpr
# ada-mode
cd $SRC/ada-mode
export WISI_DIR=../wisi
./build.sh
./install.sh $TOOLS/am
# lr1 table
mv $SRC/$LR1_TAB $TOOLS/am/bin/
# gpr-mode
cd $SRC/gpr-mode
./build.sh
./install.sh $TOOLS/gm
# Run 'strip -s' on gprbuild, ada-mode and gpr-mode binaries.
Emacs configuration:
Modify the Emacs init file, to append exec-path
with the paths to the
ada-mode
and gpr-mode
binaries.
(setq exec-path (append exec-path '(expand-file-name "~/tools/ada/am/bin")))
(setq exec-path (append exec-path '(expand-file-name "~/tools/ada/gm/bin")))
When launching Emacs, ensure that gprbuild
binaries are in $PATH
; various
Emacs ada-mode
commands look for those binaries.