File: rules

package info (click to toggle)
fis-gtm 6.3-000A-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 34,688 kB
  • ctags: 36,764
  • sloc: ansic: 314,889; asm: 5,173; csh: 4,915; sh: 2,192; awk: 95; makefile: 87; sed: 13
file content (129 lines) | stat: -rwxr-xr-x 6,422 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
#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for fis-gtm

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

MARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
ARCH := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
UVER := $(shell LC_ALL=C dpkg-parsechangelog | awk '/^Version:/{sub(/-[0-9]*$$/,"");print $$2;}')
UAPIVER := $(shell echo $(UVER) | sed -e 's,+.*,,')
UAPIDIR := V$(UAPIVER)_$(ARCH)
SRCPKG := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
BINPKG := $(shell awk '/Package:.*[0-9]/{print $$2;}' debian/control)
GTM_INSTALL_DIR := lib/$(MARCH)/fis-gtm/$(UAPIDIR)
LOCAL_GTM_INSTALL_DIR := $(CURDIR)/debian/$(BINPKG)/usr/$(GTM_INSTALL_DIR)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_INSTALL_PREFIX:PATH=/usr -DGTM_INSTALL_DIR=$(GTM_INSTALL_DIR) -DCMAKE_BUILD_TYPE=Release

override_dh_auto_install:
	#echo "umask is: "
	#umask
	dh_auto_install --destdir=debian/$(BINPKG)-stage1 $@
	cd debian/$(BINPKG)-stage1/usr/$(GTM_INSTALL_DIR) && \
		gtm_destdir=$(CURDIR)/debian/$(BINPKG) \
		gtmcompile="-embed_source" \
		./gtminstall --utf8 default --user root --group root --verbose \
			--distrib . \
			--installdir $(LOCAL_GTM_INSTALL_DIR)
	#@echo "I: Removing redundant license file. One is already available."
	find $(LOCAL_GTM_INSTALL_DIR) -name COPYING -delete
	# remove empty directories
	find $(LOCAL_GTM_INSTALL_DIR) -type d -empty -delete
	# fix permissions of directories
	find $(LOCAL_GTM_INSTALL_DIR) -type d -exec chmod u+x \{\} \;

override_dh_fixperms:
	#echo "umask is: "
	#umask
	dh_fixperms
	#echo "overriding dh_fixperms"
	#echo "I: Fixing up permissions for removed write rights -- we aren't done yet!"
	chmod +w -R $(LOCAL_GTM_INSTALL_DIR)
	chmod +w -R $(LOCAL_GTM_INSTALL_DIR)/utf8
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/utf8
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/plugin
	#echo "I: Fixing up permissions for setuid rights -- we aren't done yet!"
	chmod 4755 $(LOCAL_GTM_INSTALL_DIR)/gtmsecshr
	chmod 0500 $(LOCAL_GTM_INSTALL_DIR)/gtmsecshrdir
	chmod 4500 $(LOCAL_GTM_INSTALL_DIR)/gtmsecshrdir/gtmsecshr
	#echo "I: changing permissions to 644 for files that will be sourced"
	chmod 0644 $(LOCAL_GTM_INSTALL_DIR)/gtmprofile
	chmod 0644 $(LOCAL_GTM_INSTALL_DIR)/gtmprofile_preV54000
	chmod 0644 $(LOCAL_GTM_INSTALL_DIR)/gtcm_slist
	chmod 0644 $(LOCAL_GTM_INSTALL_DIR)/gtmcshrc
	#echo "I: Fixing executable permissions"
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/dse
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/ftok
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/geteuid
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtcm_gnp_server
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtcm_pkdisp
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtcm_play
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtcm_run
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtcm_server
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtcm_shmclean
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtm
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtmbase
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtmstart
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/gtmstop
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/lke
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/mumps
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/mupip
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/semstat2
	chmod 0755 $(LOCAL_GTM_INSTALL_DIR)/plugin/gtmcrypt/*.sh

	#echo "I: Final permissions after dh_fixperms"
	#ls -l $(LOCAL_GTM_INSTALL_DIR)

# yoh: although it might sound to remove write permissions for the
# deployed materials, as far as I see it, it is useless, since the
# user (root) would always be able to revert them to become writable.

# Because 'the' binary package name will change, let's just generate
# override files
# The override is needed according to upstream for GTM to generate executable 'call-in's
override_dh_lintian:
	echo "$(BINPKG) binary: shlib-with-executable-stack usr/lib/*/fis-gtm/*/libgtmshr.so" >  debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG) binary: shared-lib-without-dependency-information usr/lib/*/fis-gtm/*/libgtmutil.so" >> debian/$(BINPKG).lintian-overrides
	echo "# The following permissions are really set intentionally in override_dh_fixpermissions" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): setuid-binary usr/lib/*/fis-gtm/*/gtmsecshrdir/gtmsecshr 4500 root/root" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): executable-is-not-world-readable usr/lib/*/fis-gtm/*/gtmsecshrdir/gtmsecshr 4500" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): setuid-binary usr/lib/*/fis-gtm/*/gtmsecshr 4755 root/root" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-dir-perm usr/lib/*/fis-gtm/*/gtmsecshrdir/ 0500 != 0755" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): package-contains-hardlink usr/lib/*/fis-gtm/*/gtmsecshr -> usr/lib/*/fis-gtm/*/utf8/gtmsecshr" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): package-contains-hardlink usr/lib/*/fis-gtm/*/gtmsecshrdir/gtmsecshr -> usr/lib/*/fis-gtm/*/utf8/gtmsecshrdir/gtmsecshr" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-dir-perm usr/lib/*/fis-gtm/*/ 0755 != 0755" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-dir-perm usr/lib/*/fis-gtm/*/plugin/gtmcrypt/ 0755 != 0755" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-dir-perm usr/lib/*/fis-gtm/utf8/gtmsecshrdir/ 0755 != 0755" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-executable-perm usr/lib/*/fis-gtm/*/plugin/gtmcrypt/maskpass 0755 != 0755" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-file-perm usr/lib/*/fis-gtm/*/* 0664 != 0644" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-file-perm usr/lib/*/fis-gtm/*/utf8/* 0664 != 0644" >> debian/$(BINPKG).lintian-overrides

	dh_lintian

override_dh_auto_clean:
	dh_auto_clean
	rm -rf debian/$(BINPKG)-stage1
	rm -f debian/fis-gtm.links debian/fis-gtm-$(UVER).lintian-overrides

# for some strange reason dh_strip does not seem to do a reliable job
# FIXME: there should be some more elegant solution like this
override_dh_strip:
	dh_strip
	if [ -d $(LOCAL_GTM_INSTALL_DIR) ] ; then \
	    cd $(LOCAL_GTM_INSTALL_DIR) ; \
	    strip dse gtcm_gnp_server gtcm_play gtcm_server gtcm_shmclean lke mupip ; \
	fi
	find $(LOCAL_GTM_INSTALL_DIR) -name maskpass -exec strip --remove-section=.comment \{\} \;

get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download --destdir=../tarballs