1 | #default task |
---|
2 | |
---|
3 | DIR=$(shell pwd) |
---|
4 | |
---|
5 | ifndef UTT_DIST_DIR |
---|
6 | UTT_DIST_DIR=${DIR} |
---|
7 | endif |
---|
8 | |
---|
9 | ifndef UTT_DIST_OUTPUT |
---|
10 | UTT_DIST_OUTPUT=${DIR} |
---|
11 | endif |
---|
12 | |
---|
13 | # here there're few properties |
---|
14 | _PRODUCT_NAME=utt |
---|
15 | _UTT_VER=$(shell cat ../common/version.def) |
---|
16 | _UTT_REL=$(shell cat ../common/release.def) |
---|
17 | _DEB_FROOT=$(DIR)/deb_root |
---|
18 | _UTT_DIR=${_DEB_FROOT}/usr/local/$(_PRODUCT_NAME).$(_UTT_VER)-$(_UTT_REL) |
---|
19 | |
---|
20 | .PHONY: default |
---|
21 | default: make_control make_postinst make_prerm |
---|
22 | # first, we prepare some directory structure |
---|
23 | mkdir -p $(_DEB_FROOT)/DEBIAN |
---|
24 | mkdir -p $(_UTT_DIR) |
---|
25 | |
---|
26 | # next, we copy deb package files |
---|
27 | mv ./control $(_DEB_FROOT)/DEBIAN/ |
---|
28 | mv ./postinst $(_DEB_FROOT)/DEBIAN/ |
---|
29 | mv ./prerm $(_DEB_FROOT)/DEBIAN/ |
---|
30 | cd ${_DEB_FROOT} && tar -cvvf control.tar.gz DEBIAN/ |
---|
31 | cd ${DIR}; |
---|
32 | rm -fr ${_DEB_FROOT}/DEBIAN/ |
---|
33 | |
---|
34 | # we copy all necessery files (binaries) |
---|
35 | cp -r ${UTT_DIST_DIR}/* ${_UTT_DIR}/ |
---|
36 | cp ./changelog ${_UTT_DIR}/share/doc/$(_PRODUCT_NAME)/ |
---|
37 | # gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog |
---|
38 | cp ./changelog.Debian $(_UTT_DIR)/share/doc/$(_PRODUCT_NAME)/ |
---|
39 | # gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog.Debian |
---|
40 | cp ../files/* ${_UTT_DIR}/share/doc/${_PRODUCT_NAME}/ |
---|
41 | cp ../common/utt_make_config.pl ${_UTT_DIR}/bin/ |
---|
42 | chmod 755 ${_UTT_DIR}/bin/utt_make_config.pl |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | # # next we make man/doc archives |
---|
47 | # gzip --best $(_DEB_ROOT)/usr/share/man/man1/$(_PRODUCT_NAME).1 |
---|
48 | |
---|
49 | find $(_DEB_FROOT) -type d | xargs chmod 755 # this is necessary on Debian Woody, don't ask me why |
---|
50 | |
---|
51 | # finally, we buid deb package |
---|
52 | fakeroot dpkg-deb --build $(_DEB_FROOT) |
---|
53 | mv $(_DEB_FROOT).deb $(_PRODUCT_NAME)_$(_UTT_VER)-$(_UTT_REL).all.deb |
---|
54 | rm -rf ${_DEB_FROOT} |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | .PHONY: make_control |
---|
59 | make_control: |
---|
60 | echo "Package: $(_PRODUCT_NAME)" > control |
---|
61 | echo "Version: $(_UTT_VER)" >> control |
---|
62 | echo "Section: web" >> control |
---|
63 | echo "Priority: optional" >> control |
---|
64 | echo "Architecture: all" >> control |
---|
65 | echo "Essential: no" >> control |
---|
66 | |
---|
67 | echo "Depends: " >> control |
---|
68 | # here we read this information from file ../common/requirements.def |
---|
69 | #libwww-perl, acme-base (>= 1.2) <= wymagania pakietowe |
---|
70 | |
---|
71 | echo "Pre-Depends: perl" >> control |
---|
72 | |
---|
73 | echo "Maintainer: Adam Mickiewicz University" >> control |
---|
74 | echo "Provides: $(_PRODUCT_NAME)" >> control |
---|
75 | echo -n "Description: " >> control |
---|
76 | cat ../common/description.def >> control |
---|
77 | |
---|
78 | .PHONY: make_postinst |
---|
79 | make_postinst: |
---|
80 | echo "#!/bin/sh" > postinst |
---|
81 | echo "$(_INSTALL_DIR)/create_utt_config.pl" >> postinst |
---|
82 | echo "rm -f $(_INSTALL_DIR)/create_utt_config.pl" >> postinst |
---|
83 | |
---|
84 | .PHONY: make_prerm |
---|
85 | make_prerm: |
---|
86 | echo "#!/bin/sh" > prerm |
---|