packaging.mk 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. VERSION = $(shell cat fbreader/VERSION)
  2. SOVERSIONCORE = $(shell cat zlibrary/core/SOVERSION)
  3. SOVERSIONTEXT = $(shell cat zlibrary/text/SOVERSION)
  4. TMPDIR = $(CURDIR)/fbreader-$(VERSION)
  5. motopkg:
  6. @echo -n 'Building $(ARCHITECTURE) $@ package...'
  7. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules build 1> $(ARCHITECTURE)-$@.log 2>&1
  8. @mkdir $(TMPDIR)
  9. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules DESTDIR=$(TMPDIR) install 1>> $(ARCHITECTURE)-$@.log 2>&1
  10. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules DESTDIR=$(TMPDIR) package 1>> $(ARCHITECTURE)-$@.log 2>&1
  11. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules clean 1> /dev/null 2>&1
  12. @rm -rf $(TMPDIR)
  13. @rm -f $(CURDIR)/$(ARCHITECTURE)-$@.log
  14. @echo ' OK'
  15. tarball:
  16. @echo -n 'Building $(ARCHITECTURE) $@ package...'
  17. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules build 1> $(ARCHITECTURE)-$@.log 2>&1
  18. @mkdir $(TMPDIR)
  19. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules DESTDIR=$(TMPDIR) install 1>> $(ARCHITECTURE)-$@.log 2>&1
  20. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules DESTDIR=$(TMPDIR) package 1>> $(ARCHITECTURE)-$@.log 2>&1
  21. @make -f $(DIST_DIR)/$@/$(ARCHITECTURE)/rules clean 1> /dev/null 2>&1
  22. @rm -rf $(TMPDIR)
  23. @rm -f $(CURDIR)/$(ARCHITECTURE)-$@.log
  24. @echo ' OK'
  25. debian:
  26. @echo -n 'Building $(ARCHITECTURE) debian package...'
  27. @mkdir $(TMPDIR)
  28. @cp -a Makefile zlibrary fbreader makefiles ChangeLog $(TMPDIR)
  29. @rm -rf `find $(TMPDIR) -name ".svn"`
  30. @mkdir $(TMPDIR)/debian
  31. @for file in $(DIST_DIR)/debian/$(ARCHITECTURE)/*; do \
  32. if [ -f $$file ]; then \
  33. sed -e "s#@SOVERSIONCORE@#$(SOVERSIONCORE)#g" $$file | \
  34. sed -e "s#@SOVERSIONTEXT@#$(SOVERSIONTEXT)#g" | \
  35. sed -e "s#@VERSION@#$(VERSION)#g" > $(TMPDIR)/debian/`basename $$file`; \
  36. chmod --reference $$file $(TMPDIR)/debian/`basename $$file`; \
  37. else \
  38. cp -r $$file $(TMPDIR)/debian/`basename $$file`; \
  39. fi; \
  40. done
  41. @cd $(TMPDIR); dpkg-buildpackage -rfakeroot -us -uc 1> $(CURDIR)/$(ARCHITECTURE)-debian.log 2>&1; cd $(CURDIR)
  42. @rm -rf $(TMPDIR)
  43. @rm -f $(CURDIR)/$(ARCHITECTURE)-debian.log
  44. @echo ' OK'
  45. ipk:
  46. @echo -n 'Building $(ARCHITECTURE) ipk package...'
  47. @make -f $(DIST_DIR)/ipk/$(ARCHITECTURE)/rules build 1> $(ARCHITECTURE)-ipk.log 2>&1
  48. @for controlfile in $(DIST_DIR)/ipk/$(ARCHITECTURE)/*.control; do \
  49. controlname=`basename $$controlfile .control`; \
  50. mkdir $(TMPDIR); \
  51. mkdir $(TMPDIR)/data; \
  52. make -f $(DIST_DIR)/ipk/$(ARCHITECTURE)/rules DESTDIR=$(TMPDIR)/data install-$$controlname 1>> $(ARCHITECTURE)-ipk.log 2>&1; \
  53. sed \
  54. -e "s#@VERSION@#$(VERSION)#" \
  55. -e "s#@SIZE@#`du -s -b $(TMPDIR)/data | cut -f1`#" \
  56. $$controlfile > $(TMPDIR)/control; \
  57. tar czf $(TMPDIR)/control.tar.gz -C $(TMPDIR) ./control; \
  58. tar czf $(TMPDIR)/data.tar.gz -C $(TMPDIR)/data .; \
  59. echo 2.0 > $(TMPDIR)/debian-binary; \
  60. tar czf `egrep ^Filename: $(TMPDIR)/control | cut -d' ' -f2` -C $(TMPDIR) ./debian-binary ./control.tar.gz ./data.tar.gz; \
  61. rm -rf $(TMPDIR); \
  62. done
  63. @make -f $(DIST_DIR)/ipk/$(ARCHITECTURE)/rules clean 1> /dev/null 2>&1;
  64. @rm -f $(CURDIR)/$(ARCHITECTURE)-ipk.log
  65. @echo ' OK'
  66. debipk:
  67. @echo -n 'Building $(ARCHITECTURE) debipk package...'
  68. @make -f $(DIST_DIR)/debipk/$(ARCHITECTURE)/rules build 1> $(ARCHITECTURE)-debipk.log 2>&1
  69. @for controlfile in $(DIST_DIR)/debipk/$(ARCHITECTURE)/*.control; do \
  70. controlname=`basename $$controlfile .control`; \
  71. mkdir $(TMPDIR); \
  72. make -f $(DIST_DIR)/debipk/$(ARCHITECTURE)/rules DESTDIR=$(TMPDIR) install-$$controlname 1>> $(ARCHITECTURE)-debipk.log 2>&1; \
  73. mkdir $(TMPDIR)/DEBIAN; \
  74. sed \
  75. -e "s#@VERSION@#$(VERSION)#" \
  76. -e "s#@SIZE@#`du -s -b $(TMPDIR) | cut -f1`#" \
  77. $$controlfile > $(TMPDIR)/DEBIAN/control; \
  78. dpkg -b $(TMPDIR) `sed "s#@VERSION@#$(VERSION)#" $(DIST_DIR)/debipk/$(ARCHITECTURE)/$$controlname.name` 1>> $(ARCHITECTURE)-debipk.log 2>&1; \
  79. rm -rf $(TMPDIR); \
  80. done
  81. @make -f $(DIST_DIR)/debipk/$(ARCHITECTURE)/rules clean 1> /dev/null 2>&1
  82. @rm -f $(CURDIR)/$(ARCHITECTURE)-debipk.log
  83. @echo ' OK'
  84. nsi:
  85. @echo -n 'Building $(ARCHITECTURE) nsi package...'
  86. @make -f $(DIST_DIR)/nsi/$(ARCHITECTURE)/rules build 1> $(ARCHITECTURE)-nsi.log 2>&1
  87. @mkdir $(TMPDIR)
  88. @make -f $(DIST_DIR)/nsi/$(ARCHITECTURE)/rules DESTDIR=$(TMPDIR) install 1>> $(ARCHITECTURE)-nsi.log 2>&1
  89. @sed "s#@VERSION@#$(VERSION)#" $(DIST_DIR)/nsi/$(ARCHITECTURE)/control.nsi > $(TMPDIR)/control.nsi
  90. @cd $(TMPDIR); makensis control.nsi 1>> $(CURDIR)/$(ARCHITECTURE)-nsi.log 2>&1
  91. @mv $(TMPDIR)/*.exe .
  92. @make -f $(DIST_DIR)/nsi/$(ARCHITECTURE)/rules clean 1> /dev/null 2>&1
  93. @rm -rf $(TMPDIR)
  94. @rm -f $(CURDIR)/$(ARCHITECTURE)-nsi.log
  95. @echo ' OK'