Date:2011-10-13 16:54:16 (12 years 5 months ago)
Author:Xiangfu Liu
Commit:1b3135c0034522a697e0041de0c06e0972282d17
Message:new package: SDL-widgets: a GUI toolkit on top of the SDL libraries

Files: libsdl-widgets/Makefile (1 diff)
libsdl-widgets/patches/001-remove-hard-code-compiler.patch (1 diff)

Change Details

libsdl-widgets/Makefile
1#
2# Copyright (C) 2011 Xiangfu Liu <xiangfu@sharism.cc>
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=libsdl-widgets
11PKG_VERSION:=0.4
12PKG_SOURCE:=SDL-widgets-$(PKG_VERSION).tar.gz
13PKG_SOURCE_URL:=http://members.chello.nl/w.boeke/SDL-widgets/
14PKG_BUILD_DIR:=$(BUILD_DIR)/SDL-widgets-$(PKG_VERSION)
15
16PKG_RELEASE:=1
17PKG_INSTALL:=1
18
19include $(INCLUDE_DIR)/package.mk
20
21define Package/libsdl-widgets
22  MAINTAINER:="Xiangfu Liu" <xiangfu@sharism.cc>
23  SECTION:=libs
24  CATEGORY:=Libraries
25  TITLE:=SDL-widgets
26  URL:=http://members.chello.nl/w.boeke/SDL-widgets/index.html
27  DEPENDS:=+libsdl-gfx +libsdl-ttf +dejavu-fonts-ttf-DejaVuSans +dejavu-fonts-ttf-DejaVuSans-Bold
28endef
29
30define Package/libsdl-widgets/description
31SDL-widgets is a GUI toolkit on top of the SDL libraries. It is written in C++. It's not especially intended for games, more for normal applications. This implicates: a possibly complicated SDL_Surface hierarchy, where surfaces can be hidden or shown, with sliders, menus, text areas, etc. Threads are supported, they may communicate via messages.
32endef
33
34TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/SDL \
35    -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
36
37define Build/Install
38endef
39
40define Build/InstallDev
41    mkdir -p $(1)/usr/include
42    mkdir -p $(1)/usr/lib
43    $(CP) $(PKG_BUILD_DIR)/sdl-widgets.h $(1)/usr/include/
44    $(CP) $(PKG_BUILD_DIR)/sdl-widgets.o $(1)/usr/lib/
45endef
46
47define Package/libsdl-widgets/install
48    $(INSTALL_DIR) $(1)/usr/share/sdl-widgets/
49    $(CP) $(PKG_BUILD_DIR)/testsw $(1)/usr/share/sdl-widgets/
50    $(CP) $(PKG_BUILD_DIR)/hello/hello $(1)/usr/share/sdl-widgets/
51    $(CP) $(PKG_BUILD_DIR)/make-waves/make-waves $(1)/usr/share/sdl-widgets/
52    $(CP) $(PKG_BUILD_DIR)/bouncy-tune/bouncy-tune $(1)/usr/share/sdl-widgets/
53    $(CP) $(PKG_BUILD_DIR)/bouncy-tune/rising.bcy $(1)/usr/share/sdl-widgets/
54endef
55
56$(eval $(call BuildPackage,libsdl-widgets))
libsdl-widgets/patches/001-remove-hard-code-compiler.patch
1diff --git a/Makefile b/Makefile
2index 8eaa069..d5d8a28 100644
3--- a/Makefile
4@@ -1,5 +1,5 @@
5-CC=g++
6-CFLAGS=-g -O $$(sdl-config --cflags) \
7+CXX=?g++
8+CFLAGS:=$(CFLAGS) -g -O $$(sdl-config --cflags) \
9   -Wall -Wuninitialized -Wshadow -Wno-non-virtual-dtor -Wno-multichar
10 OBJ=testsw.o sdl-widgets.o
11
12@@ -10,10 +10,10 @@ OBJ=testsw.o sdl-widgets.o
13 all: testsw hello make-waves bouncy-tune
14
15 testsw: $(OBJ)
16- $(CC) $(OBJ) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
17+ $(CXX) $(OBJ) $(CFLAGS) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
18
19 %.o: %.cpp
20- $(CC) -c $< $(CFLAGS)
21+ $(CXX) -c $< $(CFLAGS)
22
23 hello make-waves bouncy-tune:
24     make -C $@
25diff --git a/bouncy-tune/Makefile b/bouncy-tune/Makefile
26index 99ab226..da86574 100644
27--- a/bouncy-tune/Makefile
28@@ -1,17 +1,17 @@
29-CC=g++
30-CFLAGS=-g $$(sdl-config --cflags) \
31+CXX?=g++
32+CFLAGS+=-g $$(sdl-config --cflags) \
33   -O -Wuninitialized -Wshadow -Wall -Wno-non-virtual-dtor -Wno-multichar
34
35 .SUFFIXES=
36
37 bouncy-tune: bouncy-tune.o dump-wave.o ../sdl-widgets.o
38- $(CC) $@.o dump-wave.o ../sdl-widgets.o -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
39+ $(CXX) $@.o dump-wave.o ../sdl-widgets.o -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf $(CFLAGS)
40
41 ../sdl-widgets.o: ../sdl-widgets.cpp ../sdl-widgets.h ../sw-pixmaps.h
42     make -C .. sdl-widgets.o
43
44 %.o: %.cpp
45- $(CC) -c $< -I.. $(CFLAGS)
46+ $(CXX) -c $< -I.. $(CFLAGS)
47
48 bouncy-tune.o: ../sdl-widgets.h dump-wave.h templates.h
49 dump-wave.o: dump-wave.h
50diff --git a/configure b/configure
51index 568532f..028bf5c 100755
52--- a/configure
53@@ -1,5 +1,6 @@
54 echo -n "Searching C++ compiler ... "
55-[ -z `which g++` ] && { echo no; exit; }
56+[ -z `which ${CXX}` ] && { echo no; exit; }
57+echo -n "${CXX}"
58 echo yes
59
60 echo -n "Searching sdl-config ... "
61@@ -7,7 +8,7 @@ echo -n "Searching sdl-config ... "
62 echo yes
63
64 # create dummy object-file for testing of libraries
65-echo "int main(int,char **) { return 0; }" | g++ -c -x c++ -o tst.o -
66+echo "int main(int,char **) { return 0; }" | ${CXX} -c -x c++ -o tst.o -
67
68 okay=yes
69 LPATH=`sdl-config --libs | sed 's/ -l.*//;s/-L//'`
70@@ -15,7 +16,8 @@ echo "Searching libraries in $LPATH"
71 for LIB in SDL SDL_gfx SDL_ttf
72 do
73   echo -n "library $LIB ... "
74- g++ -L$LPATH -l$LIB tst.o 2>/dev/null
75+ echo "COMMAND: ${CXX} -L$LPATH -l$LIB tst.o 2>/dev/null"
76+ ${CXX} -L$LPATH -l$LIB -Wl,-rpath-link=${STAGING_DIR}/usr/lib tst.o 2>/dev/null
77   if [ $? = 0 ]
78   then echo yes
79   else echo no; okay=no
80@@ -33,7 +35,6 @@ if test $# -gt 1; then
81     FONTDIR="$1"
82   else
83     echo "unexpected option $1"
84- exit
85   fi
86 fi
87 FONTPATH=`find $FONTDIR -name FreeSans.ttf`
88@@ -45,10 +46,10 @@ then okay=no
89 else echo okay
90 fi
91
92-[ $okay = no ] && { echo "TrueType font-spec not found"; exit; }
93+[ $okay = no ] && { echo "TrueType font-spec not found"; }
94
95-echo "const char* FONTPATH=\"$FONTPATH\";" > config.h
96-echo "const char* FONTPATH_BOLD=\"$FONTPATH_BOLD\";" >> config.h
97-echo "const char* FONTPATH_MONO=\"$FONTPATH_MONO\";" >> config.h
98+echo "const char* FONTPATH=\"/usr/share/fonts/ttf-dejavu/DejaVuSans.ttf\";" > config.h
99+echo "const char* FONTPATH_BOLD=\"/usr/share/fonts/ttf-dejavu/DejaVuSans-Bold.ttf\";" >> config.h
100+echo "const char* FONTPATH_MONO=\"/usr/share/fonts/ttf-dejavu/DejaVuSans-Bold.ttf\";" >> config.h
101 echo "Created: config.h. Now you can run 'make'"
102
103diff --git a/hello/Makefile b/hello/Makefile
104index 4300250..520d145 100644
105--- a/hello/Makefile
106@@ -1,14 +1,14 @@
107-CC=g++
108-CFLAGS=-g $(shell sdl-config --cflags)
109-LFLAGS=$(shell sdl-config --libs) -lSDL_gfx -lSDL_ttf
110+CXX=?g++
111+CFLAGS+=-g $(shell sdl-config --cflags)
112+LFLAGS+=$(LDFLAGS) $(shell sdl-config --libs) -lSDL_gfx -lSDL_ttf
113
114 .SUFFIXES=
115
116 hello: hello.o ../sdl-widgets.o
117- $(CC) $@.o ../sdl-widgets.o -o $@ $(LFLAGS)
118+ $(CXX) $@.o ../sdl-widgets.o -o $@ $(LFLAGS) $(CFLAGS)
119
120 %.o: %.cpp
121- $(CC) -c $< -I.. $(CFLAGS)
122+ $(CXX) -c $< -I.. $(CFLAGS)
123
124 ../sdl-widgets.o: ../sdl-widgets.cpp ../sdl-widgets.h ../sw-pixmaps.h
125     make -C .. sdl-widgets.o
126diff --git a/make-waves/Makefile b/make-waves/Makefile
127index 738d638..2bb8e54 100644
128--- a/make-waves/Makefile
129@@ -1,18 +1,18 @@
130-CC=g++ -O
131-CFLAGS=-g $$(sdl-config --cflags) -I.. \
132+CXX=?g++ -O
133+CFLAGS+=-g $$(sdl-config --cflags) -I.. \
134   -Wuninitialized -Wshadow -Wall -Wno-non-virtual-dtor -Wno-multichar
135 OBJ= make-waves.o dump-wave.o ../sdl-widgets.o
136
137 .SUFFIXES=
138
139 make-waves: $(OBJ)
140- $(CC) $(OBJ) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
141+ $(CXX) $(CFLAGS) $(OBJ) -o $@ $$(sdl-config --libs) -lSDL_gfx -lSDL_ttf
142
143 ../sdl-widgets.o: ../sdl-widgets.cpp ../sdl-widgets.h ../sw-pixmaps.h
144     make -C .. sdl-widgets.o
145
146 %.o: %.cpp
147- $(CC) -c $< $(CFLAGS)
148+ $(CXX) -c $< $(CFLAGS)
149
150 make-waves.o: ../sdl-widgets.h dump-wave.h templates.h filter-test.cpp
151 dump-wave.o: dump-wave.h

Archive Download the corresponding diff file



interactive