From cc2835c6e477cd20a56a49c6df9086aaf75e7936 Mon Sep 17 00:00:00 2001 From: Mirko Vogt Date: Sun, 1 Aug 2010 15:53:32 +0000 Subject: [PATCH] qt4: heavily cleanup Makefile and add a generic way for configuring projects using qmake SVN-Revision: 22455 --- Xorg/lib/qt4/Makefile | 109 ++++++++++++++++------------- Xorg/lib/qt4/files/qmake.conf | 43 ++++++++++++ Xorg/lib/qt4/files/qmake.mk | 29 ++++++++ Xorg/lib/qt4/files/qplatformdefs.h | 1 + 4 files changed, 132 insertions(+), 50 deletions(-) create mode 100644 Xorg/lib/qt4/files/qmake.conf create mode 100644 Xorg/lib/qt4/files/qmake.mk create mode 100644 Xorg/lib/qt4/files/qplatformdefs.h diff --git a/Xorg/lib/qt4/Makefile b/Xorg/lib/qt4/Makefile index 314ae68c3..285f83e99 100644 --- a/Xorg/lib/qt4/Makefile +++ b/Xorg/lib/qt4/Makefile @@ -6,8 +6,6 @@ # # TODO: -# - handle software which uses qmake in a more generic way (move functionality / generic qmake-config into buildroot) -# - use generic qmake, moc, etc. executables since building them within the qt stack will get redundant and annyoing when other sw will need them as well # - test/add X11/xcb support # - handle plugins in a granular way (find out which packages should provide which plugins) @@ -45,7 +43,7 @@ endef define Package/qt4 $(call Package/qt4/Default) - DEPENDS:=@FEATURE_drawing-backend_DirectFB +FEATURE_drawing-backend_DirectFB:directfb +zlib +libstdcpp +libsqlite3 # require directfb for now, as other systems (libX11, xcb) are untested + DEPENDS:=@FEATURE_drawing-backend_DirectFB +FEATURE_drawing-backend_DirectFB:directfb +zlib +libstdcpp +libsqlite3 +tslib # require directfb for now, as other systems (libX11, xcb) are untested endef define Package/qt4-gui @@ -178,7 +176,10 @@ define Package/qt4-xml TITLE+=(xml) endef -TARGET_CFLAGS+="-I$(STAGING_DIR)/usr/include/freetype2 -I$(PKG_BUILD_DIR)/include" +TARGET_INCDIRS+=$(STAGING_DIR)/include $(STAGING_DIR)/usr/include $(TOOLCHAIN_DIR)/include $(TOOLCHAIN_DIR)/usr/include +TARGET_LIBDIRS+=$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib $(TOOLCHAIN_DIR)/lib $(TOOLCHAIN_DIR)/usr/lib +TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib,-rpath-link=$(PKG_BUILD_DIR)/lib +TARGET_CFLAGS+=-I$(STAGING_DIR)/usr/include/freetype2 -I$(PKG_BUILD_DIR)/include define Build/Configure # NOTES: @@ -187,49 +188,22 @@ define Build/Configure # linuxfb/directfb: since directfb is not much overhead compared to plain framebuffer, force using directfb # do not use fontconfig as it doesn't work anyway for qte # bindir: bindir is where the host tools (qmake, moc, rcc, uic) will get installed into - they are just used on the host and not goig to be packaged - ( \ - cd $(PKG_BUILD_DIR); \ - QPATH='mkspecs/qws/linux-openwrt-g++' ; \ - mkdir $$$$QPATH ; \ - echo '#include "../../linux-g++/qplatformdefs.h"' \ - >> $$$$QPATH/qplatformdefs.h ; \ - echo 'include(../../common/g++.conf)' \ - >> $$$$QPATH/qmake.conf ; \ - echo 'include(../../common/linux.conf)' \ - >> $$$$QPATH/qmake.conf ; \ - echo 'include(../../common/qws.conf)' \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_CC = $(TARGET_CC)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_CXX = $(TARGET_CXX)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_AR = $(TARGET_CROSS)ar cqs" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_OBJCOPY = $(TARGET_CROSS)objcopy" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_RANLIB = $(TARGET_CROSS)ranlib" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_CFLAGS = $(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_CXXFLAGS = $(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_LINK = $(TARGET_CXX)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_LINK_SHLIB = $(TARGET_CXX)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_LINK_C = $(TARGET_CC)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_LINK_C_SHLIB = $(TARGET_CC)" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_LFLAGS = -L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib" \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_STRIP = : " \ - >> $$$$QPATH/qmake.conf ; \ - echo "QMAKE_STRIPFLAGS_LIB = " \ - >> $$$$QPATH/qmake.conf ; \ - echo 'load(qt_config)' \ - >> $$$$QPATH/qmake.conf ; \ - echo yes | ./configure \ + mkdir -p $(PKG_BUILD_DIR)/mkspecs/qws/linux-openwrt-g++ + cp -a ./files/{qmake.conf,qplatformdefs.h} $(PKG_BUILD_DIR)/mkspecs/qws/linux-openwrt-g++/ + ( cd $(PKG_BUILD_DIR) ; \ + TARGET_CC="$(TARGET_CROSS)gcc" \ + TARGET_CXX="$(TARGET_CROSS)g++" \ + TARGET_AR="$(TARGET_CROSS)ar cqs" \ + TARGET_OBJCOPY="$(TARGET_CROSS)objcopy" \ + TARGET_RANLIB="$(TARGET_CROSS)ranlib" \ + TARGET_CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ + TARGET_CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ + TARGET_LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \ + TARGET_INCDIRS="$(TARGET_INCDIRS)" \ + TARGET_LIBDIRS="$(TARGET_LIBDIRS)" \ + STAGING_DIR="$(STAGING_DIR)" \ + STAGING_DIR_HOST="$(STAGING_DIR)/../host" \ + ./configure \ -prefix $(CONFIGURE_PREFIX) \ -bindir $(CONFIGURE_PREFIX)/bin \ -libdir $(CONFIGURE_PREFIX)/lib \ @@ -245,9 +219,11 @@ define Build/Configure -make examples \ -nomake docs \ -nomake translations \ - -embedded openwrt \ + -xplatform qws/linux-openwrt-g++ \ -platform linux-g++ \ + -embedded \ -release \ + -confirm-license \ -opensource \ -no-mmx \ -no-3dnow \ @@ -299,14 +275,42 @@ define Build/Configure -no-xkb \ -no-glib \ -qt3support \ - -qt-gfx-directfb \ - -qt-gfx-linuxfb \ + -no-gfx-transformed \ + -no-gfx-qvfb \ + -no-gfx-vnc \ -no-gfx-multiscreen \ + -no-gfx-qnx \ + -plugin-gfx-directfb \ + -plugin-gfx-linuxfb \ + -no-mouse-qvfb \ + -no-mouse-qnx \ + -qt-mouse-linuxinput \ + -plugin-mouse-linuxtp \ + -plugin-mouse-pc \ + -plugin-mouse-tslib \ + -no-kbd-qvfb \ + -no-kbd-qnx \ + -qt-kbd-tty \ + -plugin-kbd-linuxinput \ ) endef define Build/Compile # just passing results in not building 3rdparty/webkit/JavaScriptCore + # unfortunately in this particular case, makes further calls, therewith + # uses the qmake.conf which needs get the cross-compiling vars passed once again + TARGET_CC="$(TARGET_CROSS)gcc" \ + TARGET_CXX="$(TARGET_CROSS)g++" \ + TARGET_AR="$(TARGET_CROSS)ar cqs" \ + TARGET_OBJCOPY="$(TARGET_CROSS)objcopy" \ + TARGET_RANLIB="$(TARGET_CROSS)ranlib" \ + TARGET_CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ + TARGET_CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ + TARGET_LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \ + TARGET_INCDIRS="$(TARGET_INCDIRS)" \ + TARGET_LIBDIRS="$(TARGET_LIBDIRS)" \ + STAGING_DIR="$(STAGING_DIR)" \ + STAGING_DIR_HOST="$(STAGING_DIR)/../host" \ $(MAKE) -C $(PKG_BUILD_DIR) INSTALL_ROOT=$(PKG_INSTALL_DIR) \ $(MAKE) -C $(PKG_BUILD_DIR) install @@ -322,12 +326,17 @@ define Build/InstallDev $(STAGING_DIR_HOST)/bin/ $(INSTALL_DIR) \ + $(1)/mk \ $(1)/usr/share/mkspecs \ $(1)/usr/lib/pkgconfig \ $(1)/usr/lib \ $(1)/usr/include \ $(1)/usr/lib/Qt/plugins + $(CP) \ + ./files/qmake.mk \ + $(1)/mk/ + $(CP) \ $(PKG_INSTALL_DIR)/usr/share/Qt/mkspecs/* \ $(1)/usr/share/mkspecs/ diff --git a/Xorg/lib/qt4/files/qmake.conf b/Xorg/lib/qt4/files/qmake.conf new file mode 100644 index 000000000..d839f7cdc --- /dev/null +++ b/Xorg/lib/qt4/files/qmake.conf @@ -0,0 +1,43 @@ +include(../../common/g++.conf) +include(../../common/linux.conf) +include(../../common/qws.conf) + +# QMAKE_{INC,LIB}DIR_QT needs to be overridden, +# as they're set to $$[QT_INSTALL_{HEADERS,LIBS}] by default +# which are compiled into the qmake binary statically +QMAKE_INCDIR_QT = $$(TARGET_INCDIRS) +QMAKE_LIBDIR_QT = $$(TARGET_LIBDIRS) +QMAKE_INCDIR = $$(TARGET_INCDIRS) +QMAKE_LIBDIR = $$(TARGET_LIBDIRS) +QMAKE_MOC = $$(STAGING_DIR_HOST)/bin/moc +QMAKE_UIC = $$(STAGING_DIR_HOST)/bin/uic +QMAKE_RCC = $$(STAGING_DIR_HOST)/bin/rcc +QMAKE_CC = $$(TARGET_CC) +QMAKE_CXX = $$(TARGET_CXX) +QMAKE_AR = $$(TARGET_CROSS)ar cqs +QMAKE_OBJCOPY = $$(TARGET_CROSS)objcopy +QMAKE_RANLIB = $$(TARGET_CROSS)ranlib +QMAKE_CFLAGS = $$(TARGET_CFLAGS) +QMAKE_CXXFLAGS = $$(TARGET_CFLAGS) +QMAKE_LINK = $$(TARGET_CXX) +QMAKE_LINK_C = $$(TARGET_CC) +QMAKE_LFLAGS = $$(TARGET_LDFLAGS) # this will end up in redundant "-L"-strings, as they're already in $QMAKE_LIBDIR_QT, however TARGET_LDFLAGS may contain not only directories but special linker options + +#unset vars which would intefere with vars/flags passed over by OpenWrt +QMAKE_STRIP = # do not strip +QMAKE_STRIPFLAGS_LIB = # do not strip +QMAKE_CFLAGS_WARN_ON = +QMAKE_CFLAGS_WARN_OFF = +QMAKE_CFLAGS_RELEASE = +QMAKE_CFLAGS_DEBUG = +QMAKE_CFLAGS_PRECOMPILE = +QMAKE_CFLAGS_USE_PRECOMPILE = +QMAKE_CXXFLAGS_WARN_ON = +QMAKE_CXXFLAGS_WARN_OFF = +QMAKE_CXXFLAGS_RELEASE = +QMAKE_CXXFLAGS_DEBUG = +QMAKE_CXXFLAGS_PRECOMPILE = +QMAKE_CXXFLAGS_USE_PRECOMPILE = +QMAKE_LFLAGS_RELEASE = + +load(qt_config) diff --git a/Xorg/lib/qt4/files/qmake.mk b/Xorg/lib/qt4/files/qmake.mk new file mode 100644 index 000000000..d7921d940 --- /dev/null +++ b/Xorg/lib/qt4/files/qmake.mk @@ -0,0 +1,29 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +QMAKE_SPECFILE:=$(STAGING_DIR)/usr/share/mkspecs/qws/linux-openwrt-g++ + +TARGET_INCDIRS+=$(STAGING_DIR)/include $(STAGING_DIR)/usr/include $(TOOLCHAIN_DIR)/include $(TOOLCHAIN_DIR)/usr/include +TARGET_LIBDIRS+=$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib $(TOOLCHAIN_DIR)/lib $(TOOLCHAIN_DIR)/usr/lib + +define Build/Configure/Qmake + TARGET_CC="$(TARGET_CROSS)gcc" \ + TARGET_CXX="$(TARGET_CROSS)g++" \ + TARGET_AR="$(TARGET_CROSS)ar cqs" \ + TARGET_OBJCOPY="$(TARGET_CROSS)objcopy" \ + TARGET_RANLIB="$(TARGET_CROSS)ranlib" \ + TARGET_CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ + TARGET_CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \ + TARGET_LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \ + TARGET_INCDIRS="$(TARGET_INCDIRS)" \ + TARGET_LIBDIRS="$(TARGET_LIBDIRS)" \ + STAGING_DIR_HOST="$(STAGING_DIR)/../host" \ + qmake \ + -spec $(QMAKE_SPECFILE) \ + -o $(PKG_BUILD_DIR)/Makefile \ + $(PKG_BUILD_DIR)/$(1).pro +endef diff --git a/Xorg/lib/qt4/files/qplatformdefs.h b/Xorg/lib/qt4/files/qplatformdefs.h new file mode 100644 index 000000000..99e9a2792 --- /dev/null +++ b/Xorg/lib/qt4/files/qplatformdefs.h @@ -0,0 +1 @@ +#include "../../linux-g++/qplatformdefs.h" -- 2.30.2