[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Patch] #6: improve ada-link-lib.dpatch



This patch improves ada-link-lib.dpatch.  Now, we build statically
linked versions of gnatmake and gnatlink, and use them to build all
the other tools.  Thus we no longer rely on LD_LIBRARY_PATH to find
libgnat-4.1.so; LD_LIBRARY_PATH only works on some build platforms.

The other improvement is that we now rebuild gnatlink as a dynamically
linked executable, too.

Apply this patch on top of the ada-link-lib.dpatch in patch #5.

-- 
Ludovic Brenta.



Index: patches/ada-link-lib.dpatch
===================================================================
RCS file: /var/lib/cvs/gcc-debian/F-E104505123C347D1FD56DA709B5585A9.dpatch,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- patches/ada-link-lib.dpatch	12 Apr 2006 16:41:55 -0000	1.13
+++ patches/ada-link-lib.dpatch	13 Apr 2006 15:31:36 -0000	1.14
@@ -757,8 +757,17 @@
 -	../../vms_help$(exeext) $(fsrcdir)/gnat.help_in \
 -	                        $(fsrcdir)/vms_data.ads ../../gnat.hlp
 --- gnattools/Makefile.in~
-+++ gnattools/Makefile.in	2006-04-12 17:07:44.000000000 +0200
-@@ -32,113 +32,15 @@
++++ gnattools/Makefile.in	2006-04-13 17:15:59.000000000 +0200
+@@ -18,6 +18,8 @@
+ # Default target; must be first.
+ all: gnattools
+ 
++.SUFFIXES:
++
+ # Standard autoconf-set variables.
+ SHELL = @SHELL@
+ srcdir = @srcdir@
+@@ -32,113 +34,16 @@
  LN_S=@LN_S@
  target_noncanonical=@target_noncanonical@
  
