PageRenderTime 91ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/make/py-hgsubversion.mk

https://bitbucket.org/rainlake/optware
Makefile | 278 lines | 135 code | 25 blank | 118 comment | 4 complexity | 4275fdc9c54453208998135e1bceba32 MD5 | raw file
  1. ###########################################################
  2. #
  3. # py-hgsubversion
  4. #
  5. ###########################################################
  6. #
  7. # PY-HGSUBVERSION_VERSION, PY-HGSUBVERSION_SITE and PY-HGSUBVERSION_SOURCE define
  8. # the upstream location of the source code for the package.
  9. # PY-HGSUBVERSION_DIR is the directory which is created when the source
  10. # archive is unpacked.
  11. # PY-HGSUBVERSION_UNZIP is the command used to unzip the source.
  12. # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
  13. #
  14. # You should change all these variables to suit your package.
  15. # Please make sure that you add a description, and that you
  16. # list all your packages' dependencies, seperated by commas.
  17. #
  18. # If you list yourself as MAINTAINER, please give a valid email
  19. # address, and indicate your irc nick if it cannot be easily deduced
  20. # from your name or email address. If you leave MAINTAINER set to
  21. # "NSLU2 Linux" other developers will feel free to edit.
  22. #
  23. PY-HGSUBVERSION_SITE=http://pypi.python.org/packages/source/h/hgsubversion
  24. PY-HGSUBVERSION_VERSION=1.2
  25. PY-HGSUBVERSION_SOURCE=hgsubversion-$(PY-HGSUBVERSION_VERSION).tar.gz
  26. PY-HGSUBVERSION_DIR=hgsubversion-$(PY-HGSUBVERSION_VERSION)
  27. PY-HGSUBVERSION_UNZIP=zcat
  28. PY-HGSUBVERSION_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
  29. PY-HGSUBVERSION_DESCRIPTION=hgsubversion is an extension for Mercurial that allows using Mercurial as a Subversion client.
  30. PY-HGSUBVERSION_SECTION=misc
  31. PY-HGSUBVERSION_PRIORITY=optional
  32. PY-HGSUBVERSION_DEPENDS=
  33. PY25-HGSUBVERSION_DEPENDS=py25-mercurial, svn-py
  34. PY26-HGSUBVERSION_DEPENDS=py26-mercurial, svn-py
  35. PY-HGSUBVERSION_CONFLICTS=
  36. #
  37. # PY-HGSUBVERSION_IPK_VERSION should be incremented when the ipk changes.
  38. #
  39. PY-HGSUBVERSION_IPK_VERSION=1
  40. #
  41. # PY-HGSUBVERSION_CONFFILES should be a list of user-editable files
  42. #PY-HGSUBVERSION_CONFFILES=/opt/etc/py-hgsubversion.conf /opt/etc/init.d/SXXpy-hgsubversion
  43. #
  44. # PY-HGSUBVERSION_PATCHES should list any patches, in the the order in
  45. # which they should be applied to the source code.
  46. #
  47. PY-HGSUBVERSION_PATCHES=$(PY-HGSUBVERSION_SOURCE_DIR)/setup-py.patch
  48. #
  49. # If the compilation of the package requires additional
  50. # compilation or linking flags, then list them here.
  51. #
  52. PY-HGSUBVERSION_CPPFLAGS=
  53. PY-HGSUBVERSION_LDFLAGS=
  54. #
  55. # PY-HGSUBVERSION_BUILD_DIR is the directory in which the build is done.
  56. # PY-HGSUBVERSION_SOURCE_DIR is the directory which holds all the
  57. # patches and ipkg control files.
  58. # PY-HGSUBVERSION_IPK_DIR is the directory in which the ipk is built.
  59. # PY-HGSUBVERSION_IPK is the name of the resulting ipk files.
  60. #
  61. # You should not change any of these variables.
  62. #
  63. PY-HGSUBVERSION_BUILD_DIR=$(BUILD_DIR)/py-hgsubversion
  64. PY-HGSUBVERSION_SOURCE_DIR=$(SOURCE_DIR)/py-hgsubversion
  65. #PY-HGSUBVERSION-COMMON_IPK_DIR=$(BUILD_DIR)/py-hgsubversion-common-$(PY-HGSUBVERSION_VERSION)-ipk
  66. #PY-HGSUBVERSION-COMMON_IPK=$(BUILD_DIR)/py-hgsubversion-common_$(PY-HGSUBVERSION_VERSION)-$(PY-HGSUBVERSION_IPK_VERSION)_$(TARGET_ARCH).ipk
  67. PY25-HGSUBVERSION_IPK_DIR=$(BUILD_DIR)/py25-hgsubversion-$(PY-HGSUBVERSION_VERSION)-ipk
  68. PY25-HGSUBVERSION_IPK=$(BUILD_DIR)/py25-hgsubversion_$(PY-HGSUBVERSION_VERSION)-$(PY-HGSUBVERSION_IPK_VERSION)_$(TARGET_ARCH).ipk
  69. PY26-HGSUBVERSION_IPK_DIR=$(BUILD_DIR)/py26-hgsubversion-$(PY-HGSUBVERSION_VERSION)-ipk
  70. PY26-HGSUBVERSION_IPK=$(BUILD_DIR)/py26-hgsubversion_$(PY-HGSUBVERSION_VERSION)-$(PY-HGSUBVERSION_IPK_VERSION)_$(TARGET_ARCH).ipk
  71. .PHONY: py-hgsubversion-source py-hgsubversion-unpack py-hgsubversion py-hgsubversion-stage py-hgsubversion-ipk py-hgsubversion-clean py-hgsubversion-dirclean py-hgsubversion-check
  72. #
  73. # This is the dependency on the source code. If the source is missing,
  74. # then it will be fetched from the site using wget.
  75. #
  76. $(DL_DIR)/$(PY-HGSUBVERSION_SOURCE):
  77. $(WGET) -P $(@D) $(PY-HGSUBVERSION_SITE)/$(@F) || \
  78. $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
  79. #
  80. # The source code depends on it existing within the download directory.
  81. # This target will be called by the top level Makefile to download the
  82. # source code's archive (.tar.gz, .bz2, etc.)
  83. #
  84. py-hgsubversion-source: $(DL_DIR)/$(PY-HGSUBVERSION_SOURCE) $(PY-HGSUBVERSION_PATCHES)
  85. #
  86. # This target unpacks the source code in the build directory.
  87. # If the source archive is not .tar.gz or .tar.bz2, then you will need
  88. # to change the commands here. Patches to the source code are also
  89. # applied in this target as required.
  90. #
  91. # This target also configures the build within the build directory.
  92. # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
  93. # and NOT $(MAKE) below. Passing it to configure causes configure to
  94. # correctly BUILD the Makefile with the right paths, where passing it
  95. # to Make causes it to override the default search paths of the compiler.
  96. #
  97. # If the compilation of the package requires other packages to be staged
  98. # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
  99. #
  100. $(PY-HGSUBVERSION_BUILD_DIR)/.configured: $(DL_DIR)/$(PY-HGSUBVERSION_SOURCE) $(PY-HGSUBVERSION_PATCHES) make/py-hgsubversion.mk
  101. $(MAKE) py-setuptools-stage
  102. rm -rf $(PY-HGSUBVERSION_BUILD_DIR)
  103. mkdir -p $(PY-HGSUBVERSION_BUILD_DIR)
  104. # 2.5
  105. rm -rf $(BUILD_DIR)/$(PY-HGSUBVERSION_DIR)
  106. $(PY-HGSUBVERSION_UNZIP) $(DL_DIR)/$(PY-HGSUBVERSION_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  107. if test -n "$(PY-HGSUBVERSION_PATCHES)"; then \
  108. cat $(PY-HGSUBVERSION_PATCHES) | patch -d $(BUILD_DIR)/$(PY-HGSUBVERSION_DIR) -p1; \
  109. fi
  110. mv $(BUILD_DIR)/$(PY-HGSUBVERSION_DIR) $(@D)/2.5
  111. (cd $(@D)/2.5; \
  112. ( \
  113. echo "[build_ext]"; \
  114. echo "include-dirs=$(STAGING_INCLUDE_DIR):$(STAGING_INCLUDE_DIR)/python2.5"; \
  115. echo "library-dirs=$(STAGING_LIB_DIR)"; \
  116. echo "rpath=/opt/lib"; \
  117. echo "[build_scripts]"; \
  118. echo "executable=/opt/bin/python2.5" \
  119. ) >> setup.cfg; \
  120. )
  121. # 2.6
  122. rm -rf $(BUILD_DIR)/$(PY-HGSUBVERSION_DIR)
  123. $(PY-HGSUBVERSION_UNZIP) $(DL_DIR)/$(PY-HGSUBVERSION_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  124. if test -n "$(PY-HGSUBVERSION_PATCHES)"; then \
  125. cat $(PY-HGSUBVERSION_PATCHES) | patch -d $(BUILD_DIR)/$(PY-HGSUBVERSION_DIR) -p1; \
  126. fi
  127. mv $(BUILD_DIR)/$(PY-HGSUBVERSION_DIR) $(@D)/2.6
  128. (cd $(@D)/2.6; \
  129. ( \
  130. echo "[build_ext]"; \
  131. echo "include-dirs=$(STAGING_INCLUDE_DIR):$(STAGING_INCLUDE_DIR)/python2.6"; \
  132. echo "library-dirs=$(STAGING_LIB_DIR)"; \
  133. echo "rpath=/opt/lib"; \
  134. echo "[build_scripts]"; \
  135. echo "executable=/opt/bin/python2.6" \
  136. ) >> setup.cfg; \
  137. )
  138. touch $@
  139. py-hgsubversion-unpack: $(PY-HGSUBVERSION_BUILD_DIR)/.configured
  140. #
  141. # This builds the actual binary.
  142. #
  143. $(PY-HGSUBVERSION_BUILD_DIR)/.built: $(PY-HGSUBVERSION_BUILD_DIR)/.configured
  144. rm -f $@
  145. (cd $(@D)/2.5; \
  146. CC='$(TARGET_CC)' LDSHARED='$(TARGET_CC) -shared' \
  147. PYTHONPATH=$(STAGING_LIB_DIR)/python2.5/site-packages \
  148. $(HOST_STAGING_PREFIX)/bin/python2.5 setup.py build \
  149. ; \
  150. )
  151. (cd $(@D)/2.6; \
  152. CC='$(TARGET_CC)' LDSHARED='$(TARGET_CC) -shared' \
  153. PYTHONPATH=$(STAGING_LIB_DIR)/python2.6/site-packages \
  154. $(HOST_STAGING_PREFIX)/bin/python2.6 setup.py build \
  155. ; \
  156. )
  157. touch $@
  158. #
  159. # This is the build convenience target.
  160. #
  161. py-hgsubversion: $(PY-HGSUBVERSION_BUILD_DIR)/.built
  162. #
  163. # If you are building a library, then you need to stage it too.
  164. #
  165. #$(PY-HGSUBVERSION_BUILD_DIR)/.staged: $(PY-HGSUBVERSION_BUILD_DIR)/.built
  166. # rm -f $@
  167. # $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
  168. # touch $@
  169. #
  170. #py-hgsubversion-stage: $(PY-HGSUBVERSION_BUILD_DIR)/.staged
  171. #
  172. # This rule creates a control file for ipkg. It is no longer
  173. # necessary to create a seperate control file under sources/py-hgsubversion
  174. #
  175. $(PY25-HGSUBVERSION_IPK_DIR)/CONTROL/control:
  176. @install -d $(@D)
  177. @rm -f $@
  178. @echo "Package: py25-hgsubversion" >>$@
  179. @echo "Architecture: $(TARGET_ARCH)" >>$@
  180. @echo "Priority: $(PY-HGSUBVERSION_PRIORITY)" >>$@
  181. @echo "Section: $(PY-HGSUBVERSION_SECTION)" >>$@
  182. @echo "Version: $(PY-HGSUBVERSION_VERSION)-$(PY-HGSUBVERSION_IPK_VERSION)" >>$@
  183. @echo "Maintainer: $(PY-HGSUBVERSION_MAINTAINER)" >>$@
  184. @echo "Source: $(PY-HGSUBVERSION_SITE)/$(PY-HGSUBVERSION_SOURCE)" >>$@
  185. @echo "Description: $(PY-HGSUBVERSION_DESCRIPTION)" >>$@
  186. @echo "Depends: $(PY25-HGSUBVERSION_DEPENDS)" >>$@
  187. @echo "Conflicts: $(PY-HGSUBVERSION_CONFLICTS)" >>$@
  188. $(PY26-HGSUBVERSION_IPK_DIR)/CONTROL/control:
  189. @install -d $(@D)
  190. @rm -f $@
  191. @echo "Package: py26-hgsubversion" >>$@
  192. @echo "Architecture: $(TARGET_ARCH)" >>$@
  193. @echo "Priority: $(PY-HGSUBVERSION_PRIORITY)" >>$@
  194. @echo "Section: $(PY-HGSUBVERSION_SECTION)" >>$@
  195. @echo "Version: $(PY-HGSUBVERSION_VERSION)-$(PY-HGSUBVERSION_IPK_VERSION)" >>$@
  196. @echo "Maintainer: $(PY-HGSUBVERSION_MAINTAINER)" >>$@
  197. @echo "Source: $(PY-HGSUBVERSION_SITE)/$(PY-HGSUBVERSION_SOURCE)" >>$@
  198. @echo "Description: $(PY-HGSUBVERSION_DESCRIPTION)" >>$@
  199. @echo "Depends: $(PY26-HGSUBVERSION_DEPENDS)" >>$@
  200. @echo "Conflicts: $(PY-HGSUBVERSION_CONFLICTS)" >>$@
  201. #
  202. # This builds the IPK file.
  203. #
  204. # Binaries should be installed into $(PY-HGSUBVERSION_IPK_DIR)/opt/sbin or $(PY-HGSUBVERSION_IPK_DIR)/opt/bin
  205. # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
  206. # Libraries and include files should be installed into $(PY-HGSUBVERSION_IPK_DIR)/opt/{lib,include}
  207. # Configuration files should be installed in $(PY-HGSUBVERSION_IPK_DIR)/opt/etc/py-hgsubversion/...
  208. # Documentation files should be installed in $(PY-HGSUBVERSION_IPK_DIR)/opt/doc/py-hgsubversion/...
  209. # Daemon startup scripts should be installed in $(PY-HGSUBVERSION_IPK_DIR)/opt/etc/init.d/S??py-hgsubversion
  210. #
  211. # You may need to patch your application to make it use these locations.
  212. #
  213. $(PY25-HGSUBVERSION_IPK): $(PY-HGSUBVERSION_BUILD_DIR)/.built
  214. rm -f $(BUILD_DIR)/py*-hgsubversion_*_$(TARGET_ARCH).ipk
  215. rm -rf $(PY25-HGSUBVERSION_IPK_DIR) $(BUILD_DIR)/py25-hgsubversion_*_$(TARGET_ARCH).ipk
  216. (cd $(PY-HGSUBVERSION_BUILD_DIR)/2.5; \
  217. PYTHONPATH=$(STAGING_LIB_DIR)/python2.5/site-packages \
  218. $(HOST_STAGING_PREFIX)/bin/python2.5 setup.py install \
  219. --root=$(PY25-HGSUBVERSION_IPK_DIR) --prefix=/opt; \
  220. )
  221. $(MAKE) $(PY25-HGSUBVERSION_IPK_DIR)/CONTROL/control
  222. cd $(BUILD_DIR); $(IPKG_BUILD) $(PY25-HGSUBVERSION_IPK_DIR)
  223. $(PY26-HGSUBVERSION_IPK): $(PY-HGSUBVERSION_BUILD_DIR)/.built
  224. rm -rf $(PY26-HGSUBVERSION_IPK_DIR) $(BUILD_DIR)/py26-hgsubversion_*_$(TARGET_ARCH).ipk
  225. (cd $(PY-HGSUBVERSION_BUILD_DIR)/2.6; \
  226. PYTHONPATH=$(STAGING_LIB_DIR)/python2.6/site-packages \
  227. $(HOST_STAGING_PREFIX)/bin/python2.6 setup.py install \
  228. --root=$(PY26-HGSUBVERSION_IPK_DIR) --prefix=/opt; \
  229. )
  230. $(MAKE) $(PY26-HGSUBVERSION_IPK_DIR)/CONTROL/control
  231. cd $(BUILD_DIR); $(IPKG_BUILD) $(PY26-HGSUBVERSION_IPK_DIR)
  232. #
  233. # This is called from the top level makefile to create the IPK file.
  234. #
  235. py-hgsubversion-ipk: $(PY25-HGSUBVERSION_IPK)
  236. #
  237. # This is called from the top level makefile to clean all of the built files.
  238. #
  239. py-hgsubversion-clean:
  240. -$(MAKE) -C $(PY-HGSUBVERSION_BUILD_DIR) clean
  241. #
  242. # This is called from the top level makefile to clean all dynamically created
  243. # directories.
  244. #
  245. py-hgsubversion-dirclean:
  246. rm -rf $(BUILD_DIR)/$(PY-HGSUBVERSION_DIR) $(PY-HGSUBVERSION_BUILD_DIR)
  247. rm -rf $(PY25-HGSUBVERSION_IPK_DIR) $(PY25-HGSUBVERSION_IPK)
  248. # rm -rf $(PY26-HGSUBVERSION_IPK_DIR) $(PY26-HGSUBVERSION_IPK)
  249. #
  250. # Some sanity check for the package.
  251. #
  252. py-hgsubversion-check: $(PY25-HGSUBVERSION_IPK)
  253. perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^