Root/libsdl-widgets/patches/001-remove-hard-code-compiler.patch

Source at commit 1b3135c created 8 years 1 month ago.
By Xiangfu Liu, new package: SDL-widgets: a GUI toolkit on top of the SDL libraries
1diff --git a/Makefile b/Makefile
2index 8eaa069..d5d8a28 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -1,5 +1,5 @@
6-CC=g++
7-CFLAGS=-g -O $$(sdl-config --cflags) \
8+CXX=?g++
9+CFLAGS:=$(CFLAGS) -g -O $$(sdl-config --cflags) \
10   -Wall -Wuninitialized -Wshadow -Wno-non-virtual-dtor -Wno-multichar
11 OBJ=testsw.o sdl-widgets.o
12 
13@@ -10,10 +10,10 @@ OBJ=testsw.o sdl-widgets.o
14 all: testsw hello make-waves bouncy-tune
15 
16 testsw: $(OBJ)
17- $(CC) $(OBJ) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
18+ $(CXX) $(OBJ) $(CFLAGS) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
19 
20 %.o: %.cpp
21- $(CC) -c $< $(CFLAGS)
22+ $(CXX) -c $< $(CFLAGS)
23 
24 hello make-waves bouncy-tune:
25     make -C $@
26diff --git a/bouncy-tune/Makefile b/bouncy-tune/Makefile
27index 99ab226..da86574 100644
28--- a/bouncy-tune/Makefile
29+++ b/bouncy-tune/Makefile
30@@ -1,17 +1,17 @@
31-CC=g++
32-CFLAGS=-g $$(sdl-config --cflags) \
33+CXX?=g++
34+CFLAGS+=-g $$(sdl-config --cflags) \
35   -O -Wuninitialized -Wshadow -Wall -Wno-non-virtual-dtor -Wno-multichar
36 
37 .SUFFIXES=
38 
39 bouncy-tune: bouncy-tune.o dump-wave.o ../sdl-widgets.o
40- $(CC) $@.o dump-wave.o ../sdl-widgets.o -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
41+ $(CXX) $@.o dump-wave.o ../sdl-widgets.o -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf $(CFLAGS)
42 
43 ../sdl-widgets.o: ../sdl-widgets.cpp ../sdl-widgets.h ../sw-pixmaps.h
44     make -C .. sdl-widgets.o
45 
46 %.o: %.cpp
47- $(CC) -c $< -I.. $(CFLAGS)
48+ $(CXX) -c $< -I.. $(CFLAGS)
49 
50 bouncy-tune.o: ../sdl-widgets.h dump-wave.h templates.h
51 dump-wave.o: dump-wave.h
52diff --git a/configure b/configure
53index 568532f..028bf5c 100755
54--- a/configure
55+++ b/configure
56@@ -1,5 +1,6 @@
57 echo -n "Searching C++ compiler ... "
58-[ -z `which g++` ] && { echo no; exit; }
59+[ -z `which ${CXX}` ] && { echo no; exit; }
60+echo -n "${CXX}"
61 echo yes
62 
63 echo -n "Searching sdl-config ... "
64@@ -7,7 +8,7 @@ echo -n "Searching sdl-config ... "
65 echo yes
66 
67 # create dummy object-file for testing of libraries
68-echo "int main(int,char **) { return 0; }" | g++ -c -x c++ -o tst.o -
69+echo "int main(int,char **) { return 0; }" | ${CXX} -c -x c++ -o tst.o -
70 
71 okay=yes
72 LPATH=`sdl-config --libs | sed 's/ -l.*//;s/-L//'`
73@@ -15,7 +16,8 @@ echo "Searching libraries in $LPATH"
74 for LIB in SDL SDL_gfx SDL_ttf
75 do
76   echo -n "library $LIB ... "
77- g++ -L$LPATH -l$LIB tst.o 2>/dev/null
78+ echo "COMMAND: ${CXX} -L$LPATH -l$LIB tst.o 2>/dev/null"
79+ ${CXX} -L$LPATH -l$LIB -Wl,-rpath-link=${STAGING_DIR}/usr/lib tst.o 2>/dev/null
80   if [ $? = 0 ]
81   then echo yes
82   else echo no; okay=no
83@@ -33,7 +35,6 @@ if test $# -gt 1; then
84     FONTDIR="$1"
85   else
86     echo "unexpected option $1"
87- exit
88   fi
89 fi
90 FONTPATH=`find $FONTDIR -name FreeSans.ttf`
91@@ -45,10 +46,10 @@ then okay=no
92 else echo okay
93 fi
94 
95-[ $okay = no ] && { echo "TrueType font-spec not found"; exit; }
96+[ $okay = no ] && { echo "TrueType font-spec not found"; }
97 
98-echo "const char* FONTPATH=\"$FONTPATH\";" > config.h
99-echo "const char* FONTPATH_BOLD=\"$FONTPATH_BOLD\";" >> config.h
100-echo "const char* FONTPATH_MONO=\"$FONTPATH_MONO\";" >> config.h
101+echo "const char* FONTPATH=\"/usr/share/fonts/ttf-dejavu/DejaVuSans.ttf\";" > config.h
102+echo "const char* FONTPATH_BOLD=\"/usr/share/fonts/ttf-dejavu/DejaVuSans-Bold.ttf\";" >> config.h
103+echo "const char* FONTPATH_MONO=\"/usr/share/fonts/ttf-dejavu/DejaVuSans-Bold.ttf\";" >> config.h
104 echo "Created: config.h. Now you can run 'make'"
105  
106diff --git a/hello/Makefile b/hello/Makefile
107index 4300250..520d145 100644
108--- a/hello/Makefile
109+++ b/hello/Makefile
110@@ -1,14 +1,14 @@
111-CC=g++
112-CFLAGS=-g $(shell sdl-config --cflags)
113-LFLAGS=$(shell sdl-config --libs) -lSDL_gfx -lSDL_ttf
114+CXX=?g++
115+CFLAGS+=-g $(shell sdl-config --cflags)
116+LFLAGS+=$(LDFLAGS) $(shell sdl-config --libs) -lSDL_gfx -lSDL_ttf
117 
118 .SUFFIXES=
119 
120 hello: hello.o ../sdl-widgets.o
121- $(CC) $@.o ../sdl-widgets.o -o $@ $(LFLAGS)
122+ $(CXX) $@.o ../sdl-widgets.o -o $@ $(LFLAGS) $(CFLAGS)
123 
124 %.o: %.cpp
125- $(CC) -c $< -I.. $(CFLAGS)
126+ $(CXX) -c $< -I.. $(CFLAGS)
127 
128 ../sdl-widgets.o: ../sdl-widgets.cpp ../sdl-widgets.h ../sw-pixmaps.h
129     make -C .. sdl-widgets.o
130diff --git a/make-waves/Makefile b/make-waves/Makefile
131index 738d638..2bb8e54 100644
132--- a/make-waves/Makefile
133+++ b/make-waves/Makefile
134@@ -1,18 +1,18 @@
135-CC=g++ -O
136-CFLAGS=-g $$(sdl-config --cflags) -I.. \
137+CXX=?g++ -O
138+CFLAGS+=-g $$(sdl-config --cflags) -I.. \
139   -Wuninitialized -Wshadow -Wall -Wno-non-virtual-dtor -Wno-multichar
140 OBJ= make-waves.o dump-wave.o ../sdl-widgets.o
141 
142 .SUFFIXES=
143 
144 make-waves: $(OBJ)
145- $(CC) $(OBJ) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
146+ $(CXX) $(CFLAGS) $(OBJ) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
147 
148 ../sdl-widgets.o: ../sdl-widgets.cpp ../sdl-widgets.h ../sw-pixmaps.h
149     make -C .. sdl-widgets.o
150 
151 %.o: %.cpp
152- $(CC) -c $< $(CFLAGS)
153+ $(CXX) -c $< $(CFLAGS)
154 
155 make-waves.o: ../sdl-widgets.h dump-wave.h templates.h filter-test.cpp
156 dump-wave.o: dump-wave.h
157

Archive Download this file



interactive