scripts/addToolsVersion: properly handle .in vs. .in.2
While most components have their version in the .in file, some
have it in the .in.2 (eg. elf2flt).
Currently, to handle this case, we indiscriminately munge both files,
but this is wrong: in the elf2flt case, if we add a binutils version,
we do not want it to be added to elf2flt, and conversely.
So, for each tool, we need to explicitly know what file to munge.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
3 This patch is needed in situations where build system is running same version of
4 binutils that is intended to be built cross-native ( build != host = target)
5 and has shared libraries enabled. binutils/binutils
6 Makefile has some tools which are built to run on build system. Toplevel makefile
7 for binutils passes HOST_EXPORTS to sub-makefiles which also include RPATH_ENVVARS
8 containing LD_LIBRARY_PATH which is modified so that it also includes host libraries
9 like opcodes and libbfd which are just built for the host system.
11 Now the problem is that same LD_LIBRARY_PATH value gets set in environment even
12 for the tools that are being built for build system using CC_FOR_BUILD and the tools
13 like as,ld it invokes from build machine get the LD_LIBRARY_PATH set to search
14 the newly build host libraries like opcodes and bfd and if host is like a big endian
15 system say (mips-linux) the build system linker and assembler do not run because
16 ld.so tries to load these shared libraries instead of the ones from /usr/lib for
19 This patch fixes the issue by clearing LD_LIBRARY_PATH for BUILD tools
21 This patch would be needed on other versions of binutils. I just cared about 2.20
22 May be upstream is also interested in such a patch.
26 Index: binutils-2.20/binutils/Makefile.am
27 ===================================================================
29 diff -durN binutils-2.20.1.orig/binutils/Makefile.am binutils-2.20.1/binutils/Makefile.am
30 --- binutils-2.20.1.orig/binutils/Makefile.am 2010-01-14 11:48:22.000000000 +0100
31 +++ binutils-2.20.1/binutils/Makefile.am 2010-08-17 19:32:24.000000000 +0200
33 ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
35 sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
36 - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
37 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
39 syslex.o: syslex.c sysinfo.h config.h
40 if [ -r syslex.c ]; then \
41 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
42 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
44 - $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
45 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
49 if [ -r sysinfo.c ]; then \
50 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
51 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
53 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
54 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
57 bin2c$(EXEEXT_FOR_BUILD):
58 - $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
59 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
62 sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@
63 diff -durN binutils-2.20.1.orig/binutils/Makefile.in binutils-2.20.1/binutils/Makefile.in
64 --- binutils-2.20.1.orig/binutils/Makefile.in 2010-03-03 14:59:46.000000000 +0100
65 +++ binutils-2.20.1/binutils/Makefile.in 2010-08-17 19:32:24.000000000 +0200
66 @@ -1193,24 +1193,24 @@
67 ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
69 sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
70 - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
71 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
73 syslex.o: syslex.c sysinfo.h config.h
74 if [ -r syslex.c ]; then \
75 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
76 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) syslex.c ; \
78 - $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
79 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/syslex.c ;\
83 if [ -r sysinfo.c ]; then \
84 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
85 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) sysinfo.c ; \
87 - $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
88 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(NO_WERROR) $(srcdir)/sysinfo.c ; \
91 bin2c$(EXEEXT_FOR_BUILD):
92 - $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
93 + LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
96 sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@