SVN_SILENT made messages (.desktop file)
[trojita.git] / packaging / harmattan-rm680-madde-c++
blob803fb05b73b9dcf18ad8d53132871bd83bc4e062
1 #!/bin/bash
3 # Compiler wrapper for using clang within a cmake-based buildsystem for producing MeeGo Harmattan packages
4 # Written by Jan Kundrát <jkt@flaska.net> during a sleepless night
5 # Licensed under a three-clause BSD license
8 # 1) Create a new Madde target, i.e. "clang-rm680", a blank directory within ~/QtSDK/Madde/targets/
10 # 2) Set up the following directory structure:
11 # jkt@svist ~/QtSDK/Madde/targets/clang-rm680 $ tree
12 # .
13 # |-- bin
14 # | |-- addr2line -> ../../harmattan_10.2011.34-1_rt1.2/bin/addr2line
15 # | |-- ar -> ../../harmattan_10.2011.34-1_rt1.2/bin/ar
16 # | |-- as -> ../../harmattan_10.2011.34-1_rt1.2/bin/as
17 # | |-- c++
18 # | |-- c++filt -> ../../harmattan_10.2011.34-1_rt1.2/bin/c++filt
19 # | |-- cc -> ../../harmattan_10.2011.34-1_rt1.2/bin/cc
20 # | |-- cpp -> ../../harmattan_10.2011.34-1_rt1.2/bin/cpp
21 # | |-- g++ -> ../../harmattan_10.2011.34-1_rt1.2/bin/g++
22 # | |-- gcc -> ../../harmattan_10.2011.34-1_rt1.2/bin/gcc
23 # | |-- gccbug -> ../../harmattan_10.2011.34-1_rt1.2/bin/gccbug
24 # | |-- gcov -> ../../harmattan_10.2011.34-1_rt1.2/bin/gcov
25 # | |-- gdb -> ../../harmattan_10.2011.34-1_rt1.2/bin/gdb
26 # | |-- gdbtui -> ../../harmattan_10.2011.34-1_rt1.2/bin/gdbtui
27 # | |-- gprof -> ../../harmattan_10.2011.34-1_rt1.2/bin/gprof
28 # | |-- ld -> ../../harmattan_10.2011.34-1_rt1.2/bin/ld
29 # | |-- lrelease -> ../../harmattan_10.2011.34-1_rt1.2/bin/lrelease
30 # | |-- lupdate -> ../../harmattan_10.2011.34-1_rt1.2/bin/lupdate
31 # | |-- mgen -> ../../harmattan_10.2011.34-1_rt1.2/bin/mgen
32 # | |-- mmoc -> ../../harmattan_10.2011.34-1_rt1.2/bin/mmoc
33 # | |-- mmoc.pl -> ../../harmattan_10.2011.34-1_rt1.2/bin/mmoc.pl
34 # | |-- moc
35 # | |-- nm -> ../../harmattan_10.2011.34-1_rt1.2/bin/nm
36 # | |-- objcopy -> ../../harmattan_10.2011.34-1_rt1.2/bin/objcopy
37 # | |-- objdump -> ../../harmattan_10.2011.34-1_rt1.2/bin/objdump
38 # | |-- qmake -> ../../harmattan_10.2011.34-1_rt1.2/bin/qmake
39 # | |-- qt.conf -> ../../harmattan_10.2011.34-1_rt1.2/bin/qt.conf
40 # | |-- ranlib -> ../../harmattan_10.2011.34-1_rt1.2/bin/ranlib
41 # | |-- rcc -> ../../harmattan_10.2011.34-1_rt1.2/bin/rcc
42 # | |-- readelf -> ../../harmattan_10.2011.34-1_rt1.2/bin/readelf
43 # | |-- size -> ../../harmattan_10.2011.34-1_rt1.2/bin/size
44 # | |-- strings -> ../../harmattan_10.2011.34-1_rt1.2/bin/strings
45 # | |-- strip -> ../../harmattan_10.2011.34-1_rt1.2/bin/strip
46 # | `-- uic -> ../../harmattan_10.2011.34-1_rt1.2/bin/uic
47 # |-- config.sh -> ../harmattan_10.2011.34-1_rt1.2/config.sh
48 # |-- information -> ../harmattan_10.2011.34-1_rt1.2/information
49 # |-- lib -> ../harmattan_10.2011.34-1_rt1.2/lib
50 # `-- specs -> ../harmattan_10.2011.34-1_rt1.2/specs
52 # 3) Put this file into the bin/c++ and the accompanying moc wrapper into
53 # bin/moc (symlink is fine)
55 # 4) When building, use "clang-rm680" as the Madde target
57 # crude hack for detecting whether to forward this to GCC's c++ in case it's about linking...
58 echo "${@}" | grep -q -E -- '-rdynamic|-soname'
59 if [[ $? -eq 1 ]]; then
60 # Funny fact: clang 3.3 doesn't do exceptions on ARM by default
61 # See http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-February/059015.html
62 # and the rest of the thread
63 clang++ -target armv7l-linux-gnueabi -mfloat-abi=hard \
64 -mllvm -arm-enable-ehabi -mllvm -arm-enable-ehabi-descriptors \
65 --sysroot ${SYSROOT_DIR} -integrated-as $@
66 # Theoretically, we could perhaps pass the -B $(dirname "${BASH_SOURCE[0]}")
67 # but that should not be needed as we really want to delegate the linking to
68 # the GNU toolchain.
69 # This delegation is required because I have no idea how to persuade clang++
70 # to not strip the resulting ELFs
71 else
72 $(dirname $(readlink -f $(dirname "${BASH_SOURCE[0]}")/ld))/c++ $@