summaryrefslogtreecommitdiff
path: root/games-action/wordwarvi/files/wordwarvi-1.00-sound.patch
blob: 1f0fdb255d338294758f6e43906bce3f361791bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
diff --git a/Makefile b/Makefile
index faf7e8f..2c06010 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 PREFIX=/usr
-DATADIR=${PREFIX}/share/wordwarvi
+DATADIR?=${PREFIX}/share/wordwarvi
 MANDIR?=${PREFIX}/share/man
 MANPAGEDIR=${MANDIR}/man6
 
@@ -12,8 +12,8 @@ WITHAUDIO=yes
 # WITHAUDIO=no
 
 ifeq (${WITHAUDIO},yes)
-SNDLIBS=`pkg-config --libs portaudio-2.0 vorbisfile`
-SNDFLAGS=-DWITHAUDIOSUPPORT `pkg-config --cflags portaudio-2.0`
+SNDLIBS=`${PKG_CONFIG} --libs portaudio-2.0 vorbisfile`
+SNDFLAGS=-DWITHAUDIOSUPPORT `${PKG_CONFIG} --cflags portaudio-2.0`
 OGGOBJ=ogg_to_pcm.o
 else
 SNDLIBS=
@@ -24,53 +24,41 @@ endif
 CC ?= gcc
 BUILD_CC ?= gcc
 
-# DEBUG=-g
-# DEBUG=
-# PROFILE_FLAG=-pg
-#PROFILE_FLAG=
-#OPTIMIZE_FLAG=
-# OPTIMIZE_FLAG=-O3
-#OPTIMIZE_FLAG=-O3 -pedantic -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
-OPTIMIZE_FLAG=-O3 -pedantic
-
-
-LDFLAGS=${PROFILE_FLAG}
-
 DEFINES=${SNDFLAGS} -DDATADIR=\"${DATADIR}/\"
 
 all:	wordwarvi wordwarvi.6.gz
 
 HAS_PORTAUDIO_2_0:
 ifeq (${WITHAUDIO},yes)
-	pkg-config --print-errors --exists portaudio-2.0
+	${PKG_CONFIG} --print-errors --exists portaudio-2.0
 else
 endif
 
 HAS_VORBISFILE:
 ifeq (${WITHAUDIO},yes)
-	pkg-config --print-errors --exists vorbisfile
+	${PKG_CONFIG} --print-errors --exists vorbisfile
 else
 endif
 
 joystick.o:	joystick.c joystick.h Makefile
-	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} -pthread -Wall -c joystick.c
+	$(CC) ${DEBUG} ${PROFILE_FLAG} ${CFLAGS} -pthread -Wall -c joystick.c
 
 ogg_to_pcm.o:	ogg_to_pcm.c ogg_to_pcm.h Makefile
-	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} `pkg-config --cflags vorbisfile` \
+	$(CC) ${DEBUG} ${PROFILE_FLAG} ${CFLAGS} `${PKG_CONFIG} --cflags vorbisfile` \
 		-pthread -Wall -c ogg_to_pcm.c
 
 wwviaudio.o:	wwviaudio.c wwviaudio.h ogg_to_pcm.h my_point.h Makefile
-	$(CC) -Wall ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} \
+	$(CC) -Wall ${DEBUG} ${PROFILE_FLAG} ${CFLAGS} \
 		${DEFINES} \
-		-pthread `pkg-config --cflags vorbisfile` \
+		-pthread `${PKG_CONFIG} --cflags vorbisfile` \
 		-c wwviaudio.c
 
 rumble.o:	rumble.c rumble.h Makefile
-	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} `pkg-config --cflags vorbisfile` \
+	$(CC) ${DEBUG} ${PROFILE_FLAG} ${CFLAGS} `${PKG_CONFIG} --cflags vorbisfile` \
 		-pthread -Wall -c rumble.c
 
 wwvi_font.o:	wwvi_font.c wwvi_font.h my_point.h Makefile
-	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} -pthread -Wall -c wwvi_font.c
+	$(CC) ${DEBUG} ${PROFILE_FLAG} ${CFLAGS} -pthread -Wall -c wwvi_font.c
 
 stamp:	stamp.c
 	$(BUILD_CC) -o stamp stamp.c
@@ -78,14 +66,14 @@ stamp:	stamp.c
 wordwarvi:	wordwarvi.c joystick.o rumble.o ${OGGOBJ} wwviaudio.o wwvi_font.o \
 		Makefile version.h stamp levels.h rumble.h
 	./stamp > stamp.h
-	$(CC) ${DEBUG} ${PROFILE_FLAG} ${OPTIMIZE_FLAG} ${SCREENSAVERFLAG} -pthread -Wall  ${DEFINES} \
+	$(CC) $(LDFLAGS) ${DEBUG} ${PROFILE_FLAG} ${CFLAGS} ${SCREENSAVERFLAG} -pthread -Wall  ${DEFINES} \
 		joystick.o \
 		rumble.o \
 		wwvi_font.o \
 		${OGGOBJ} \
 		wwviaudio.o \
 		wordwarvi.c -o wordwarvi -lm ${SNDLIBS} \
-		`pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0 gthread-2.0`
+		`${PKG_CONFIG} --cflags gtk+-2.0` `${PKG_CONFIG} --libs gtk+-2.0 gthread-2.0`
 	/bin/rm stamp.h
 
 wordwarvi.6.gz:	wordwarvi.6
diff --git a/wwviaudio.c b/wwviaudio.c
index ad79d96..dca0cb4 100644
--- a/wwviaudio.c
+++ b/wwviaudio.c
@@ -121,7 +121,7 @@ int wwviaudio_read_ogg_clip(int clipnum, char *filename)
 	if (clipnum >= max_sound_clips || clipnum < 0)
 		return -1;
 
-	snprintf(filebuf, PATH_MAX, "%s/%s", DATADIR, filename);
+	snprintf(filebuf, PATH_MAX, "GENTOO_DATADIR/%s", DATADIR, filename);
 	rc = stat(filebuf, &statbuf);
 	if (rc != 0) {
 		strncpy(filebuf, filename, PATH_MAX);