patches/glibc/2.1.3/glibc-2.1.3-override.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.1.3/glibc-2.1.3-override.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,48 @@
     1.4 +The error
     1.5 +
     1.6 +make[2]: *** [.../gcc-3.3.3-glibc-2.1.3/i686-unknown-linux-gnu/share/zoneinfo/Africa/Algiers] Segmentation fault
     1.7 +make[2]: Leaving directory `.../gcc-3.3.3-glibc-2.1.3/glibc-2.1.3/timezone'
     1.8 +make[1]: *** [timezone/subdir_install] Error 2
     1.9 +
    1.10 +is caused by glibc trying to run something it just compiled.
    1.11 +A crude workaround for this was posted at
    1.12 +http://lists.scratchbox.org/pipermail/scratchbox-users/2004-February/000018.html
    1.13 +but the following patch lets you optionally override these programs at
    1.14 +make time by setting environment variables 
    1.15 +  localedef_FOR_BUILD rpcgen_FOR_BUILD zic_FOR_BUILD
    1.16 +and maybe a few others to point to versions of those programs
    1.17 +that can run on the build machine.
    1.18 +Thanks to http://groups.google.com/groups?selm=9012160052.AA23106%40kaos.ksr.com
    1.19 +for pointing out the idiom for inline $(ifdef ...) in GNU Make.
    1.20 +
    1.21 +Dan Kegel 2004-05-17
    1.22 +
    1.23 +--- glibc-2.1.3/Makeconfig.old	1999-11-29 11:19:20.000000000 -0800
    1.24 ++++ glibc-2.1.3/Makeconfig	2004-05-17 15:57:53.000000000 -0700
    1.25 +@@ -470,20 +470,24 @@
    1.26 + # The program binary is assumed to be $(word 2,$^).
    1.27 + built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
    1.28 + ifneq (yes,$(build-shared))
    1.29 +-built-program-cmd = $(built-program-file)
    1.30 ++built-program-real = $(built-program-file)
    1.31 + else
    1.32 + comma = ,
    1.33 + sysdep-library-path = \
    1.34 + $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
    1.35 + 				       $(filter -Wl$(comma)-rpath-link=%,\
    1.36 + 						$(sysdep-LDFLAGS)))))
    1.37 +-define built-program-cmd
    1.38 ++define built-program-real
    1.39 + $(elf-objpfx)$(rtld-installed-name) \
    1.40 + 	--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
    1.41 + 	$(built-program-file)
    1.42 + endef
    1.43 + endif
    1.44 + 
    1.45 ++# If user set foo_FOR_BUILD, use that instead of actually running the program we just linked.
    1.46 ++built-program-override-name = $(notdir $(word 2,$^))_FOR_BUILD
    1.47 ++built-program-cmd = $(if $(findstring undefined,$(origin $(built-program-override-name))),$(built-program-real),$($(built-program-override-name)))
    1.48 ++
    1.49 + ifndef LD
    1.50 + LD := ld -X
    1.51 + endif