File: rules

package info (click to toggle)
kicad 5.1.9%2Bdfsg1-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 240,044 kB
  • sloc: cpp: 464,812; ansic: 58,106; python: 4,972; sh: 488; awk: 294; makefile: 269; xml: 53; perl: 10
file content (173 lines) | stat: -rwxr-xr-x 6,408 bytes parent folder | download
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
#!/usr/bin/make -f
#export DH_VERBOSE=1

export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)

# out of tree build folder for kicad application
DEB_BUILD_DIR=debian/build
# default install folder
INSTDIR=$(CURDIR)/debian/tmp
# catching make jobs from DEB_BUILD_OPTIONS
PARALLEL_BUILD=$(echo $DEB_BUILD_OPTIONS | sed -e '/parallel=/!s/.*/1/;s/.*parallel=\([0-9]\+\).*/\1/g')

# other variables
include /usr/share/dpkg/pkg-info.mk
DATE            = $(shell date +'%Y-%m-%d' -d@"$(SOURCE_DATE_EPOCH)")
export REVDATE := $(shell TZ=UTC date -d@"$(SOURCE_DATE_EPOCH)" +%Y-%m-%d)

PREPROCESS_FILES := $(wildcard debian/*.in)

ASCIIDOCFILES := \
	doc/src/cvpcb/cvpcb.adoc \
	doc/src/doc_writing_style_policy/doc_writing_style_policy.adoc \
	doc/src/eeschema/eeschema.adoc \
	doc/src/gerbview/gerbview.adoc \
	doc/src/getting_started_in_kicad/getting_started_in_kicad.adoc \
	doc/src/gui_translation_howto/gui_translation_howto.adoc \
	doc/src/idf_exporter/idf_exporter.adoc \
	doc/src/kicad/kicad.adoc \
	doc/src/pcbnew/pcbnew.adoc \
	doc/src/pl_editor/pl_editor.adoc \
	doc/src/plugins/plugins.adoc \
	$(NULL)

DEB_KICAD_CMAKE_OPTS := \
	-DBUILD_GITHUB_PLUGIN=ON \
	-DCMAKE_CXX_FLAGS="$(CXXFLAGS) -DNDEBUG" \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$(LDFLAGS)" \
	-DKICAD_SCRIPTING=ON \
	-DKICAD_SCRIPTING_ACTION_MENU=ON \
	-DKICAD_SCRIPTING_PYTHON3=ON \
	-DKICAD_SCRIPTING_MODULES=ON \
	-DKICAD_SCRIPTING_WXPYTHON=ON \
	-DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON \
	-DKICAD_SPICE=ON \
	-DKICAD_USE_OCC=ON \
	-DKICAD_USE_OCE=OFF \
	$(NULL)

DEB_DOC_CMAKE_OPTS := \
	-DCMAKE_INSTALL_PREFIX=/usr \
	$(NULL)

DEB_I18N_CMAKE_OPTS := \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DKICAD_I18N_UNIX_STRICT_PATH=ON \
	$(NULL)

$(PREPROCESS_FILES:.in=): %: %.in
	sed -e 's,/@DEB_HOST_MULTIARCH@,$(DEB_HOST_MULTIARCH:%=/%),g' $< > $@

%:
	dh $@ --with-python3

override_dh_auto_configure:
	sed -i 's/@REVDATE@/$(REVDATE)/' $(ASCIIDOCFILES)
	# Replacing the hardcoded upstream version with the Debian version into the CMake KiCad versioning machanism.
	sed -i 's/^set( KICAD.*/set( KICAD_VERSION "$(DEB_VERSION)" )/g' CMakeModules/KiCadVersion.cmake
	mkdir -p $(DEB_BUILD_DIR)
	#################################
	# configuring KiCad application #
	#################################
	dh_auto_configure --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR) -- $(DEB_KICAD_CMAKE_OPTS)
	###################################
	# configuring KiCad documentation #
	###################################
	dh_auto_configure --sourcedirectory=$(CURDIR)/doc --builddirectory=$(DEB_BUILD_DIR)/doc -- $(DEB_DOC_CMAKE_OPTS)
	################################
	# configuring KiCad i18n files #
	################################
	dh_auto_configure --sourcedirectory=$(CURDIR)/i18n --builddirectory=$(DEB_BUILD_DIR)/i18n -- $(DEB_I18N_CMAKE_OPTS)

