0001-Change-Make-vars-to-work-in-Gentoo-builds.patch 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. From 628de9d1198b724ec6427b9ca7de1c8e2e9ab9b3 Mon Sep 17 00:00:00 2001
  2. From: Mike Frysinger <vapier@gentoo.org>
  3. Date: Tue, 5 Jan 2021 11:13:53 +0100
  4. Subject: [PATCH 01/14] Change Make vars to work in Gentoo builds
  5. ---
  6. chat/Makefile.linux | 2 +-
  7. configure | 4 ++--
  8. pppd/plugins/Makefile.linux | 8 ++++++--
  9. pppd/plugins/pppoatm/Makefile.linux | 3 +--
  10. pppd/plugins/pppoe/Makefile.linux | 4 ++--
  11. pppd/plugins/pppol2tp/Makefile.linux | 3 +--
  12. pppd/plugins/radius/Makefile.linux | 6 +++---
  13. 7 files changed, 16 insertions(+), 14 deletions(-)
  14. diff --git a/chat/Makefile.linux b/chat/Makefile.linux
  15. index 407cc12..9b09ae3 100644
  16. --- a/chat/Makefile.linux
  17. +++ b/chat/Makefile.linux
  18. @@ -19,7 +19,7 @@ INSTALL= install
  19. all: chat
  20. chat: chat.o
  21. - $(CC) $(LDFLAGS) -o chat chat.o
  22. + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
  23. chat.o: chat.c
  24. $(CC) -c $(CFLAGS) -o chat.o chat.c
  25. diff --git a/configure b/configure
  26. index f977663..bb72fba 100755
  27. --- a/configure
  28. +++ b/configure
  29. @@ -7,7 +7,7 @@ SYSCONF=/etc
  30. # Compile defaults
  31. CROSS_COMPILE=
  32. -CC=cc
  33. +CC ?= cc
  34. CFLAGS=
  35. system=`uname -s`
  36. @@ -20,7 +20,7 @@ case $system in
  37. makext="linux";
  38. ksrc="linux";
  39. state="known";
  40. - CFLAGS="-O2 -g -pipe";;
  41. + CFLAGS="$(CFLAGS)";;
  42. SunOS)
  43. karch=`/usr/bin/isainfo -k`
  44. case $release in
  45. diff --git a/pppd/plugins/Makefile.linux b/pppd/plugins/Makefile.linux
  46. index 6403e3d..89cf5e7 100644
  47. --- a/pppd/plugins/Makefile.linux
  48. +++ b/pppd/plugins/Makefile.linux
  49. @@ -8,7 +8,11 @@ MANDIR = $(DESTDIR)/share/man/man8
  50. LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
  51. CFLAGS = $(COPTS) -I.. -I../../include -fPIC
  52. -LDFLAGS_SHARED = -shared
  53. +LDFLAGS_PROG := $(LDFLAGS)
  54. +export LDFLAGS LDFLAGS_PROG
  55. +LDFLAGS += -shared
  56. +# need the following option, otherwise linking plugins might fail with undef errors (Gentoo bug 210837)
  57. +LDFLAGS += -Wl,--allow-shlib-undefined
  58. INSTALL = install
  59. # EAP-TLS
  60. @@ -35,7 +39,7 @@ all: $(PLUGINS)
  61. for d in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$d all || exit $$?; done
  62. %.so: %.c
  63. - $(CC) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) $(CFLAGS) $^
  64. + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBS)
  65. VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../patchlevel.h)
  66. diff --git a/pppd/plugins/pppoatm/Makefile.linux b/pppd/plugins/pppoatm/Makefile.linux
  67. index d3a8086..ad6b074 100644
  68. --- a/pppd/plugins/pppoatm/Makefile.linux
  69. +++ b/pppd/plugins/pppoatm/Makefile.linux
  70. @@ -9,7 +9,6 @@ LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
  71. VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
  72. CFLAGS = $(COPTS) -I../.. -I../../../include -fPIC
  73. -LDFLAGS_SHARED = -shared
  74. INSTALL = install
  75. PLUGIN := pppoatm.so
  76. @@ -34,7 +33,7 @@ endif
  77. all: $(PLUGIN)
  78. $(PLUGIN): $(PLUGIN_OBJS)
  79. - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LDFLAGS_SHARED) $^ $(LIBS)
  80. + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
  81. install: all
  82. $(INSTALL) -d -m 755 $(LIBDIR)
  83. diff --git a/pppd/plugins/pppoe/Makefile.linux b/pppd/plugins/pppoe/Makefile.linux
  84. index c415ce3..e18c6de 100644
  85. --- a/pppd/plugins/pppoe/Makefile.linux
  86. +++ b/pppd/plugins/pppoe/Makefile.linux
  87. @@ -29,7 +29,7 @@ CFLAGS=$(COPTS) -I../../../include
  88. all: pppoe.so pppoe-discovery
  89. pppoe-discovery: pppoe-discovery.o debug.o
  90. - $(CC) $(LDFLAGS) -o pppoe-discovery pppoe-discovery.o debug.o
  91. + $(CC) $(LDFLAGS_PROG) $(CFLAGS) -o pppoe-discovery pppoe-discovery.o debug.o
  92. pppoe-discovery.o: pppoe-discovery.c
  93. $(CC) $(CFLAGS) -I../../.. -c -o pppoe-discovery.o pppoe-discovery.c
  94. @@ -38,7 +38,7 @@ debug.o: debug.c
  95. $(CC) $(CFLAGS) -I../../.. -c -o debug.o debug.c
  96. pppoe.so: plugin.o discovery.o if.o common.o
  97. - $(CC) $(LDFLAGS) -o pppoe.so -shared plugin.o discovery.o if.o common.o
  98. + $(CC) $(LDFLAGS) $(CFLAGS) -o pppoe.so -shared plugin.o discovery.o if.o common.o
  99. install: all
  100. $(INSTALL) -d -m 755 $(LIBDIR)
  101. diff --git a/pppd/plugins/pppol2tp/Makefile.linux b/pppd/plugins/pppol2tp/Makefile.linux
  102. index 1aa1c0b..899bb5f 100644
  103. --- a/pppd/plugins/pppol2tp/Makefile.linux
  104. +++ b/pppd/plugins/pppol2tp/Makefile.linux
  105. @@ -9,7 +9,6 @@ LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
  106. VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
  107. CFLAGS = $(COPTS) -I. -I../.. -I../../../include -fPIC
  108. -LDFLAGS_SHARED = -shared
  109. INSTALL = install
  110. PLUGINS := pppol2tp.so openl2tp.so
  111. @@ -17,7 +16,7 @@ PLUGINS := pppol2tp.so openl2tp.so
  112. all: $(PLUGINS)
  113. %.so: %.o
  114. - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LDFLAGS_SHARED) $^ $(LIBS)
  115. + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
  116. install: all
  117. $(INSTALL) -d -m 755 $(LIBDIR)
  118. diff --git a/pppd/plugins/radius/Makefile.linux b/pppd/plugins/radius/Makefile.linux
  119. index 489aef2..df90b17 100644
  120. --- a/pppd/plugins/radius/Makefile.linux
  121. +++ b/pppd/plugins/radius/Makefile.linux
  122. @@ -47,13 +47,13 @@ install: all
  123. $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR)
  124. radius.so: radius.o libradiusclient.a
  125. - $(CC) $(LDFLAGS) -o radius.so -shared radius.o libradiusclient.a
  126. + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
  127. radattr.so: radattr.o
  128. - $(CC) $(LDFLAGS) -o radattr.so -shared radattr.o
  129. + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
  130. radrealms.so: radrealms.o
  131. - $(CC) $(LDFLAGS) -o radrealms.so -shared radrealms.o
  132. + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
  133. CLIENTOBJS = avpair.o buildreq.o config.o dict.o ip_util.o \
  134. clientid.o sendserver.o lock.o util.o md5.o
  135. --
  136. 2.30.0