blob: 8883e26adfd75c97c4464221cda941599640def9 [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001specify -fPIC after CFLAGS so it can override the CFLAGS containing -pie and -fpie
2this makes sure the objects that go into shared objects are compiled with -fPIC
3and not with -fpie. We can not use -fpie on objects which will go into .so files
4Fixes errors like
5
6| /mnt/oe/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/5.3.0/ld: shared/newt.o: relocation R_X86_64_PC32 against undefined symbol `SLtt_Screen_Rows@@SLANG2' can not be used when making a shared object; recompile with -fPIC
7| /mnt/oe/build/tmp-glibc/sysroots/x86_64-linux/usr/libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/5.3.0/ld: final link failed: Bad value
8| collect2: error: ld returned 1 exit status
9| make: *** [libnewt.so.0.52.18] Error 1
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Upstream-Status: Pending
13Index: newt-0.52.18/Makefile.in
14===================================================================
15--- newt-0.52.18.orig/Makefile.in
16+++ newt-0.52.18/Makefile.in
17@@ -96,8 +96,8 @@ _snack.$(SOEXT): snack.c $(LIBNEWTSH)
18 PIFLAGS=`$$pyconfig --includes`; \
19 PLDFLAGS=`$$pyconfig --ldflags`; \
20 PLFLAGS=`$$pyconfig --libs`; \
21- echo $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
22- $(CC) $(SHCFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
23+ echo $(CC) $(CPPFLAGS) $(SHCFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
24+ $(CC) $(CPPFLAGS) $(SHCFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
25 echo $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
26 $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L. -lnewt $(LIBS); \
27 done || :
28@@ -135,7 +135,7 @@ $(LIBNEWTSH): $(SHAREDOBJS)
29 ln -fs $(LIBNEWTSH) $(LIBNEWTSONAME)
30
31 $(SHAREDDIR)/%.o : %.c $(SHAREDDIR)
32- $(CC) $(SHCFLAGS) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
33+ $(CC) -c $(CFLAGS) $(CPPFLAGS) $(SHCFLAGS) -o $@ $<
34
35 install: $(LIBNEWT) install-sh whiptail
36 [ -d $(instroot)/$(bindir) ] || install -m 755 -d $(instroot)/$(bindir)