PageRenderTime 43ms CodeModel.GetById 11ms RepoModel.GetById 1ms app.codeStats 0ms

/make/opendchub.mk

https://bitbucket.org/rainlake/optware
Makefile | 242 lines | 104 code | 20 blank | 118 comment | 5 complexity | 34d56f5b2d4df72e7c907d2e4457c5a2 MD5 | raw file
  1. ###########################################################
  2. #
  3. # opendchub
  4. #
  5. ###########################################################
  6. #
  7. # OPENDCHUB_VERSION, OPENDCHUB_SITE and OPENDCHUB_SOURCE define
  8. # the upstream location of the source code for the package.
  9. # OPENDCHUB_DIR is the directory which is created when the source
  10. # archive is unpacked.
  11. # OPENDCHUB_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. OPENDCHUB_SITE=http://$(SOURCEFORGE_MIRROR)/sourceforge/opendchub
  24. OPENDCHUB_VERSION=0.7.15
  25. OPENDCHUB_SOURCE=opendchub-$(OPENDCHUB_VERSION).tar.gz
  26. OPENDCHUB_DIR=opendchub-$(OPENDCHUB_VERSION)
  27. OPENDCHUB_UNZIP=zcat
  28. OPENDCHUB_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com>
  29. OPENDCHUB_DESCRIPTION=Open DC hub is a Unix/Linux version of the hub software for the Direct Connect network.
  30. OPENDCHUB_SECTION=net
  31. OPENDCHUB_PRIORITY=optional
  32. OPENDCHUB_DEPENDS=$(filter perl, $(PACKAGES))
  33. OPENDCHUB_SUGGESTS=
  34. OPENDCHUB_CONFLICTS=
  35. #
  36. # OPENDCHUB_IPK_VERSION should be incremented when the ipk changes.
  37. #
  38. OPENDCHUB_IPK_VERSION=1
  39. #
  40. # OPENDCHUB_CONFFILES should be a list of user-editable files
  41. #OPENDCHUB_CONFFILES=/opt/etc/opendchub.conf /opt/etc/init.d/SXXopendchub
  42. #
  43. # OPENDCHUB_PATCHES should list any patches, in the the order in
  44. # which they should be applied to the source code.
  45. #
  46. #OPENDCHUB_PATCHES=$(OPENDCHUB_SOURCE_DIR)/configure.patch
  47. #
  48. # If the compilation of the package requires additional
  49. # compilation or linking flags, then list them here.
  50. #
  51. OPENDCHUB_CPPFLAGS=
  52. OPENDCHUB_LDFLAGS=
  53. OPENDCHUB_PERL_LDFLAGS = \
  54. -L$(STAGING_LIB_DIR)/$(PERL_LIB_CORE_DIR) -Wl,-E -lperl -ldl \
  55. $(if $(filter uclibc, $(LIBC_STYLE)), -lm,) \
  56. $(if $(filter 5.8, $(PERL_MAJOR_VER)), \
  57. $(STAGING_LIB_DIR)/perl5/$(PERL_VERSION)/$(PERL_ARCH)/auto/DynaLoader/DynaLoader.a,)
  58. #
  59. # OPENDCHUB_BUILD_DIR is the directory in which the build is done.
  60. # OPENDCHUB_SOURCE_DIR is the directory which holds all the
  61. # patches and ipkg control files.
  62. # OPENDCHUB_IPK_DIR is the directory in which the ipk is built.
  63. # OPENDCHUB_IPK is the name of the resulting ipk files.
  64. #
  65. # You should not change any of these variables.
  66. #
  67. OPENDCHUB_BUILD_DIR=$(BUILD_DIR)/opendchub
  68. OPENDCHUB_SOURCE_DIR=$(SOURCE_DIR)/opendchub
  69. OPENDCHUB_IPK_DIR=$(BUILD_DIR)/opendchub-$(OPENDCHUB_VERSION)-ipk
  70. OPENDCHUB_IPK=$(BUILD_DIR)/opendchub_$(OPENDCHUB_VERSION)-$(OPENDCHUB_IPK_VERSION)_$(TARGET_ARCH).ipk
  71. .PHONY: opendchub-source opendchub-unpack opendchub opendchub-stage opendchub-ipk opendchub-clean opendchub-dirclean opendchub-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)/$(OPENDCHUB_SOURCE):
  77. $(WGET) -P $(@D) $(OPENDCHUB_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. opendchub-source: $(DL_DIR)/$(OPENDCHUB_SOURCE) $(OPENDCHUB_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. # If the package uses GNU libtool, you should invoke $(PATCH_LIBTOOL) as
  101. # shown below to make various patches to it.
  102. #
  103. $(OPENDCHUB_BUILD_DIR)/.configured: $(DL_DIR)/$(OPENDCHUB_SOURCE) $(OPENDCHUB_PATCHES) make/opendchub.mk
  104. ifeq (perl, $(filter perl, $(PACKAGES)))
  105. $(MAKE) perl-stage
  106. endif
  107. rm -rf $(BUILD_DIR)/$(OPENDCHUB_DIR) $(@D)
  108. $(OPENDCHUB_UNZIP) $(DL_DIR)/$(OPENDCHUB_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  109. if test -n "$(OPENDCHUB_PATCHES)" ; \
  110. then cat $(OPENDCHUB_PATCHES) | \
  111. patch -d $(BUILD_DIR)/$(OPENDCHUB_DIR) -p0 ; \
  112. fi
  113. if test "$(BUILD_DIR)/$(OPENDCHUB_DIR)" != "$(@D)" ; \
  114. then mv $(BUILD_DIR)/$(OPENDCHUB_DIR) $(@D) ; \
  115. fi
  116. (cd $(@D); \
  117. $(TARGET_CONFIGURE_OPTS) \
  118. CPPFLAGS="$(STAGING_CPPFLAGS) $(OPENDCHUB_CPPFLAGS)" \
  119. LDFLAGS="$(STAGING_LDFLAGS) $(OPENDCHUB_LDFLAGS)" \
  120. ./configure \
  121. --build=$(GNU_HOST_NAME) \
  122. --host=$(GNU_TARGET_NAME) \
  123. --target=$(GNU_TARGET_NAME) \
  124. $(if $(filter perl, $(PACKAGES)),,--disable-perl) \
  125. --prefix=/opt \
  126. --disable-nls \
  127. --disable-static \
  128. )
  129. # $(PATCH_LIBTOOL) $(@D)/libtool
  130. touch $@
  131. opendchub-unpack: $(OPENDCHUB_BUILD_DIR)/.configured
  132. #
  133. # This builds the actual binary.
  134. #
  135. $(OPENDCHUB_BUILD_DIR)/.built: $(OPENDCHUB_BUILD_DIR)/.configured
  136. rm -f $@
  137. $(MAKE) -C $(@D) \
  138. perl_flags="-I$(STAGING_LIB_DIR)/$(PERL_LIB_CORE_DIR)" \
  139. perl_libs="$(PERL_LDFLAGS) $(OPENDCHUB_PERL_LDFLAGS)" \
  140. ;
  141. touch $@
  142. #
  143. # This is the build convenience target.
  144. #
  145. opendchub: $(OPENDCHUB_BUILD_DIR)/.built
  146. #
  147. # If you are building a library, then you need to stage it too.
  148. #
  149. $(OPENDCHUB_BUILD_DIR)/.staged: $(OPENDCHUB_BUILD_DIR)/.built
  150. rm -f $@
  151. $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
  152. touch $@
  153. opendchub-stage: $(OPENDCHUB_BUILD_DIR)/.staged
  154. #
  155. # This rule creates a control file for ipkg. It is no longer
  156. # necessary to create a seperate control file under sources/opendchub
  157. #
  158. $(OPENDCHUB_IPK_DIR)/CONTROL/control:
  159. @install -d $(@D)
  160. @rm -f $@
  161. @echo "Package: opendchub" >>$@
  162. @echo "Architecture: $(TARGET_ARCH)" >>$@
  163. @echo "Priority: $(OPENDCHUB_PRIORITY)" >>$@
  164. @echo "Section: $(OPENDCHUB_SECTION)" >>$@
  165. @echo "Version: $(OPENDCHUB_VERSION)-$(OPENDCHUB_IPK_VERSION)" >>$@
  166. @echo "Maintainer: $(OPENDCHUB_MAINTAINER)" >>$@
  167. @echo "Source: $(OPENDCHUB_SITE)/$(OPENDCHUB_SOURCE)" >>$@
  168. @echo "Description: $(OPENDCHUB_DESCRIPTION)" >>$@
  169. @echo "Depends: $(OPENDCHUB_DEPENDS)" >>$@
  170. @echo "Suggests: $(OPENDCHUB_SUGGESTS)" >>$@
  171. @echo "Conflicts: $(OPENDCHUB_CONFLICTS)" >>$@
  172. #
  173. # This builds the IPK file.
  174. #
  175. # Binaries should be installed into $(OPENDCHUB_IPK_DIR)/opt/sbin or $(OPENDCHUB_IPK_DIR)/opt/bin
  176. # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
  177. # Libraries and include files should be installed into $(OPENDCHUB_IPK_DIR)/opt/{lib,include}
  178. # Configuration files should be installed in $(OPENDCHUB_IPK_DIR)/opt/etc/opendchub/...
  179. # Documentation files should be installed in $(OPENDCHUB_IPK_DIR)/opt/doc/opendchub/...
  180. # Daemon startup scripts should be installed in $(OPENDCHUB_IPK_DIR)/opt/etc/init.d/S??opendchub
  181. #
  182. # You may need to patch your application to make it use these locations.
  183. #
  184. $(OPENDCHUB_IPK): $(OPENDCHUB_BUILD_DIR)/.built
  185. rm -rf $(OPENDCHUB_IPK_DIR) $(BUILD_DIR)/opendchub_*_$(TARGET_ARCH).ipk
  186. $(MAKE) -C $(OPENDCHUB_BUILD_DIR) DESTDIR=$(OPENDCHUB_IPK_DIR) install
  187. $(STRIP_COMMAND) $(OPENDCHUB_IPK_DIR)/opt/*bin/*
  188. install -d $(OPENDCHUB_IPK_DIR)/opt/share/doc/opendchub
  189. install $(OPENDCHUB_BUILD_DIR)/[ACRN]* \
  190. $(OPENDCHUB_BUILD_DIR)/Documentation/* \
  191. $(OPENDCHUB_BUILD_DIR)/Samplescripts/* \
  192. $(OPENDCHUB_IPK_DIR)/opt/share/doc/opendchub/
  193. # install -d $(OPENDCHUB_IPK_DIR)/opt/etc/
  194. # install -m 644 $(OPENDCHUB_SOURCE_DIR)/opendchub.conf $(OPENDCHUB_IPK_DIR)/opt/etc/opendchub.conf
  195. # install -d $(OPENDCHUB_IPK_DIR)/opt/etc/init.d
  196. # install -m 755 $(OPENDCHUB_SOURCE_DIR)/rc.opendchub $(OPENDCHUB_IPK_DIR)/opt/etc/init.d/SXXopendchub
  197. # sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(OPENDCHUB_IPK_DIR)/opt/etc/init.d/SXXopendchub
  198. $(MAKE) $(OPENDCHUB_IPK_DIR)/CONTROL/control
  199. echo $(OPENDCHUB_CONFFILES) | sed -e 's/ /\n/g' > $(OPENDCHUB_IPK_DIR)/CONTROL/conffiles
  200. cd $(BUILD_DIR); $(IPKG_BUILD) $(OPENDCHUB_IPK_DIR)
  201. #
  202. # This is called from the top level makefile to create the IPK file.
  203. #
  204. opendchub-ipk: $(OPENDCHUB_IPK)
  205. #
  206. # This is called from the top level makefile to clean all of the built files.
  207. #
  208. opendchub-clean:
  209. rm -f $(OPENDCHUB_BUILD_DIR)/.built
  210. -$(MAKE) -C $(OPENDCHUB_BUILD_DIR) clean
  211. #
  212. # This is called from the top level makefile to clean all dynamically created
  213. # directories.
  214. #
  215. opendchub-dirclean:
  216. rm -rf $(BUILD_DIR)/$(OPENDCHUB_DIR) $(OPENDCHUB_BUILD_DIR) $(OPENDCHUB_IPK_DIR) $(OPENDCHUB_IPK)
  217. #
  218. #
  219. # Some sanity check for the package.
  220. #
  221. opendchub-check: $(OPENDCHUB_IPK)
  222. perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $(OPENDCHUB_IPK)