summaryrefslogtreecommitdiffstats
path: root/src/qt.mk
blob: 6638916d5f59b830041026bbcc559a61ecc2edc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Copyright (C) 2009  Mark Brand
#                     Volker Grabsch
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Qt
PKG             := qt
$(PKG)_IGNORE   :=
$(PKG)_VERSION  := 4.6.0-tp1
$(PKG)_CHECKSUM := 4394bea076279ea090549d3caa00cc1f5e33a22b
$(PKG)_SUBDIR   := $(PKG)-everywhere-opensource-src-$($(PKG)_VERSION)
$(PKG)_FILE     := $(PKG)-everywhere-opensource-src-$($(PKG)_VERSION).tar.gz
$(PKG)_WEBSITE  := http://qt.nokia.com/
$(PKG)_URL      := http://get.qt.nokia.com/qt/source/$($(PKG)_FILE)
$(PKG)_DEPS     := gcc

define $(PKG)_UPDATE
    wget -q -O- 'http://qt.gitorious.org/qt/qt/commits' | \
    grep '<li><a href="/qt/qt/commit/' | \
    $(SED) -n 's,.*<a[^>]*>v\([0-9][^>]*\)<.*,\1,p' | \
    tail -1
endef

define $(PKG)_BUILD

    # Note on patchfile qt-win32.patch
    # A patchfile should have been applied already. Since we make a copy
    # of the patched directory here, it is important that the changes
    # in the patches do not break the native build.

    # Bogus install bin directory for the DLLs
    # Should stay empty because of -prefix-install
    mkdir '$(1)'/bindirsink

    # First configure a minimal native version of Qt
    # for moc, rcc, uic and qmake
    cp -a '$(1)' '$(1)'.native
    cd '$(1)'.native && ./configure \
        -opensource \
        -confirm-license \
        -prefix '$(PREFIX)/$(TARGET)' \
        -prefix-install \
        -bindir '$(1)'/bindirsink \
        -fast \
        -nomake demos \
        -nomake examples \
        -nomake libs \
        -nomake tools \
        -nomake docs \
        -nomake translations

    $(MAKE) -C '$(1)'.native -j $(JOBS) sub-tools-bootstrap
    $(MAKE) -C '$(1)'.native -j $(JOBS) sub-moc
    $(MAKE) -C '$(1)'.native -j $(JOBS) sub-rcc
    $(MAKE) -C '$(1)'.native -j $(JOBS) sub-uic
    $(MAKE) -C '$(1)'.native clean

    # Trick the build system into using native tools
    ln -s '$(1)'.native/bin/{moc,rcc,uic,qmake} '$(1)'/bin/

    # Make sure we don't build the tools again
    echo 'qmake:' >'$(1)'/qmake/Makefile.unix
    for f in `ls -1 '$(1)'/src/tools`; \
        do echo TEMPLATE = subdirs >'$(1)'/src/tools/"$$f"/"$$f".pro; \
    done

    # Trick the buildsystem into using win32 feature files:
    mv '$(1)'/mkspecs/features/unix '$(1)'/mkspecs/features/unix.orig
    ln -s win32 '$(1)'/mkspecs/features/unix

    # Adjust the mkspec values that contain the TARGET platform prefix
    $(SED) 's,HOSTPLATFORMPREFIX-,$(TARGET)-,g'                  -i '$(1)'/mkspecs/win32-g++/qmake.conf
    $(SED) 's,HOSTPLATFORMINCLUDE,$(PREFIX)/$(TARGET)/include,g' -i '$(1)'/mkspecs/win32-g++/qmake.conf

    # Make sure qmake doesn't use compilation paths meant for unix
    find '$(1)'/src -name '*.pr[oi]' -exec \
        $(SED) 's,\(^\|[^_/]\)unix,\1linux,g' -i {} \;

    # Make qmake use compilation paths meant for Windows
    find '$(1)'/src -name '*.pr[oi]' -exec \
        $(SED) 's,\(^\|[^_/]\)win32\([^-]\|$$\),\1unix\2,g' -i {} \;

    # Fix-ups for files not found during configure
    # Probably errors in QT 4.6 Technology Preview 1
    ln -s ../WebKit.pri '$(1)'/src/3rdparty/webkit/WebKit

    # Fix-ups for files not found during make
    # Probably errors in QT 4.6 Technology Preview 1
    mkdir                 '$(1)'/src/3rdparty/webkit/JavaScriptCore/generated/release
    ln -s ../chartables.c '$(1)'/src/3rdparty/webkit/JavaScriptCore/generated/release/
    ln -s ../Grammar.cpp  '$(1)'/src/3rdparty/webkit/JavaScriptCore/generated/release/
    mkdir                 '$(1)'/src/3rdparty/webkit/JavaScriptCore/generated/debug
    ln -s ../chartables.c '$(1)'/src/3rdparty/webkit/JavaScriptCore/generated/debug/
    ln -s ../Grammar.cpp  '$(1)'/src/3rdparty/webkit/JavaScriptCore/generated/debug/

    # Fix case of filename
    $(SED) 's,QWidget\.h,qwidget.h,g' -i '$(1)'/src/3rdparty/webkit/WebCore/plugins/win/PluginViewWin.cpp

    # Configure Qt for MinGW target
    cd '$(1)' && ./configure \
        -opensource \
        -confirm-license \
        -xplatform win32-g++ \
        -host-arch i386 \
        -little-endian \
        -exceptions \
        -static \
        -prefix '$(PREFIX)/$(TARGET)' \
        -prefix-install \
        -bindir '$(1)'/bindirsink \
        -plugin-sql-odbc \
        -plugin-sql-psql \
        -plugin-sql-sqlite \
        -plugin-sql-mysql \
        -script \
        -webkit \
        -phonon \
        -no-phonon-backend \
        -accessibility \
        -no-reduce-exports \
        -no-rpath \
        -make libs \
        -nomake demos \
        -nomake docs \
        -nomake examples \
        -continue

    $(MAKE) -C '$(1)' -j '$(JOBS)'
    $(TARGET)-ranlib '$(1)'/lib/*.a
    $(MAKE) -C '$(1)' install

    # install native tools manually
    $(INSTALL) -m755 '$(1)'.native/bin/{moc,rcc,uic} '$(PREFIX)/$(TARGET)/bin/'
    $(INSTALL) -m755 '$(1)'.native/bin/qmake '$(PREFIX)/bin/$(TARGET)-qmake'
endef