summaryrefslogtreecommitdiffstats
path: root/mkspecs/symbian/linux-armcc/features/symbian_building.prf
blob: 0a697f4108fd188f58b9989506452057670557f5 (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
QMAKE_CFLAGS += $$QMAKE_CFLAGS.ARMCC
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS.ARMCC

symbianObjdir=$$OBJECTS_DIR
isEmpty(symbianObjdir) {
    symbianObjdir = .
}
symbianDestdir=$$DESTDIR
isEmpty(symbianDestdir) {
    symbianDestdir = .
}

for(libraries, LIBS) {
    libraries = $$replace(libraries, "\.dll$", ".dso")
    isFullName = $$find(libraries, \.)
    isEmpty(isFullName) {
        newLIBS += "$${libraries}.dso"
    } else {
        newLIBS += "$${libraries}"
    }
}
LIBS = $$newLIBS
newLIBS =
for(libraries, QMAKE_LIBS) {
    libraries = $$replace(libraries, "\.dll$", ".dso")
    isFullName = $$find(libraries, \.)
    isEmpty(isFullName) {
        newLIBS += "$${libraries}.dso"
    } else {
        newLIBS += "$${libraries}"
    }
}
QMAKE_LIBS = $$newLIBS

# This needs to be done after the above LIBS mangling.
include(../platformlibs.conf)

elf2e32_LIBPATH =
for(libPath, QMAKE_LIBDIR) {
    elf2e32_LIBPATH += "--libpath=$$libPath"
}

isEmpty(VERSION) {
    VERSION = $$QT_VERSION
}

# Check for version validity.
!isEmpty(VERSION):!contains(VERSION, "[0-9]+"):!contains(VERSION, "[0-9]+\.[0-9]+")!contains(VERSION, "[0-9]+(\.[0-9]+){2}") {
    error("Invalid VERSION for Symbian: $$VERSION")
}

splitVersion = $$split(VERSION, ".")
count(splitVersion, 1) {
    # Default Symbian version if none is specified.
    hexVersion = "000a0000"
    decVersion = "10.0"
} else {
    count(splitVersion, 3) {
        hexVersion = $$system("sh -c 'printf %02x $$member(splitVersion, 0)'")
        hexPart2 = $$system("sh -c 'printf %02x $$member(splitVersion, 1)'")"
        hexPart2 = $$hexPart2$$system("sh -c 'printf %02x $$member(splitVersion, 2)'")"
        decVersion = $$system("sh -c 'printf %1d 0x$$hexVersion'").
        hexVersion = $$hexVersion$$hexPart2
        decVersion = $$decVersion$$system("sh -c 'printf %d 0x$$hexPart2'")
        !contains(hexVersion, "[0-9a-f]{8}"):hexVersion = "00$${hexVersion}"
    } else {  # app code may have different numbering...
        hexVersion = $$VERSION
        decVersion = $$VERSION
    }
}
#error ("hexVersion: $$hexVersion, decVersion: $$decVersion")

isEmpty(TARGET.UID3):TARGET.UID3 = $$generate_uid("$${OUT_PWD}/$${TARGET}")
intUid3 = $$lower($$replace(TARGET.UID3, "^0x", ""))
isEmpty(TARGET.SID):TARGET.SID = $$TARGET.UID3
isEmpty(TARGET.UID2):TARGET.UID2 = 0x00000000

contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) {
    !isEmpty($$QMAKE_POST_LINK):QMAKE_POST_LINK += &&
    QMAKE_POST_LINK += $$QMAKE_MOVE $$symbianDestdir/$${TARGET}.dll $$symbianDestdir/$${TARGET}.sym
    QMAKE_POST_LINK += && elf2e32  --version=$$decVersion --sid=$$TARGET.SID  --uid1=0x10000079 --uid2=$$TARGET.UID2 --uid3=$$TARGET.UID3 --dlldata --heap=0x00020000,0x00800000 --stack=0x00014000 --capability=None --fpu=softvfp --targettype=DLL --elfinput=$${symbianDestdir}/$${TARGET}.sym --output=$${symbianDestdir}/$${TARGET}.dll --dso=$$symbianDestdir/$${TARGET}.dso --defoutput=$$symbianObjdir/$${TARGET}.def --unfrozen --linkas=$${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].dll --compressionmethod bytepair $$elf2e32_LIBPATH --unpaged | tee elf2e32.log && ! grep Error: elf2e32.log >& /dev/null && rm -f elf2e32.log
    QMAKE_DISTCLEAN += $${symbianDestdir}/$${TARGET}.sym
    QMAKE_DISTCLEAN += $${symbianDestdir}/$${TARGET}.dso
    QMAKE_CLEAN += $${symbianObjdir}/$${TARGET}.def

    QMAKE_LIBS += -ledllstub.lib -ledll.lib\\(uc_dll_.o\\)

    QMAKE_LFLAGS += --symver_soname --soname $${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].dll
}