@@ -875,13 +884,14 @@
 +ADA_INCLUDES=-nostdinc -I- -I. -I../gcc/ada/rts -I@srcdir@/../gcc/ada
 +LIB_VERSION=$(strip $(shell grep ' Library_Version :' \
 +              @srcdir@/../gcc/ada/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
++ADA_LIBS := -L../gcc/ada/rts -lgnat-$(LIB_VERSION)
 +
 +# We will use the just-built compiler to compile and link everything.
 +GCC=../gcc/xgcc -B../gcc/
  
  # File lists
  # ----------
-@@ -147,18 +49,129 @@
+@@ -147,18 +52,134 @@
  EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@
  TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
  
@@ -897,11 +907,16 @@
 -	../../gnatname$(exeext) \
 -	../../gnatclean$(exeext) \
 -	../../gprmake$(exeext)
-+# Stage 1 builds xgcc and gnatbind; we can use them to build gnatmake
-+# and gnatlink, then use gnatmake and gnatlink to build the other
-+# tools.  This is the list of these other tools.
-+TOOLS := gnat gnatchop gnatclean gnatfind gnatkr gnatls gnatname
-+TOOLS += gnatprep gnatxref gprmake
++# Stage 1 builds xgcc and gnatbind; we can use them to build
++# gnatmake-static and gnatlink-static, then use gnatmake-static and
++# gnatlink-static to build the other tools.  The reason we first build
++# statically-linked versions of gnatmake and gnatlink is so we can run
++# them with confidence on all build platforms, without LD_LIBRARY_PATH
++# or some such variable.
++
++# The tools we will build using gnatmake-static and gnatlink-static.
++TOOLS := gnat gnatbind gnatchop gnatclean gnatfind gnatkr gnatls gnatlink
++TOOLS += gnatmake gnatname gnatprep gnatxref gprmake
 +
 +# Since we don't have gnatmake, we must specify the full list of
 +# object files necessary to build gnatmake and gnatlink.
@@ -1023,7 +1038,7 @@
  
  # Makefile targets
  # ----------------
-@@ -166,126 +179,101 @@
+@@ -166,126 +187,107 @@
  .PHONY: gnattools gnattools-native gnattools-cross regnattools
  gnattools: @default_gnattools_target@
  
@@ -1053,8 +1068,9 @@
 +
 +gnattools-native: ../gcc/ada/rts/libgnat-$(LIB_VERSION).so
 +gnattools-native: stamp-gnattools-sources
-+gnattools-native: gnatmake gnatlink $(TOOLS) gnatbl
-+$(TOOLS): | gnatmake gnatlink
++gnattools-native: $(TOOLS) gnatbl
++
++$(TOOLS) gnatcmd: | gnatmake-static gnatlink-static
 +
 +vpath %.c @srcdir@/../gcc/ada:@srcdir@/../gcc
 +vpath %.h @srcdir@/../gcc/ada
@@ -1068,10 +1084,14 @@
 +
 +# gnatlink
 +
-+gnatlink: $(GNATLINK_OBJS) b_gnatl.o link.o
-+	$(GCC) -o $@ $^ -L../gcc/ada/rts -lgnat-$(LIB_VERSION) \
++gnatlink-static: $(GNATLINK_OBJS) b_gnatl.o link.o
++	$(GCC) -o $@ $^ \
++	   ../gcc/ada/rts/libgnat.a \
 +	   ../libiberty/libiberty.a
 +
++gnatlink: $(GNATLINK_OBJS) b_gnatl.o link.o
++	$(GCC) -o $@ $^ $(ADA_LIBS) ../libiberty/libiberty.a
++
 +b_gnatl.o: b_gnatl.c adaint.h
 +	$(GCC) -c -o $@ $(CFLAGS) $<
 +
@@ -1080,9 +1100,13 @@
 +
 +# gnatmake
 +
-+gnatmake: $(GNATMAKE_OBJS) b_gnatm.o link.o
++gnatmake-static: $(GNATMAKE_OBJS) b_gnatm.o link.o
 +	$(GCC) -o $@ $(ADA_CFLAGS) $^ \
-+	   -L../gcc/ada/rts -lgnat-$(LIB_VERSION) ../libiberty/libiberty.a
++	   ../gcc/ada/rts/libgnat.a \
++	   ../libiberty/libiberty.a
++
++gnatmake: $(GNATMAKE_OBJS) b_gnatm.o link.o
++	$(GCC) -o $@ $(ADA_CFLAGS) $^ $(ADA_LIBS) ../libiberty/libiberty.a
 +
 +b_gnatm.o: b_gnatm.c adaint.h
 +	$(GCC) -c -o $@ $(CFLAGS) $<
@@ -1092,36 +1116,33 @@
 +
 +# Other tools
 +gnatchop gnatkr: version.o
-+	LD_LIBRARY_PATH=../gcc/ada/rts \
-+	./gnatmake -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \
++	./gnatmake-static -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \
 +	   --GCC="$(GCC)" \
 +	   --GNATBIND=../gcc/gnatbind
-+	LD_LIBRARY_PATH=../gcc/ada/rts \
-+	./gnatlink -o $@ $@.ali $^ $(ADA_INCLUDES) \
-+	   -L../gcc/ada/rts -lgnat-$(LIB_VERSION) \
++	./gnatlink-static -o $@ $@.ali $^ $(ADA_INCLUDES) $(ADA_LIBS) \
 +	   --GCC="$(GCC) $(ADA_INCLUDES)" 
++	strip $@
 +
 +gnat: gnatcmd
 +	cp -lp $< $@
 +
-+gnatclean gnatcmd gnatfind gnatls gnatname gnatprep gnatxref gprmake: \
++gnatbind gnatclean gnatcmd gnatfind gnatls gnatname gnatprep gnatxref gprmake: \
 +link.o version.o prefix.o
-+	LD_LIBRARY_PATH=../gcc/ada/rts \
-+	./gnatmake -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \
++	./gnatmake-static -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \
 +	   --GCC="$(GCC)" \
 +	   --GNATBIND=../gcc/gnatbind
-+	LD_LIBRARY_PATH=../gcc/ada/rts \
-+	./gnatlink -v -o $@ $@.ali $^ $(ADA_INCLUDES) \
-+	   -L../gcc/ada/rts -lgnat-$(LIB_VERSION) ../libiberty/libiberty.a \
++	./gnatlink-static -o $@ $@.ali $^ $(ADA_INCLUDES) $(ADA_LIBS) \
++	   ../libiberty/libiberty.a \
 +	   --GCC="$(GCC) $(ADA_INCLUDES)"
++	strip $@
 +
 +gnatbl: gnatbl.c link.o version.o prefix.o
 +	$(GCC) -o $@ $< $(CFLAGS) \
 +	   -I../gcc -I@srcdir@/../gcc/config -I@srcdir@/../gcc \
 +	   -I@srcdir@/../include \
 +	   $(filter-out %.c,$^) \
-+	   -L../gcc/ada/rts -lgnat-$(LIB_VERSION) \
-+	   ../libiberty/libiberty.a
++	   $(ADA_LIBS) ../libiberty/libiberty.a
++	strip $@
 +
 +# Force compiling sdefault.adb, not .ads, to produce sdefault.o
 +sdefault.o: sdefault.adb
@@ -1242,7 +1263,7 @@
  
  # Other
  # -----
-@@ -307,13 +295,16 @@
+@@ -307,13 +309,16 @@
  
  # Installation rules.
  install:



Reply to: