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