override_dh_auto_build-arch:
	##############################
	# building KiCad application #
	##############################
	dh_auto_build --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)

override_dh_auto_build-indep:
	################################
	# building KiCad documentation #
	################################
	dh_auto_build --sourcedirectory=$(CURDIR)/doc --builddirectory=$(DEB_BUILD_DIR)/doc
	#############################
	# building KiCad i18n files #
	#############################
	dh_auto_build --sourcedirectory=$(CURDIR)/i18n --builddirectory=$(DEB_BUILD_DIR)/i18n

override_dh_auto_install-arch: $(PREPROCESS_FILES:.in=)
	################################
	# installing KiCad application #
	################################
	dh_auto_install --destdir=$(INSTDIR) --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)
	###############################
	# installing KiCad i18n files #
	###############################
	dh_auto_install --destdir=$(INSTDIR) --sourcedirectory=$(CURDIR)/i18n --builddirectory=$(DEB_BUILD_DIR)/i18n
	# Removing a potentially added RUNPATH from the Pcbnew Python library.
	chrpath --delete $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages/_pcbnew.so
	# some tweaks before running the next dh sequencers
	# fixing icon sizes
	images=$$(find $(INSTDIR)/usr/share/icons/hicolor/48x48 -name "*.png"); \
	for f in $$images; do \
		size=$$(identify $$f | sed -n 's/.* PNG \(4[^ ]*\) .*/\1/ p'); \
		if [ "$$size" != "48x48" ]; then \
			echo "Resize $$(basename $$f) : $$size => 48x48"; \
			convert -resize '48x48!' $$f $$f.tmp && mv $$f.tmp $$f; \
		fi; \
	done
	# The kicad XPM icon comes with a to high resolution, fixing before install.
	convert -resize '32x32!' $(CURDIR)/bitmaps_png/icons/icon_kicad.xpm $(CURDIR)/bitmaps_png/icons/kicad.xpm

override_dh_auto_install-indep: $(PREPROCESS_FILES:.in=)
	##########################
	# installing KiCad demos #
	##########################
	dh_auto_install --destdir=$(INSTDIR) --sourcedirectory=$(CURDIR) --builddirectory=$(DEB_BUILD_DIR)/demos
	##################################
	# installing KiCad documentation #
	##################################
	dh_auto_install --destdir=$(INSTDIR) --sourcedirectory=$(CURDIR)/doc --builddirectory=$(DEB_BUILD_DIR)/doc

override_dh_install-arch:
	dh_install -a
	dh_python3

override_dh_install-indep:
	dh_install -i

override_dh_fixperms-arch:
	dh_fixperms
	# fixing file permissions for *.py files in kicad
	for i in `find $(CURDIR)/debian/kicad/usr -type f -name "*.py"`; do \
		FOUND_PYTHON=$$(head -n1 $$i | grep python); \
		if [ "$$FOUND_PYTHON" != "" ]; then \
			chmod +x $$i; \
		else \
			chmod -x $$i; \
		fi; \
	done

override_dh_missing:
	dh_missing --exclude usr/share/doc/kicad/scripts/lib_convert.py \
	           --exclude usr/share/doc/kicad/scripts/test_plugin.py \
	           --exclude usr/share/doc/kicad/scripts/test_kicad_plugin.py \
	           --exclude usr/share/doc/kicad/scripts/ddr3_length_match.py

override_dh_strip-arch:
	dh_strip
	# strip unneeded symbols from the kicad specific libraries in /usr/lib/kicad/
	strip --strip-unneeded --remove-section=.comment $(CURDIR)/debian/kicad/usr/lib/kicad/_*.kiface

override_dh_shlibdeps:
	dh_shlibdeps -a -l $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
		-Xlibkicad_3dsg \
		-Xlibs3d_plugin_idf \
		-Xlibs3d_plugin_vrml \
		-X_pcbnew.$(DEB_HOST_MULTIARCH)