Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 # -*- mode: makefile; coding: utf-8 -*-
3 # Copyright © 2007-2009 Felipe Sateler <[email protected]>
4 # Copyright © 2008-2010 Jonas Smedegaard <[email protected]>
5 # Copyright © 2021 IOhannes m zmölnig <[email protected]>
6 # Description: Main Debian packaging script for CSound
7 #
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2, or (at
11 # your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21 # Csound has many format errors, so disable that. Fix pending upstream
22 # https://github.com/csound/csound/pull/880
23 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
24
25 DPKG_EXPORT_BUILDFLAGS = 1
26 include /usr/share/dpkg/default.mk
27
28 DEB_CMAKE_EXTRA_FLAGS =
29
30 # Core options of csound
31 DEB_CMAKE_EXTRA_FLAGS += \
32 -DBUILD_RELEASE=ON \
33 -DFAIL_MISSING=ON \
34 -DUSE_DOUBLE=ON \
35 -DUSE_GETTEXT=ON \
36 -DUSE_GIT_COMMIT=OFF \
37 -DBUILD_STATIC_LIBRARY=ON \
38 -DUSE_LRINT=ON \
39 -DBUILD_UTILITIES=ON \
40 -DNEW_PARSER_DEBUG=OFF \
41 -DREQUIRE_PTHREADS=ON \
42 -DBUILD_MULTI_CORE=ON \
43 -DBUILD_TESTS=ON \
44 -DUSE_COMPILER_OPTIMIZATIONS=OFF \
45 -DLIBRARY_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
46 -DPYTHON3_MODULE_INSTALL_DIR=/usr/lib/python3/dist-packages \
47 -DJAVA_MODULE_INSTALL_DIR=/usr/lib \
48 -DLUA_MODULE_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH)/lua/5.1/ \
49 -DUSE_ATOMIC_BUILTIN=ON \
50 $(empty)
51
52 # I/O plugins
53 DEB_CMAKE_EXTRA_FLAGS += \
54 -DUSE_AUDIOUNIT=OFF \
55 -DUSE_COREMIDI=OFF \
56 -DUSE_PORTAUDIO=ON \
57 -DUSE_PORTMIDI=ON \
58 -DUSE_PULSEAUDIO=ON \
59 -DUSE_JACK=ON \
60 $(empty)
61
62 ifeq "$(DEB_HOST_ARCH_OS)" "linux"
63 DEB_CMAKE_EXTRA_FLAGS += -DUSE_ALSA=ON
64 else
65 DEB_CMAKE_EXTRA_FLAGS += -DUSE_ALSA=OFF
66 endif
67
68 # Optional opcodes
69 DEB_CMAKE_EXTRA_FLAGS += \
70 -DBUILD_DSSI_OPCODES=ON \
71 -DBUILD_DSSI_OPCODES=ON \
72 -DBUILD_OSC_OPCODES=ON \
73 -DUSE_CURL=OFF \
74 -DBUILD_PADSYNTH_OPCODES=ON \
75 -DBUILD_SCANSYN_OPCODES=OFF \
76 $(empty)
77
78 # Language Wrappers
79 # TODO: build for all Python versions (not only current default one)
80 # Force build of only the default one
81 DEB_CMAKE_EXTRA_FLAGS += \
82 -DBUILD_CXX_INTERFACE=ON \
83 -DBUILD_LUA_INTERFACE=ON \
84 $(empty)
85
86 # Frontends
87 DEB_CMAKE_EXTRA_FLAGS += \
88 -DBUILD_CSBEATS=ON \
89 -DBUILD_BELA=OFF \
90 $(empty)
91
92 DEB_CMAKE_EXTRA_FLAGS += \
93 -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \
94 $(empty)
95
96 # This is a huge optimization boost
97 ifneq "$(filter amd64 i386, $(DEB_HOST_ARCH_CPU))" ""
98 MTUNE = ON
99 endif
100 ifneq "$(filter amd64, $(DEB_HOST_ARCH_CPU))" ""
101 ENABLE_SIMD = 1
102 else
103 ENABLE_SIMD = 0
104 endif
105
106 # no java packages an hppa & hurd
107 ifeq (,$(filter $(DEB_HOST_ARCH),hppa hurd-i386))
108 DEB_CMAKE_EXTRA_FLAGS += \
109 -DBUILD_JAVA_INTERFACE=ON \
110 $(empty)
111 else
112 export DH_OPTIONS += -Nlibcsnd6-java
113 endif
114
115
116 BUILDDIR=obj-$(DEB_HOST_MULTIARCH)
117
118 %:
119 dh $@ --buildsystem=cmake+ninja --builddirectory=$(BUILDDIR)
120
121 PACKAGE_DATE = $(shell env --ignore-environment TZ=UTC LANG=C date -d@$(SOURCE_DATE_EPOCH) +%F)
122
123 override_dh_auto_configure:
124 sed -e 's,@MTUNE@,$(MTUNE),' \
125 -e 's,@ENABLE_SIMD@,$(ENABLE_SIMD),' \
126 -e 's,@DATE@,$(PACKAGE_DATE),' \
127 debian/Custom.cmake > \
128 Custom.cmake
129 dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)
130
131 execute_before_dh_auto_build:
132 @echo "blhc: ignore-line-regexp: ^C\+\+ analysis\.\.\.$$"
133
134 execute_after_dh_auto_build-indep:
135 mkdir -p doc/doxygen
136 cd doc && doxygen
137
138 override_dh_auto_test:
139 OPCODE6DIR64=$(BUILDDIR) dh_auto_test
140
141 execute_after_dh_auto_clean:
142 rm -f Custom.cmake
143 rm -rf doc/doxygen
144 rm -f tests/c/debug.orc tests/c/debug.sco
145 rm -f tests/c/*.wav
146 rm -f Android/CsoundAndroid/jni/version.h
147
148 execute_after_dh_auto_install-arch:
149 # don't install the static library
150 rm $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libcsound64.a
151 # fix overly generic name
152 mv $(CURDIR)/debian/tmp/usr/bin/extract \
153 $(CURDIR)/debian/tmp/usr/bin/csound_extract
154 # JAVA
155 mkdir -p $(CURDIR)/debian/tmp/usr/share/java
156 mv $(CURDIR)/debian/tmp/usr/lib/csnd6.jar \
157 $(CURDIR)/debian/tmp/usr/share/java/csnd6-$(DEB_VERSION_UPSTREAM).jar
158 ln -s csnd6-$(DEB_VERSION_UPSTREAM).jar $(CURDIR)/debian/tmp/usr/share/java/csnd6.jar
159 mkdir -p $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/jni
160 mv $(CURDIR)/debian/tmp/usr/lib/lib_jcsound6.so \
161 $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/jni
162 # create some manpages
163 debian/csound2man
164 debian/csoundutils2man
165
166 libcsound64-installdocs:
167 dh_installdocs -plibcsound64-doc --doc-main-package=libcsound64-dev
168 override_dh_installdocs-indep: libcsound64-installdocs
169 override_dh_installdocs-indep override_dh_installdocs-arch:
170 dh_installdocs --remaining-packages -A README.md AUTHORS
171
172
173 execute_after_dh_installdocs-indep:
174 dh_doxygen
175
176 DEB_COPYRIGHT_CHECK_IGNORE_REGEX = \
177 debian/.*|.*\.wav|.*\.aiff?|.*\.mp3|.*\.lpc|.*\.pvx|.*\.png|.*\.tiff|.*\.sf2|.*\.dat|tests/soak/HRTFcompact|.*\.jar|.*\.jar
178 # licensecheck v1
179 .PHONY: licensecheck
180 licensecheck:
181 LANG=C.UTF-8 licensecheck \
182 -i "^($(DEB_COPYRIGHT_CHECK_IGNORE_REGEX))$$" \
183 --check '.*' --recursive --deb-machine --lines 0 * \
184 > debian/copyright_newhints
185 cmp debian/copyright_hints debian/copyright_newhints \
186 && rm debian/copyright_newhints