~librecad-dev/librecad/librecad

« back to all changes in this revision

Viewing changes to scripts/build-freebsd.sh

  • Committer: Scott Howard
  • Date: 2014-02-21 19:07:55 UTC
  • Revision ID: showard@debian.org-20140221190755-csjax9wb146hgdq4
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Copyright abandoned 2013 Tamas TEVESZ <ice@extreme.hu>
 
4
 
5
# this script builds LibreCAD on FreeBSD
 
6
# The following ports must be installed:
 
7
 
8
# x11-toolkits/qt4-gui devel/qt4-linguist devel/qt4-help-tools
 
9
# graphics/qt4-svg databases/qt4-sql(?) textproc/qt4-clucene(?)
 
10
# devel/boost-libs math/muparser
 
11
 
12
# lang/gcc4{7,8,9}
 
13
# or
 
14
# lang/clang33 and devel/llvm33 and devel/libc++
 
15
 
 
16
scriptpath="$( readlink -f "${0}" )"
 
17
scriptpath="${scriptpath%/*}"
 
18
 
 
19
if [ -z "${use_cxx}" ]
 
20
then
 
21
        if [ "$( which g++47 )" ]
 
22
        then
 
23
                use_cxx="g++47"
 
24
        elif [ "$( which g++48 )" ]
 
25
        then
 
26
                use_cxx="g++48"
 
27
        elif [ "$( which g++49 )" ]
 
28
        then
 
29
                use_cxx="g++49"
 
30
        elif [ "$( which clang++33 )" ]
 
31
        then
 
32
                use_cxx="clang++33"
 
33
        else
 
34
                echo "No supported compiler found. Install one of lang/{gcc4{7,8,9},clang33}" >&2
 
35
                exit 1
 
36
        fi
 
37
elif [ -z "$( which ${use_cxx} )" ]
 
38
then
 
39
        echo "Selected compiler ${use_cxx} not found" >&2
 
40
        exit 1
 
41
fi
 
42
 
 
43
rpath=
 
44
spec=
 
45
cxxflags=
 
46
libs=
 
47
 
 
48
compiler_version=${use_cxx##*++}
 
49
case "${use_cxx}" in
 
50
        'g++'*)
 
51
                rpath="$( make -C /usr/ports/lang/gcc${compiler_version} -V LOCALBASE )"/lib/gcc${compiler_version}
 
52
        ;;
 
53
        'clang++'*)
 
54
                if [ ! -e "$( make -C /usr/ports/lang/clang${compiler_version} -V LOCALBASE )"/lib/libc++.so ]
 
55
                then
 
56
                        echo "Install devel/libc++" >&2
 
57
                        exit 1
 
58
                fi
 
59
                cxxflags="-I /usr/local/include/c++/v1"
 
60
                libs="-stdlib=libc++"
 
61
        ;;
 
62
esac
 
63
spec="freebsd-${use_cxx}"
 
64
 
 
65
cd "${scriptpath}/.."
 
66
qmake-qt4 librecad.pro ${spec:+-spec ${spec}} "${rpath:+QMAKE_RPATHDIR=\"${rpath}\"}" "${cxxflags:+QMAKE_CXXFLAGS=\"${cxxflags}\"}" "${libs:+QMAKE_LIBS=\"${libs}\"}"
 
67
make -j$( /sbin/sysctl -n hw.ncpu )