Bug#191997: Separate Ada run-time into a separate package
Here is a patch that I came up with that builds libgnat and links the
GNAT tools (gnatmake, gnatlink, gnatfind, gnatname, etc.) against it.
I used it to build gnat-3.3 from the latest sources in testing
(gcc-3.3-3.3.2ds4-1).
--
Ludovic Brenta.
diff -u -r debian.orig/rules2 debian/rules2
--- debian.orig/rules2 2003-10-20 19:14:03.000000000 +0200
+++ debian/rules2 2003-11-03 16:52:46.000000000 +0100
@@ -339,15 +339,55 @@
> bootstrap-summary; \
fi
-# TODO: Dynamic linking of the gnat tools ...
ifeq ($(with_ada),yes)
ifeq ($(with_libgnat),yes)
+ # BTW, the Ada part of GCC does not support parallel builds, so I
+ # removed the \$(NJOBS) parameter from the make command lines.
+
+ # Build the static and shared libraries
+ rm -f $(builddir)/gcc/ada/rts/*.{o,ali}
LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc/ada \
PATH=$(PWD)/bin:$$PATH \
- $(MAKE) -C $(builddir)/gcc $(NJOBS) \
- gnatlib-shared gnatlib gnattools
+ $(MAKE) -C $(builddir)/gcc gnatlib-shared
+ mkdir $(builddir)/gcc/ada/rts/obj
+
+ # Move the object files away lest the tools include them in their
+ # executables. We want to link against libgnat.so instead.
+ mv $(builddir)/gcc/ada/rts/*.o $(builddir)/gcc/ada/rts/obj
+ ln -s libgnat-3.15.so.1 $(builddir)/gcc/ada/rts/libgnat.so
+ ln -s libgnarl-3.15.so.1 $(builddir)/gcc/ada/rts/libgnarl.so
+
+ # Build gnatmake and gnatlink.
+ LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc/ada/rts \
+ PATH=$(PWD)/bin:$$PATH \
+ $(MAKE) -C $(builddir)/gcc/ada \
+ ADA_INCLUDES="-I- -I../rts" \
+ CC="../../xgcc -B../../" \
+ CFLAGS="-O2" \
+ GNATMAKE="../../gnatmake" \
+ GNATLINK="../../gnatlink" \
+ GNATBIND="../../gnatbind -C" \
+ STAGE_PREFIX="../../" \
+ LIBGNAT="-L../rts -lgnat" \
+ LN_S="ln -s" \
+ gnattools1
+
+ # Use gnatmake, gnatbind and gnatlink to build the other tools.
+ LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc/ada/rts \
+ PATH=$(PWD)/bin:$$PATH \
+ $(MAKE) -C $(builddir)/gcc/ada \
+ ADA_INCLUDES="-I- -I../rts" \
+ CC="../../xgcc -B../../" \
+ CFLAGS="-O2" \
+ GNATMAKE="../../gnatmake" \
+ GNATLINK="../../gnatlink" \
+ GNATBIND="../../gnatbind" \
+ STAGE_PREFIX="../../" \
+ LIBGNAT="-L../rts -lgnat" \
+ LN_S="ln -s" \
+ gnattools2
else
- LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc/ada \
+ LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(builddir)/gcc/ada/rts \
PATH=$(PWD)/bin:$$PATH \
$(MAKE) -C $(builddir)/gcc $(NJOBS) gnatlib gnattools
endif
diff -u -r debian.orig/rules.defs debian/rules.defs
--- debian.orig/rules.defs 2003-10-20 19:14:03.000000000 +0200
+++ debian/rules.defs 2003-11-03 17:43:58.000000000 +0100
@@ -369,7 +369,7 @@
with_ada := no
endif
-with_libgnat := no
+with_libgnat := yes
ada_no_archs := arm hurd-i386 m68k mips mipsel freebsd-i386 netbsd-i386
ifneq ($(DEB_TARGET_ARCH),i386)
ifeq ($(DEB_TARGET_ARCH), $(findstring $(DEB_TARGET_ARCH),$(ada_no_archs)))
Reply to: