forked from zeromq/zproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zproject_debian.gsl
441 lines (411 loc) · 14.3 KB
/
zproject_debian.gsl
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# Generate debian recipes for project
#
# This is a code generator built using the iMatix GSL code generation
# language. See https://github.com/zeromq/gsl for details.
#
# Copyright (c) the Contributors as noted in the AUTHORS file.
# This file is part of zproject.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
register_target ("debian", "packaging for Debian")
.macro target_debian
.for project.main where ( defined(main.service) & main.service > 0 )
. systemd = 1
.endfor
.for project.target where ( target.name = "*" | target.name = "python_cffi" > 0 ) & project.exports_classes
. python_cffi = 1
.endfor
.directory.create ('packaging/debian')
.output "packaging/debian/changelog"
$(project.name:lower) ($(->version.major).$(->version.minor).$(->version.patch)-0.1) UNRELEASED; urgency=low
* Initial packaging.
-- $(project.name) Developers <$(project.email)> Wed, 31 Dec 2014 00:00:00 +0000
.output "packaging/debian/compat"
10
.output "packaging/debian/control"
#
# $(project.name) - $(project.description?'':)
#
. for project.license
# $(string.trim (license.):block )
. endfor
Source: $(string.replace (project.name, "_|-"):lower)
Section: net
Priority: optional
Maintainer: $(project.name) Developers <$(project.email)>
Standards-Version: 4.0.1.0
Build-Depends: debhelper (>= 9),
pkg-config,
.for project.use
.if defined(use.debian_name)
. if !(use.debian_name = '')
$(use.debian_name)\
. else
. echo "WARNING: debian_name=='' for $(use.project) - not added to packaging/debian/control"
. endif
.elsif regexp.match("^lib", use.libname)
$(string.replace (use.libname, "_|-"))-dev\
.else
lib$(string.replace (use.libname, "_|-"))-dev\
.endif
. if (use.min_version <> '0.0.0')
(>= $(use.min_version))\
. endif
,
.endfor
.if defined(use_cxx_gcc_4_9) & !(use_cxx_gcc_4_9 ?= 0)
gcc (>= 4.9.0), g++ (>= 4.9.0),
.endif
.if systemd ?= 1
.# necessary for systemd.pc to get unit install path
systemd,
.endif
.if python_cffi ?= 1
dh-python <!nopython>,
python3-all-dev <!nopython>, python3-cffi <!nopython>, python3-setuptools <!nopython>,
.endif
.- NOTE: after support for Debian 7 and Ubuntu 12.04 is dropped, <!nodoc> can be added to each of the following
asciidoc-base | asciidoc, xmlto,
dh-autoreconf
.if project.exports_classes | ( project.has_classes & project.has_main )
.# NOTE: Now for at least some compilers the symbol visibility seems to
.# be managed in the shared library files, not the "exportedness" - so
.# the delivered compiled binary files can use and do require those libs
.# packaged even if all classes are marked private - should have at least
.# one though. Also note that "bin" files are not necessarily compiled,
.# e.g. helper scripts, so are not covered in this clause.
.if defined (project->abi)
Package: $(string.replace (project.libname, "_|-"))$(project->abi.current - project->abi.age)
.else
Package: $(string.replace (project.libname, "_|-"))0
.endif
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: $(project.name) shared library
This package contains shared library for $(project.name):
$(project.description)
.endif
.if project.exports_classes
.# NOTE: The development libs/headers make sense if any class was not
.# marked private - different from just the lib package above.
Package: $(string.replace (project.libname, "_|-"))-dev
Architecture: any
Section: libdevel
Depends:
${misc:Depends},
.for project.use
.if defined(use.debian_name)
. if !(use.debian_name = '')
$(use.debian_name)\
. else
. echo "WARNING: debian_name=='' for $(use.project) - not added to packaging/debian/control"
. endif
.elsif regexp.match("^lib", use.libname)
$(string.replace (use.libname, "_|-"))-dev\
.else
lib$(string.replace (use.libname, "_|-"))-dev\
.endif
. if (use.min_version <> '0.0.0')
(>= $(use.min_version))\
. endif
,
.endfor
.if defined (project->abi)
$(string.replace (project.libname, "_|-"))$(project->abi.current - project->abi.age) (= ${binary:Version})
.else
$(string.replace (project.libname, "_|-"))0 (= ${binary:Version})
.endif
Description: $(project.name) development tools
This package contains development files for $(project.name):
$(project.description)
.endif
.if project.has_main | project.has_bin
Package: $(string.replace (project.name, "_|-"):lower)
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends},
.for project.use where use.type ?= "runtime"
.if defined(use.debian_name)
. if !(use.debian_name = '')
$(use.debian_name)\
. else
. echo "WARNING: debian_name=='' for $(use.project) - not added to packaging/debian/control"
. endif
.elsif regexp.match("^lib", use.libname)
$(string.replace (use.libname, "_|-"))\
.else
$(string.replace (use.project, "_|-"))\
.endif
. if (use.min_version <> '0.0.0')
(>= $(use.min_version))\
. endif
,
.endfor
Description: runnable binaries from $(project.name)
Main package for $(project.name):
$(project.description)
.endif
Package: $(string.replace (project.name, "_|-"):lower)-dbg
Architecture: any
Section: debug
Priority: optional
Depends:
.if project.has_main | project.has_bin
$(string.replace (project.name, "_|-"):lower) (= ${binary:Version}),
.elsif project.exports_classes
.if defined (project->abi)
$(string.replace (project.libname, "_|-"))$(project->abi.current - project->abi.age) (= ${binary:Version}),
.else
$(string.replace (project.libname, "_|-"))0 (= ${binary:Version}),
.endif
.endif
${misc:Depends}
Description: $(project.name) debugging symbols
This package contains the debugging symbols for $(project.name):
$(project.description).
.if python_cffi ?= 1
Package: python3-$(string.replace (project.name, "_|-"):lower)-cffi
Architecture: any
Section: python
Depends:
.if defined (project->abi)
$(string.replace (project.libname, "_|-"))$(project->abi.current - project->abi.age) (= ${binary:Version}),
.else
$(string.replace (project.libname, "_|-"))0 (= ${binary:Version}),
.endif
${misc:Depends}, ${shlibs:Depends},
${python3:Depends}, python3-cffi,
Description: Python 3 CFFI bindings for $(project.name)
This package contains Python 3 CFFI bindings for $(project.name).
.endif
.output "packaging/debian/copyright"
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: $(project.name)
Files: *
.if defined (project->starting_year)
Copyright: $(project->starting_year)- $(project.name) Developers <$(project.email)>
.else
Copyright: 2015- $(project.name) Developers <$(project.email)>
.endif
License: $(project.name)_license
. for project.license
$(string.replace(string.trim (license.), '\n\n|\n.\n'):block)
. endfor
.output "packaging/debian/format"
3.0 (quilt)
.output "packaging/debian/rules"
#!/usr/bin/make -f
# -*- makefile -*-
DRAFTS=no
DOCS=yes
# OBS build: add
# Macros:
# %_with_drafts 1
# at the BOTTOM of the OBS prjconf
OBS_BUILD_CFG=/.build/build.dist
ifeq ("\$(wildcard \$(OBS_BUILD_CFG))","")
BUILDCONFIG=\$(shell ls -1 /usr/src/packages/SOURCES/_buildconfig* | head -n 1)
endif
ifneq ("\$(wildcard \$(OBS_BUILD_CFG))","")
ifneq ("\$(shell grep drafts \$(OBS_BUILD_CFG))","")
DRAFTS=yes
endif
.if python_cffi ?= 1
ifneq ("\$(shell grep python3_cffi \$(OBS_BUILD_CFG))","")
PYTHON_CFFI=yes
endif
.endif
endif
# User build: DEB_BUILD_OPTIONS=drafts dpkg-buildpackage
ifneq (,\$(findstring drafts,\$(DEB_BUILD_OPTIONS)))
DRAFTS=yes
endif
ifneq (,\$(findstring nodoc,\$(DEB_BUILD_OPTIONS)))
DOCS=no
endif
ifneq (,\$(findstring nodoc,\$(DEB_BUILD_PROFILES)))
DOCS=no
endif
.if python_cffi ?= 1
# User build: DEB_BUILD_OPTIONS=python_cffi dpkg-buildpackage
ifneq (,\$(findstring python_cffi,\$(DEB_BUILD_OPTIONS)))
ifeq (,\$(findstring nopython,\$(DEB_BUILD_OPTIONS)))
ifeq (,\$(findstring nopython,\$(DEB_BUILD_PROFILES)))
PYTHON_CFFI=yes
WITH_PYTHON = --with=python3
endif
endif
endif
ifeq (yes,\$(PYTHON_CFFI))
export PYBUILD_NAME=$(project.name)-cffi
export PKG_CONFIG_PATH=\$(CURDIR)/bindings/python_cffi:$PKG_CONFIG_PATH
override_dh_auto_build:
dh_auto_build -O--buildsystem=autoconf
# Problem: we need pkg-config points to built and not yet installed copy of $(project.name)
# Solution: chicken-egg problem - let's make "fake" pkg-config file
sed -e "s@^libdir.*@libdir=\$(CURDIR)/src/.libs@" \
-e "s@^includedir.*@includedir=\$(CURDIR)/include@" \
src/$(string.replace (project.libname, "_|-")).pc > bindings/python_cffi/$(string.replace (project.libname, "_|-")).pc
dh_auto_build --sourcedirectory=bindings/python_cffi -O--buildsystem=pybuild
override_dh_auto_install:
dh_auto_install -O--buildsystem=autoconf
dh_auto_install --sourcedirectory=bindings/python_cffi -O--buildsystem=pybuild
override_dh_auto_clean:
dh_auto_clean -O--buildsystem=autoconf
dh_auto_clean -O--buildsystem=pybuild
rm -f bindings/python_cffi/*.pc
rm -rf bindings/python_cffi/*.egg-info/
else
WITH_PYTHON =
# This tells debhelper to avoid building the python CFFI packages
DH_OPTIONS += -Npython3-$(string.replace (project.name, "_|-"):lower)-cffi
export DH_OPTIONS
override_dh_auto_build:
dh_auto_build -O--buildsystem=autoconf
override_dh_auto_install:
dh_auto_install -O--buildsystem=autoconf
override_dh_auto_clean:
dh_auto_clean -O--buildsystem=autoconf
endif
.endif
\$(shell test -f src/Makemodule-local.am || touch src/Makemodule-local.am)
override_dh_strip:
dh_strip --dbg-package=$(string.replace (project.name, "_|-"):lower)-dbg
override_dh_auto_test:
echo "Skipped for now"
override_dh_auto_configure:
dh_auto_configure -- \\
.if systemd ?= 1
--with-systemd-units \\
.endif
.for project.use where use.optional
--with-$(use.libname)=yes \\
.endfor
--with-docs=\$(DOCS) \\
--enable-drafts=\$(DRAFTS)
%:
dh $@ \\
.if systemd ?= 1
--with systemd \\
.endif
.if python_cffi ?= 1
\$(WITH_PYTHON) \\
.endif
--parallel \\
--with autoreconf
.chmod_x ("packaging/debian/rules")
.discover_manpages(project)
.if project.has_main | project.has_bin
. output ("packaging/debian/$(string.replace (project.name, "_|-"):lower).manpages")
. for project.main where scope = "public" & project.has_main & man1 ?<> ""
debian/tmp/usr/share/man/man1/$(main.name).1
. endfor
. output ("packaging/debian/$(string.replace (project.name, "_|-"):lower).install")
.# generate binary names
. for project.main where scope = "public"
. if project.has_main
usr/bin/$(main.name)
. endif
. endfor
. for project.bin
usr/bin/$(bin.name)
. endfor
.# generate service file names
. for project.main where ( defined(main.service) & main.service > 0 )
. if !defined(main.no_config) | main.no_config ?= 0
etc/$(project.name)/$(main.name).cfg
. endif
. if file.exists("src/$(main.name).service") | file.exists("src/$(main.name).service.in") | ( main.service ?= 1 | main.service ?= 3 )
lib/systemd/system/$(main.name).service
. endif
. if file.exists("src/$(main.name)@.service") | file.exists("src/$(main.name)@.service.in") | ( main.service ?= 2 | main.service ?= 3 )
lib/systemd/system/$(main.name)@.service
. endif
. endfor
. for project.main where ( defined(main.timer) & main.timer > 0 )
. if file.exists("src/$(main.name).timer") | file.exists("src/$(main.name).timer.in") | ( main.timer ?= 1 | main.timer ?= 3 )
lib/systemd/system/$(main.name).timer
. endif
. if file.exists("src/$(main.name)@.timer") | file.exists("src/$(main.name)@.timer.in") | ( main.timer ?= 2 | main.timer ?= 3 )
lib/systemd/system/$(main.name)@.timer
. endif
. endfor
. for project.bin where ( defined(bin.service) & bin.service > 0 )
. if file.exists("src/$(bin.name).service") | file.exists("src/$(bin.name).service.in") | ( bin.service ?= 1 | bin.service ?= 3 )
lib/systemd/system/$(bin.name).service
. endif
. if file.exists("src/$(bin.name)@.service") | file.exists("src/$(bin.name)@.service.in") | ( bin.service ?= 2 | bin.service ?= 3 )
lib/systemd/system/$(bin.name)@.service
. endif
. endfor
. for project.bin where ( defined(bin.timer) & bin.timer > 0 )
. if file.exists("src/$(bin.name).timer") | file.exists("src/$(bin.name).timer.in") | ( bin.timer ?= 1 | bin.timer ?= 3 )
lib/systemd/system/$(bin.name).timer
. endif
. if file.exists("src/$(bin.name)@.timer") | file.exists("src/$(bin.name)@.timer.in") | ( bin.timer ?= 2 | bin.timer ?= 3 )
lib/systemd/system/$(bin.name)@.timer
. endif
. endfor
.insert_snippet ("debian.install")
.endif
.if project.exports_classes
.if defined (project->abi)
. output ("packaging/debian/$(string.replace (project.libname, "_|-"))$(project->abi.current - project->abi.age).install")
.else
. output ("packaging/debian/$(string.replace (project.libname, "_|-"))0.install")
.endif
usr/lib/*/$(project.libname).so.*
. output ("packaging/debian/$(string.replace (project.libname, "_|-"))-dev.install")
usr/include/*
usr/lib/*/$(project.libname).so
usr/lib/*/pkgconfig/$(project.libname).pc
. if count (class, defined (class.api))
usr/share/zproject
. endif
. output ("packaging/debian/$(string.replace (project.libname, "_|-"))-dev.manpages")
. if man3 ?<> ""
debian/tmp/usr/share/man/man3/*
. endif
. if man7 ?<> ""
debian/tmp/usr/share/man/man7/*
. endif
.endif
.output ("packaging/debian/$(string.replace (project.name, "_|-"):lower).dsc")
Format: 3.0 (quilt)
Binary: $(project.name)
Source: $(project.name)
Version: $(->version.major).$(->version.minor).$(->version.patch)-0.1
Maintainer: $(project.name) Developers <$(project.email)>
Architecture: any
Build-Depends: debhelper (>= 9),
pkg-config,
.for project.use
.if defined(use.debian_name)
. if !(use.debian_name = '')
$(use.debian_name)\
. else
. echo "WARNING: debian_name=='' for $(use.project) - not added to packaging/debian/control"
. endif
.elsif regexp.match("^lib", use.libname)
$(string.replace (use.libname, "_|-"))-dev\
.else
lib$(string.replace (use.libname, "_|-"))-dev\
.endif
. if (use.min_version <> '0.0.0')
(>= $(use.min_version))\
. endif
,
.endfor
.if systemd ?= 1
systemd,
.endif
.if python_cffi ?= 1
dh-python <!nopython>,
python3-all-dev <!nopython>, python3-cffi <!nopython>, python3-setuptools <!nopython>,
.endif
asciidoc-base | asciidoc, xmlto,
dh-autoreconf
Files:
7697688bf65a35bc33ae2db51ebb0e3b 818110 $(string.replace (project.name, "_|-"):lower).tar.gz
.endmacro