File: rules

package info (click to toggle)
fis-gtm 7.1-006-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,908 kB
  • sloc: ansic: 344,906; asm: 5,184; csh: 4,859; sh: 2,000; awk: 294; makefile: 73; sed: 13
file content (112 lines) | stat: -rwxr-xr-x 5,892 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
#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for fis-gtm

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

include /usr/share/dpkg/default.mk

MARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
ARCH := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
UAPIVER := $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's,+.*,,')
UAPIDIR := V$(UAPIVER)_$(ARCH)
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 --user root --group root --verbose \
			--noprompt-for-sys-cfg --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 \{\} \;
	# move some binaries from stage1 to $(BINPKG)
	mv debian/$(BINPKG)-stage1/usr/$(GTM_INSTALL_DIR)/gtcm_* debian/$(BINPKG)/usr/$(GTM_INSTALL_DIR)

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)/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)/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: shared-lib-without-dependency-information [usr/$(GTM_INSTALL_DIR)/libgtmutil.so]" >> debian/$(BINPKG).lintian-overrides
	echo "# The following permissions are really set intentionally in override_dh_fixpermissions" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): elevated-privileges 4500 root/root [usr/$(GTM_INSTALL_DIR)/gtmsecshrdir/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): elevated-privileges 4500 root/root [usr/$(GTM_INSTALL_DIR)/utf8/gtmsecshrdir/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): executable-is-not-world-readable 4500 [usr/$(GTM_INSTALL_DIR)/gtmsecshrdir/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): executable-is-not-world-readable 4500 [usr/$(GTM_INSTALL_DIR)/utf8/gtmsecshrdir/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): elevated-privileges 4755 root/root [usr/$(GTM_INSTALL_DIR)/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): elevated-privileges 4755 root/root [usr/$(GTM_INSTALL_DIR)/utf8/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-dir-perm 0500 != 0755 [usr/$(GTM_INSTALL_DIR)/gtmsecshrdir/]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-setuid-executable-perm 4500 [usr/$(GTM_INSTALL_DIR)/gtmsecshrdir/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): non-standard-setuid-executable-perm 4500 [usr/$(GTM_INSTALL_DIR)/utf8/gtmsecshrdir/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): package-contains-hardlink pointing to: usr/$(GTM_INSTALL_DIR)/gtmsecshr [usr/$(GTM_INSTALL_DIR)/utf8/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): package-contains-hardlink pointing to: usr/$(GTM_INSTALL_DIR)/gtmsecshrdir/gtmsecshr [usr/$(GTM_INSTALL_DIR)/utf8/gtmsecshrdir/gtmsecshr]" >> debian/$(BINPKG).lintian-overrides
	echo "$(BINPKG): shared-library-lacks-prerequisites [usr/$(GTM_INSTALL_DIR)/utf8/libgtmutil.so]" >> 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-$(DEB_VERSION_UPSTREAM).lintian-overrides