Debian Codegraph @

contrib/rpm/dxx-rebirth.spec

raw
1 # This spec file accepts the following RPM macros to influence what is built and how the build is invoked:
2 # _datarootdir: standard use; controls where to find game data files
3 # Note that this is only a default. The games can be told at runtime to
4 # search an additional directory.
5 # _prefix: standard use
6 # use_d1x: Define to 0 to skip building Descent 1. Define to 1 to build Descent 1. If undefined, assume 1.
7 # use_d2x: Define to 0 to skip building Descent 2. Define to 1 to build Descent 2. If undefined, assume 1.
8 # use_opengl: Define to 0 to skip building the OpenGL-enabled renderer. Define to 1 to build the OpenGL-enabled renderer. Most people will want this renderer. If undefined, assume 1.
9 # use_sdl: Define to 0 to skip building the SDL-only renderer. Define to 1 to build the SDL-only renderer. Most people will not want this renderer. If undefined, assume 0.
10 # ccache: Define to an empty string to disable ccache. Define to the path to ccache to use ccache. If undefined, $(type -p ccache) is used to search for ccache. If no ccache is found, then the build runs without ccache.
11 # __nprocs: number of concurrent build jobs to run. If undefined, job runs with SCons default (one job at a time).
12 # _host: CHOST. If defined, SConstruct will automatically use CHOST-qualified names for tools. If undefined, unqualified names are used.
13 #
14 # You cannot disable both d1x and d2x, because that would build nothing.
15 # You cannot disable both sdl and opengl, because that would build nothing.
16
17 Summary: Source port of Descent 1 and Descent 2
18 Name: dxx-rebirth
19 Version: 0.60_beta2_pre20190815
20 Release: 1
21 License: DXX-Rebirth
22 Group: Games/Arcade
23 Url: https://www.dxx-rebirth.com
24 Source: %{name}_v%{version}-src.tar.gz
25
26 # SDL libraries are required in both the SDL-only build and the OpenGL-enabled build.
27 BuildRequires: gcc-c++ libSDL-devel libSDL_mixer-devel libphysfs-devel scons
28
29 # If _datarootdir is unset, pretend it has the value of _prefix/share.
30 # Set _dxx_base_sharepath to _datarootdir/games
31 # Set _d1x_sharepath / _d2x_sharepath from that, and use those for the individual
32 # games.
33 %global _dxx_base_sharepath %{?_datarootdir:%_datarootdir}%{?!_datarootdir:%_prefix/share}/games
34 %global _use_d1x %{?use_d1x}%{?!use_d1x:1}
35 %global _use_d2x %{?use_d2x}%{?!use_d2x:1}
36 %global _use_opengl %{?use_opengl}%{?!use_opengl:1}
37 %global _use_sdl %{?use_sdl}%{?!use_sdl:0}
38
39 %if %{_use_opengl}
40 BuildRequires: libGL-devel
41 %endif
42
43 %if %{_use_d1x}
44 %global _d1x_sharepath %_dxx_base_sharepath/descent
45
46 %package -n d1x-rebirth
47 Summary: Supporting files for D1X-Rebirth
48 %description -n d1x-rebirth
49 Supporting files for D1X-Rebirth
50
51 %if %{_use_opengl}
52 %package -n d1x-rebirth-gl
53 Requires: d1x-rebirth
54 Summary: Descent 1 for Linux, OpenGL version
55 %description -n d1x-rebirth-gl
56 OpenGL-enabled source port of Descent 1.
57 %endif
58
59 %if %{_use_sdl}
60 %package -n d1x-rebirth-sdl
61 Requires: d1x-rebirth
62 Summary: Descent 1 for Linux, SDL version
63 %description -n d1x-rebirth-sdl
64 SDL-only source port of Descent 1.
65 %endif
66 %endif
67
68 %description
69 Empty top-level package to define the subpackages for D1X-Rebirth and D2X-Rebirth, SDL and GL variants.
70 - d1x-rebirth-gl
71 - d1x-rebirth-sdl
72 - d2x-rebirth-gl
73 - d2x-rebirth-sdl
74
75 %if %{_use_d2x}
76 %global _d2x_sharepath %_dxx_base_sharepath/descent2
77 %package -n d2x-rebirth
78 Summary: Supporting files for D2X-Rebirth
79 %description -n d2x-rebirth
80 Supporting files for D2X-Rebirth
81
82 %if %{_use_opengl}
83 %package -n d2x-rebirth-gl
84 Requires: d2x-rebirth
85 Summary: Descent 2 for Linux, OpenGL version
86 %description -n d2x-rebirth-gl
87 OpenGL-enabled source port of Descent 2.
88 %endif
89
90 %if %{_use_sdl}
91 %package -n d2x-rebirth-sdl
92 Requires: d2x-rebirth
93 Summary: Descent 2 for Linux, SDL version
94 %description -n d2x-rebirth-sdl
95 SDL-only source port of Descent 2.
96 %endif
97 %endif
98
99 %prep
100 %setup -n %{name}_v%{version}-src
101
102 %build
103
104 %if %{_use_d1x}
105 %if %{_use_d2x}
106 %define _requested_games dxx
107 %else
108 %define _requested_games d1x
109 %endif
110 %else
111 %if %{_use_d2x}
112 %define _requested_games d2x
113 %else
114 return 1
115 %error You must enable at least one game. Define use_d1x=1, use_d2x=1, or both.
116 %endif
117 %endif
118
119 %if !%{_use_sdl} && !%{_use_opengl}
120 %error You must enable at least one renderer. Define use_sdl=1, use_opengl=1, or both.
121 %endif
122
123 # Use a function so that variables can be made local and `set` does not clobber
124 # global arguments.
125 build_with_use() {
126 local ccache
127 set --
128 ccache="%{?ccache}%{?!ccache:$(type -p ccache)}"
129 if [[ -n "$ccache" ]]; then
130 set -- "ccache=$ccache"
131 fi
132
133 %define arguments_dxx() \\\
134 %if %{expand:%{_use_%{1}}} \
135 %if %{_use_opengl} \
136 %{1}_ogl_program_name=%{1}-rebirth-gl \\\
137 %endif \
138 %if %{_use_sdl} \
139 %{1}_sdl_program_name=%{1}-rebirth-sdl \\\
140 %endif \
141 %{1}_sharepath=%{expand:%{_%{1}_sharepath}} \\\
142 %endif
143
144 scons %{?__nprocs:"-j%__nprocs"} \
145 %{?_host:"CHOST=%_host"} \
146 "$@" \
147 builddir_prefix=build/ \
148 %{arguments_dxx d1x} \
149 %{arguments_dxx d2x} \
150 %if %{_use_sdl}
151 sdl_opengl=0 \
152 %_requested_games=sdl, \
153 %endif
154 %if %{_use_opengl}
155 %_requested_games=ogl, \
156 %endif
157 sdlmixer=1 \
158 "prefix=%{_prefix}" \
159 "--install-sandbox=%{buildroot}" \
160 verbosebuild=1 \
161 install
162 }
163
164 build_with_use
165
166 %install
167 %if %{_use_d1x}
168 install -dm 755 %buildroot%_d1x_sharepath \
169 %buildroot%_d1x_sharepath/missions
170 %endif
171 %if %{_use_d2x}
172 install -dm 755 %buildroot%_d2x_sharepath \
173 %buildroot%_d2x_sharepath/missions
174 %endif
175
176 %if %{_use_d1x}
177 %files -n d1x-rebirth
178 %doc d1x-rebirth/d1x.ini COPYING.txt d1x-rebirth/RELEASE-NOTES.txt
179 %dir %_d1x_sharepath
180 %dir %_d1x_sharepath/missions
181
182 %if %{_use_sdl}
183 %files -n d1x-rebirth-sdl
184 %_bindir/d1x-rebirth-sdl
185 %endif
186
187 %if %{_use_opengl}
188 %files -n d1x-rebirth-gl
189 %_bindir/d1x-rebirth-gl
190 %endif
191 %endif
192
193 %if %{_use_d2x}
194 %files -n d2x-rebirth
195 %doc d2x-rebirth/d2x.ini COPYING.txt d2x-rebirth/RELEASE-NOTES.txt
196 %dir %_d2x_sharepath
197 %dir %_d2x_sharepath/missions
198
199 %if %{_use_sdl}
200 %files -n d2x-rebirth-sdl
201 %_bindir/d2x-rebirth-sdl
202 %endif
203
204 %if %{_use_opengl}
205 %files -n d2x-rebirth-gl
206 %_bindir/d2x-rebirth-gl
207 %endif
208 %endif