PageRenderTime 28ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/make/qt-embedded.mk

https://bitbucket.org/rainlake/optware
Makefile | 330 lines | 176 code | 21 blank | 133 comment | 5 complexity | 9e18fb1106fd7104b9e0451e2fb2ea84 MD5 | raw file
  1. ###########################################################
  2. #
  3. # qt-embedded
  4. #
  5. ###########################################################
  6. #
  7. # TODO:
  8. # host staging - some programs need to build and execute Qt apps during build
  9. # enable more features - glib support causes link failures on ARM, possibly
  10. # other targets, javascript JIT, webkit and the unixodbc driver are not
  11. # compiled
  12. # split build - separate net, sql, possibly individual sql plugins from core
  13. # libraries, probably only core should ever need host staging
  14. #
  15. #
  16. # QT-EMBEDDED_VERSION, QT-EMBEDDED_SITE and QT-EMBEDDED_SOURCE define
  17. # the upstream location of the source code for the package.
  18. # QT-EMBEDDED_DIR is the directory which is created when the source
  19. # archive is unpacked.
  20. # QT-EMBEDDED_UNZIP is the command used to unzip the source.
  21. # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
  22. #
  23. # You should change all these variables to suit your package.
  24. # Please make sure that you add a description, and that you
  25. # list all your packages' dependencies, seperated by commas.
  26. #
  27. # If you list yourself as MAINTAINER, please give a valid email
  28. # address, and indicate your irc nick if it cannot be easily deduced
  29. # from your name or email address. If you leave MAINTAINER set to
  30. # "NSLU2 Linux" other developers will feel free to edit.
  31. #
  32. QT-EMBEDDED_SITE=http://get.qt.nokia.com/qt/source/
  33. QT-EMBEDDED_VERSION=4.6.2
  34. QT-EMBEDDED_SOURCE=qt-everywhere-opensource-src-$(QT-EMBEDDED_VERSION).tar.gz
  35. QT-EMBEDDED_DIR=qt-everywhere-opensource-src-$(QT-EMBEDDED_VERSION)
  36. QT-EMBEDDED_UNZIP=zcat
  37. QT-EMBEDDED_MAINTAINER=Andrew Mahone <andrew.mahone@gmail.com>
  38. QT-EMBEDDED_DESCRIPTION=Qt library, embedded version.
  39. QT-EMBEDDED_SECTION=libs
  40. QT-EMBEDDED_PRIORITY=optional
  41. QT-EMBEDDED_DEPENDS=zlib, libtiff, libjpeg, libpng
  42. QT-EMBEDDED_SUGGESTS=openssl, mysql5, sqlite, dbus, postgresql
  43. QT-EMBEDDED_CONFLICTS=
  44. QT-EMBEDDED_TOOLS=lrelease qmake uic moc rcc
  45. QT-EMBEDDED_CFLAGS=$(TARGET_CFLAGS)
  46. QT-EMBEDDED_CFLAGS+='"-I$(STAGING_DIR)/opt/include"'
  47. QT-EMBEDDED_CFLAGS+='"-I$(STAGING_DIR)/opt/include/mysql"'
  48. QT-EMBEDDED_LFLAGS+='"-L$(STAGING_DIR)/opt/lib"'
  49. QT-EMBEDDED_LFLAGS+='"-L$(STAGING_DIR)/opt/lib/mysql"'
  50. QT-EMBEDDED_LFLAGS+='"-Wl,-rpath=/opt/lib"'
  51. QT-EMBEDDED_LFLAGS+='"-Wl,-rpath=/opt/lib/mysql"'
  52. QT-EMBEDDED_LFLAGS+='"-Wl,-rpath-link=$(STAGING_DIR)/opt/lib"'
  53. QT-EMBEDDED_LFLAGS+='"-Wl,-rpath-link=$(STAGING_DIR)/opt/lib/mysql"'
  54. ifeq (yes, $(TARGET_CC_PROBE))
  55. QT-EMBEDDED_PLATFORM=-platform linux-g++-custom
  56. else
  57. QT-EMBEDDED_CROSS=$(GNU_TARGET_NAME)-
  58. QT-EMBEDDED_PATH=PATH="$$PATH:$(TARGET_CROSS_TOP)/bin"
  59. QT-EMBEDDED_PLATFORM=$(patsubst mips%,mips,$(patsubst arm%,arm,$(patsubst i%86,i386,$(TARGET_ARCH)))) -xplatform linux-g++-custom
  60. endif
  61. QT-EMBEDDED_QMAKE='include(../common/g++.conf)'
  62. QT-EMBEDDED_QMAKE+='\ninclude(../common/linux.conf)'
  63. QT-EMBEDDED_QMAKE+='\ninclude(../common/qws.conf)'
  64. QT-EMBEDDED_QMAKE+='\nQMAKE_CC = $(QT-EMBEDDED_CROSS)gcc $(QT-EMBEDDED_CFLAGS)'
  65. QT-EMBEDDED_QMAKE+='\nQMAKE_CXX = $(QT-EMBEDDED_CROSS)g++ $(QT-EMBEDDED_CFLAGS)'
  66. QT-EMBEDDED_QMAKE+='\nQMAKE_LINK = $(QT-EMBEDDED_CROSS)g++ $(QT-EMBEDDED_LFLAGS)'
  67. QT-EMBEDDED_QMAKE+='\nQMAKE_LINK_SHLIB = $(QT-EMBEDDED_CROSS)g++ $(QT-EMBEDDED_LFLAGS)'
  68. QT-EMBEDDED_QMAKE+='\nQMAKE_AR = $(QT-EMBEDDED_CROSS)ar cqs'
  69. QT-EMBEDDED_QMAKE+='\nQMAKE_OBJCOPY = $(QT-EMBEDDED_CROSS)objcopy'
  70. QT-EMBEDDED_QMAKE+='\nQMAKE_STRIP = $(QT-EMBEDDED_CROSS)strip'
  71. QT-EMBEDDED_QMAKE+='\nload(qt_config)'
  72. #
  73. # QT-EMBEDDED_IPK_VERSION should be incremented when the ipk changes.
  74. #
  75. QT-EMBEDDED_IPK_VERSION=1
  76. #
  77. # QT-EMBEDDED_CONFFILES should be a list of user-editable files
  78. #QT-EMBEDDED_CONFFILES=/opt/etc/qt-embedded.conf /opt/etc/init.d/SXXqt-embedded
  79. #
  80. # QT-EMBEDDED_PATCHES should list any patches, in the the order in
  81. # which they should be applied to the source code.
  82. #
  83. #QT-EMBEDDED_PATCHES=$(QT-EMBEDDED_SOURCE_DIR)/configure.patch
  84. #
  85. # If the compilation of the package requires additional
  86. # compilation or linking flags, then list them here.
  87. #
  88. QT-EMBEDDED_CPPFLAGS=
  89. QT-EMBEDDED_LDFLAGS=
  90. #
  91. # QT-EMBEDDED_BUILD_DIR is the directory in which the build is done.
  92. # QT-EMBEDDED_SOURCE_DIR is the directory which holds all the
  93. # patches and ipkg control files.
  94. # QT-EMBEDDED_IPK_DIR is the directory in which the ipk is built.
  95. # QT-EMBEDDED_IPK is the name of the resulting ipk files.
  96. #
  97. # You should not change any of these variables.
  98. #
  99. QT-EMBEDDED_BUILD_DIR=$(BUILD_DIR)/qt-embedded
  100. QT-EMBEDDED_SOURCE_DIR=$(SOURCE_DIR)/qt-embedded
  101. QT-EMBEDDED_IPK_DIR=$(BUILD_DIR)/qt-embedded-$(QT-EMBEDDED_VERSION)-ipk
  102. QT-EMBEDDED_IPK=$(BUILD_DIR)/qt-embedded_$(QT-EMBEDDED_VERSION)-$(QT-EMBEDDED_IPK_VERSION)_$(TARGET_ARCH).ipk
  103. .PHONY: qt-embedded-source qt-embedded-unpack qt-embedded qt-embedded-stage qt-embedded-ipk qt-embedded-clean qt-embedded-dirclean qt-embedded-check
  104. #
  105. # This is the dependency on the source code. If the source is missing,
  106. # then it will be fetched from the site using wget.
  107. #
  108. $(DL_DIR)/$(QT-EMBEDDED_SOURCE):
  109. $(WGET) -P $(@D) $(QT-EMBEDDED_SITE)/$(@F) || \
  110. $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F)
  111. #
  112. # The source code depends on it existing within the download directory.
  113. # This target will be called by the top level Makefile to download the
  114. # source code's archive (.tar.gz, .bz2, etc.)
  115. #
  116. qt-embedded-source: $(DL_DIR)/$(QT-EMBEDDED_SOURCE) $(QT-EMBEDDED_PATCHES)
  117. #
  118. # This target unpacks the source code in the build directory.
  119. # If the source archive is not .tar.gz or .tar.bz2, then you will need
  120. # to change the commands here. Patches to the source code are also
  121. # applied in this target as required.
  122. #
  123. # This target also configures the build within the build directory.
  124. # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
  125. # and NOT $(MAKE) below. Passing it to configure causes configure to
  126. # correctly BUILD the Makefile with the right paths, where passing it
  127. # to Make causes it to override the default search paths of the compiler.
  128. #
  129. # If the compilation of the package requires other packages to be staged
  130. # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
  131. #
  132. # If the package uses GNU libtool, you should invoke $(PATCH_LIBTOOL) as
  133. # shown below to make various patches to it.
  134. #
  135. $(QT-EMBEDDED_BUILD_DIR)/.configured: $(DL_DIR)/$(QT-EMBEDDED_SOURCE) $(QT-EMBEDDED_PATCHES) make/qt-embedded.mk
  136. $(MAKE) libjpeg-stage libpng-stage libtiff-stage zlib-stage openssl-stage dbus-stage mysql5-stage sqlite-stage postgresql-stage
  137. rm -rf $(BUILD_DIR)/$(QT-EMBEDDED_DIR) $(@D)
  138. $(QT-EMBEDDED_UNZIP) $(DL_DIR)/$(QT-EMBEDDED_SOURCE) | tar -C $(BUILD_DIR) -xvf -
  139. if test -n "$(QT-EMBEDDED_PATCHES)" ; \
  140. then cat $(QT-EMBEDDED_PATCHES) | \
  141. patch -d $(BUILD_DIR)/$(QT-EMBEDDED_DIR) -p0 ; \
  142. fi
  143. if test "$(BUILD_DIR)/$(QT-EMBEDDED_DIR)" != "$(@D)" ; \
  144. then mv $(BUILD_DIR)/$(QT-EMBEDDED_DIR) $(@D) ; \
  145. fi
  146. (cd $(@D)/mkspecs ; \
  147. mkdir linux-g++-custom ; \
  148. cp linux-g++/qplatformdefs.h linux-g++-custom ; \
  149. echo $(QT-EMBEDDED_QMAKE) >linux-g++-custom/qmake.conf ; \
  150. )
  151. ifneq (yes, $(TARGET_CC_PROBE))
  152. cp -a $(@D)/src/tools $(@D)/src/tools-target
  153. cp -a $(@D)/qmake $(@D)/qmake-target
  154. cp -a $(@D)/tools/linguist/lrelease $(@D)/tools/linguist/lrelease-target
  155. sed -i 's/bin/target-bin/g' \
  156. $(@D)/qmake-target/qmake.pro \
  157. $(@D)/src/tools-target/uic/uic.pro \
  158. $(@D)/src/tools-target/moc/moc.pro \
  159. $(@D)/src/tools-target/rcc/rcc.pro \
  160. $(@D)/tools/linguist/lrelease-target/lrelease.pro
  161. sed -i 's+/tools/+/tools-target/+g' $(@D)/src/tools-target/bootstrap/bootstrap.pri $(@D)/tools/linguist/lrelease-target/lrelease.pro
  162. mkdir $(@D)/target-bin
  163. endif
  164. +(cd $(@D); \
  165. cp -a src/tools src/tools-target ; \
  166. cp -a tools/linguist/lrelease tools/linguist/lrelease-target ; \
  167. cp -a qmake qmake-target ; \
  168. echo 'yes' | \
  169. $(QT-EMBEDDED_PATH) \
  170. PKG_CONFIG_PATH=$(STAGING_DIR)/opt/lib/pkgconfig \
  171. PKG_CONFIG_SYSROOT=$(STAGING_DIR) \
  172. CPPFLAGS="$(STAGING_CPPFLAGS) $(QT-EMBEDDED_CPPFLAGS)" \
  173. LDFLAGS="$(STAGING_LDFLAGS) $(QT-EMBEDDED_LDFLAGS)" \
  174. ./configure \
  175. -prefix /opt \
  176. -force-pkg-config \
  177. -no-pch \
  178. -plugindir /opt/lib/qt4/plugins \
  179. -opensource \
  180. -plugin-sql-mysql \
  181. -plugin-sql-sqlite \
  182. -plugin-sql-psql \
  183. -system-sqlite \
  184. -no-webkit \
  185. -no-javascript-jit \
  186. -no-glib \
  187. -qt-libmng \
  188. -embedded \
  189. $(QT-EMBEDDED_PLATFORM) \
  190. -v \
  191. -nomake "tools examples demos docs" \
  192. )
  193. ifneq (yes, $(TARGET_CC_PROBE))
  194. $(@D)/bin/qmake -spec $(@D)/mkspecs/linux-g++-custom -o $(@D)/src/tools-target/bootstrap $(@D)/src/tools-target/bootstrap/bootstrap.pro
  195. $(@D)/bin/qmake -spec $(@D)/mkspecs/linux-g++-custom -o $(@D)/qmake-target $(@D)/qmake-target/qmake.pro
  196. $(@D)/bin/qmake -spec $(@D)/mkspecs/linux-g++-custom -o $(@D)/src/tools-target/uic $(@D)/src/tools-target/uic/uic.pro
  197. $(@D)/bin/qmake -spec $(@D)/mkspecs/linux-g++-custom -o $(@D)/src/tools-target/moc $(@D)/src/tools-target/moc/moc.pro
  198. $(@D)/bin/qmake -spec $(@D)/mkspecs/linux-g++-custom -o $(@D)/src/tools-target/rcc $(@D)/src/tools-target/rcc/rcc.pro
  199. $(@D)/bin/qmake -spec $(@D)/mkspecs/linux-g++-custom -o $(@D)/tools/linguist/lrelease-target $(@D)/tools/linguist/lrelease-target/lrelease.pro
  200. endif
  201. # $(PATCH_LIBTOOL) $(@D)/libtool
  202. touch $@
  203. qt-embedded-unpack: $(QT-EMBEDDED_BUILD_DIR)/.configured
  204. #
  205. # This builds the actual binary.
  206. #
  207. $(QT-EMBEDDED_BUILD_DIR)/.built: $(QT-EMBEDDED_BUILD_DIR)/.configured
  208. rm -f $@
  209. ifneq (yes, $(TARGET_CC_PROBE))
  210. (cd $(@D) ; for dir in qmake-target src/tools-target/bootstrap src/tools-target/uic src/tools-target/moc src/tools-target/rcc tools/linguist/lrelease-target ; do \
  211. $(QT-EMBEDDED_PATH) $(MAKE) -C $$dir ; done \
  212. )
  213. endif
  214. $(QT-EMBEDDED_PATH) $(MAKE) -C $(@D)
  215. touch $@
  216. #
  217. # This is the build convenience target.
  218. #
  219. qt-embedded: $(QT-EMBEDDED_BUILD_DIR)/.built
  220. #
  221. # If you are building a library, then you need to stage it too.
  222. #
  223. $(QT-EMBEDDED_BUILD_DIR)/.staged: $(QT-EMBEDDED_BUILD_DIR)/.built
  224. rm -f $@
  225. $(QT-EMBEDDED_PATH) $(MAKE) -C $(@D) INSTALL_ROOT=$(STAGING_DIR) install
  226. ifneq (yes, $(TARGET_CC_PROBE))
  227. (cd $(@D) ; \
  228. install -m 755 target-bin/uic target-bin/moc target-bin/rcc target-bin/lrelease target-bin/qmake $(STAGING_DIR)/opt/bin \
  229. )
  230. endif
  231. touch $@
  232. qt-embedded-stage: $(QT-EMBEDDED_BUILD_DIR)/.staged
  233. #
  234. # This rule creates a control file for ipkg. It is no longer
  235. # necessary to create a seperate control file under sources/qt-embedded
  236. #
  237. $(QT-EMBEDDED_IPK_DIR)/CONTROL/control:
  238. @install -d $(@D)
  239. @rm -f $@
  240. @echo "Package: qt-embedded" >>$@
  241. @echo "Architecture: $(TARGET_ARCH)" >>$@
  242. @echo "Priority: $(QT-EMBEDDED_PRIORITY)" >>$@
  243. @echo "Section: $(QT-EMBEDDED_SECTION)" >>$@
  244. @echo "Version: $(QT-EMBEDDED_VERSION)-$(QT-EMBEDDED_IPK_VERSION)" >>$@
  245. @echo "Maintainer: $(QT-EMBEDDED_MAINTAINER)" >>$@
  246. @echo "Source: $(QT-EMBEDDED_SITE)/$(QT-EMBEDDED_SOURCE)" >>$@
  247. @echo "Description: $(QT-EMBEDDED_DESCRIPTION)" >>$@
  248. @echo "Depends: $(QT-EMBEDDED_DEPENDS)" >>$@
  249. @echo "Suggests: $(QT-EMBEDDED_SUGGESTS)" >>$@
  250. @echo "Conflicts: $(QT-EMBEDDED_CONFLICTS)" >>$@
  251. #
  252. # This builds the IPK file.
  253. #
  254. # Binaries should be installed into $(QT-EMBEDDED_IPK_DIR)/opt/sbin or $(QT-EMBEDDED_IPK_DIR)/opt/bin
  255. # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
  256. # Libraries and include files should be installed into $(QT-EMBEDDED_IPK_DIR)/opt/{lib,include}
  257. # Configuration files should be installed in $(QT-EMBEDDED_IPK_DIR)/opt/etc/qt-embedded/...
  258. # Documentation files should be installed in $(QT-EMBEDDED_IPK_DIR)/opt/doc/qt-embedded/...
  259. # Daemon startup scripts should be installed in $(QT-EMBEDDED_IPK_DIR)/opt/etc/init.d/S??qt-embedded
  260. #
  261. # You may need to patch your application to make it use these locations.
  262. #
  263. $(QT-EMBEDDED_IPK): $(QT-EMBEDDED_BUILD_DIR)/.built
  264. rm -rf $(QT-EMBEDDED_IPK_DIR) $(BUILD_DIR)/qt-embedded_*_$(TARGET_ARCH).ipk
  265. $(QT-EMBEDDED_PATH) $(MAKE) -C $(QT-EMBEDDED_BUILD_DIR) INSTALL_ROOT=$(QT-EMBEDDED_IPK_DIR) install
  266. ifneq (yes, $(TARGET_CC_PROBE))
  267. (cd $(QT-EMBEDDED_BUILD_DIR) ; \
  268. install -m 755 target-bin/uic target-bin/moc target-bin/rcc target-bin/lrelease target-bin/qmake $(QT-EMBEDDED_IPK_DIR)/opt/bin \
  269. )
  270. endif
  271. # $(MAKE) -C $(QT-EMBEDDED_BUILD_DIR) DESTDIR=$(QT-EMBEDDED_IPK_DIR) install-strip
  272. # install -d $(QT-EMBEDDED_IPK_DIR)/opt/etc/
  273. # install -m 644 $(QT-EMBEDDED_SOURCE_DIR)/qt-embedded.conf $(QT-EMBEDDED_IPK_DIR)/opt/etc/qt-embedded.conf
  274. # install -d $(QT-EMBEDDED_IPK_DIR)/opt/etc/init.d
  275. # install -m 755 $(QT-EMBEDDED_SOURCE_DIR)/rc.qt-embedded $(QT-EMBEDDED_IPK_DIR)/opt/etc/init.d/SXXqt-embedded
  276. # sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(QT-EMBEDDED_IPK_DIR)/opt/etc/init.d/SXXqt-embedded
  277. $(MAKE) $(QT-EMBEDDED_IPK_DIR)/CONTROL/control
  278. # install -m 755 $(QT-EMBEDDED_SOURCE_DIR)/postinst $(QT-EMBEDDED_IPK_DIR)/CONTROL/postinst
  279. # sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(QT-EMBEDDED_IPK_DIR)/CONTROL/postinst
  280. # install -m 755 $(QT-EMBEDDED_SOURCE_DIR)/prerm $(QT-EMBEDDED_IPK_DIR)/CONTROL/prerm
  281. # sed -i -e '/^#!/aOPTWARE_TARGET=${OPTWARE_TARGET}' $(QT-EMBEDDED_IPK_DIR)/CONTROL/prerm
  282. # if test -n "$(UPD-ALT_PREFIX)"; then \
  283. sed -i -e '/^[ ]*update-alternatives /s|update-alternatives|$(UPD-ALT_PREFIX)/bin/&|' \
  284. $(QT-EMBEDDED_IPK_DIR)/CONTROL/postinst $(QT-EMBEDDED_IPK_DIR)/CONTROL/prerm; \
  285. fi
  286. echo $(QT-EMBEDDED_CONFFILES) | sed -e 's/ /\n/g' > $(QT-EMBEDDED_IPK_DIR)/CONTROL/conffiles
  287. cd $(BUILD_DIR); $(IPKG_BUILD) $(QT-EMBEDDED_IPK_DIR)
  288. #
  289. # This is called from the top level makefile to create the IPK file.
  290. #
  291. qt-embedded-ipk: $(QT-EMBEDDED_IPK)
  292. #
  293. # This is called from the top level makefile to clean all of the built files.
  294. #
  295. qt-embedded-clean:
  296. rm -f $(QT-EMBEDDED_BUILD_DIR)/.built
  297. -$(MAKE) -C $(QT-EMBEDDED_BUILD_DIR) clean
  298. #
  299. # This is called from the top level makefile to clean all dynamically created
  300. # directories.
  301. #
  302. qt-embedded-dirclean:
  303. rm -rf $(BUILD_DIR)/$(QT-EMBEDDED_DIR) $(QT-EMBEDDED_BUILD_DIR) $(QT-EMBEDDED_IPK_DIR) $(QT-EMBEDDED_IPK)
  304. #
  305. #
  306. # Some sanity check for the package.
  307. #
  308. qt-embedded-check: $(QT-EMBEDDED_IPK)
  309. perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^