contains(TEMPLATE, app) {
    !isEmpty($$QMAKE_POST_LINK):QMAKE_POST_LINK += &&

    QMAKE_POST_LINK += $$QMAKE_MOVE $$symbianDestdir/$${TARGET} $$symbianDestdir/$${TARGET}.sym
    QMAKE_POST_LINK += && elf2e32  --version $$decVersion --sid=$$TARGET.SID  --uid1=0x1000007a --uid2=$$TARGET.UID2 --uid3=$$TARGET.UID3 --dlldata --heap=0x00020000,0x00800000 --stack=0x00014000 --capability=None --fpu=softvfp --targettype=EXE --elfinput=$${symbianDestdir}/$${TARGET}.sym --output=$${symbianDestdir}/$${TARGET}.exe --unfrozen --linkas=$${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].exe --compressionmethod bytepair $$elf2e32_LIBPATH --unpaged | tee elf2e32.log && ! grep Error: elf2e32.log >& /dev/null && rm -f elf2e32.log
    QMAKE_DISTCLEAN += $${symbianDestdir}/$${TARGET}.exe

    QMAKE_LIBS += -leexe.lib\\(uc_exe_.o\\)

    QMAKE_LFLAGS += --symver_soname --soname $${TARGET}\\{$${hexVersion}\\}\\[$${intUid3}\\].exe
}

# Symbian resource files

linux-armcc:symbian_resources_INCLUDES = -I$$(RVCT22INC)
symbian_resources_INCLUDES = $$replace(symbian_resources_INCLUDES, ",", " -I")
symbian_resources_INCLUDES += $$join(INCLUDEPATH, " -I", "-I")
symbian_resources_DEFINES = $$join(DEFINES, " -D", "-D")
symbian_resources_RCC_DIR = $$replace(RCC_DIR, "/$", "")
symbian_resources_INCLUDES += "-I $$symbian_resources_RCC_DIR"

for(symbian_resource, SYMBIAN_RESOURCES) {
    symbian_resource = $$basename(symbian_resource)
    symbian_resource_clean = $$replace(symbian_resource, "\.rss$", ".rsc")
    QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${symbian_resource_clean}
    symbian_resource_clean = $$replace(symbian_resource, "\.rss$", ".rpp")
    QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${symbian_resource_clean}
}

symbianresources.input = SYMBIAN_RESOURCES
symbianresources.output = $$symbian_resources_RCC_DIR/${QMAKE_FILE_BASE}.rsg
symbianresources.commands = cpp -nostdinc -undef \
                            $$symbian_resources_INCLUDES \
                            $$symbian_resources_DEFINES \
                            ${QMAKE_FILE_NAME} \
                            -o $${symbian_resources_RCC_DIR}/${QMAKE_FILE_BASE}.rpp \
                            && rcomp -u -m045,046,047 \
                            -s$${symbian_resources_RCC_DIR}/${QMAKE_FILE_BASE}.rpp \
                            -o$${symbian_resources_RCC_DIR}/${QMAKE_FILE_BASE}.rsc \
                            -h$${symbian_resources_RCC_DIR}/${QMAKE_FILE_BASE}.rsg \
                            -i${QMAKE_FILE_NAME}
symbianresources.dependency_type = TYPE_C
symbianresources.CONFIG = no_link

QMAKE_EXTRA_COMPILERS += symbianresources

# Pre 2.6.23 Linux kernels have a limit on the environment size that can be passed to
# a forked process. We quite easily overstep this boundary when building big projects
# on Symbian, and since we depend on running the system() command, this causes the build
# to fail. Test here that system() can be successfully run. It is important that this
# check happens as late as possible, otherwise it will not be caught.
execve_sanity_test = $$system("echo testing")
!contains(execve_sanity_test, "testing") {
    error("Running system() failed. Maybe your kernel is too old? (Linux kernels need at least version 2.6.23)")
}