Ticket #46157: Portfile

File Portfile, 4.8 KB (added by Schamschula (Marius Schamschula), 9 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 135158 2015-04-17 02:13:42Z khindenburg@macports.org $
3
4PortSystem              1.0
5PortGroup               cmake 1.0
6PortGroup               qt4 1.0
7PortGroup               compilers 1.0
8
9name                    freecad
10version                 0.15.4671
11categories              cad
12platforms               darwin
13maintainers             gmail.com:mark.brethen \
14                        openmaintainer
15license                 LGPL-2+
16
17description \
18    FreeCAD is a general purpose feature-based, parametric 3D modeler.
19
20long_description \
21    FreeCAD is a general purpose feature-based, parametric 3D modeler for \
22    CAD, MCAD, CAx, CAE and PLM, aimed directly at mechanical engineering \
23    and product design but also fits a wider range of uses in engineering, \
24    such as architecture or other engineering specialties. It is 100% Open \
25    Source (LGPL2+ license) and extremely modular, allowing for very \
26    advanced extension and customization.
27
28homepage                http://www.freecadweb.org/
29master_sites            sourceforge:project/free-cad/FreeCAD%20Source/
30distname                ${name}_${version}
31worksrcdir              ${name}-${version}
32
33checksums               rmd160 384e482431c45872af24abb0228ef0aa8c864186 \
34                        sha256 8dda8f355cb59866a55c9c6096f39a3ebc5347892284db4c305352cc9be03bbc
35
36depends_lib-append      port:python27 \
37                        port:boost \
38                        port:xercesc \
39                        port:zlib \
40                        port:oce \
41                        port:swig \
42                        port:eigen3 \
43                        port:freetype \
44                        port:Coin-framework \
45                        port:SoQt \
46                        port:py27-matplotlib \
47                        port:py27-shiboken \
48                        port:py27-pyside \
49                        port:py27-pyside-tools \
50                        port:swig-python
51
52depends_run             port:qt4-mac-sqlite3-plugin
53
54patchfiles              cMake-FindCoin3D.cmake.diff \
55                        src-App-FreeCADInit.py.diff
56
57post-patch {
58    reinplace "s|QLibraryInfo::location.*|QLatin1String\(\"${applications_dir}/Qt4/\"\);|" \
59        ${worksrcpath}/src/Gui/Assistant.cpp
60
61    reinplace "s|/Applications|${applications_dir}|" \
62        ${worksrcpath}/src/Mod/OpenSCAD/OpenSCADUtils.py
63}
64
65compilers.choose        fc
66compilers.setup         -dragonegg -g95 require_fortran
67
68configure.args-delete   -DCMAKE_INSTALL_RPATH=${prefix}/lib \
69                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib
70
71configure.args-append   -DCMAKE_INSTALL_RPATH=${prefix}/libexec/${name}/lib \
72                        -DCMAKE_INSTALL_NAME_DIR=${prefix}/libexec/${name}/lib \
73                        -DCMAKE_INSTALL_PREFIX=${prefix}/libexec/${name} \
74                        -DCMAKE_INSTALL_DATADIR=${prefix}/share/${name} \
75                        -DCMAKE_INSTALL_DOCDIR=${prefix}/share/doc/${name} \
76                        -DCMAKE_FRAMEWORK_PATH=${frameworks_dir} \
77                        -DPYSIDEUIC4BINARY=${prefix}/bin/pyside-uic-2.7 \
78                        -DPYSIDERCC4BINARY=${prefix}/bin/pyside-rcc-2.7
79
80pre-configure {
81    # The c++ compiler is used for linking instead of fc.
82    # -L needs a path to a directory.
83
84    set libgfortran [exec ${configure.fc} --print-file-name libgfortran.a]
85    configure.ldflags-append "-L[file dirname ${libgfortran}]"
86
87    set python_prefix [exec ${prefix}/bin/python2.7-config --prefix]
88    configure.args-append -DBUILD_ROBOT=NO \
89        -DPYTHON_LIBRARY=${python_prefix}/Python \
90        -DPYTHON_INCLUDE_DIR=${python_prefix}/Headers \
91        -DPYTHON_EXECUTABLE=${python_prefix}/bin/python2.7 \
92        -DShiboken_DIR=${python_prefix}/lib/cmake/Shiboken-1.2.2 \
93        -DPySide_DIR=${python_prefix}/lib/cmake/PySide-1.2.2 \
94        -DOCE_DIR=${frameworks_dir}/OCE.framework/Versions/0.15/Resources
95}
96
97post-destroot {
98    # link the executables back
99    ln -s ${prefix}/libexec/${name}/bin/FreeCAD \
100        ${destroot}${prefix}/bin
101
102    ln -s ${prefix}/libexec/${name}/bin/FreeCADCmd \
103        ${destroot}${prefix}/bin
104
105    # create stub App
106    set appdir ${destroot}${applications_dir}/FreeCAD.app
107    xinstall -d ${appdir}/Contents/MacOS
108    xinstall -d ${appdir}/Contents/Resources
109
110    xinstall -m 644 ${filespath}/Info.plist ${appdir}/Contents/
111    xinstall -m 644 ${filespath}/FreeCAD.icns ${appdir}/Contents/Resources/
112    xinstall -m 755 ${filespath}/FreeCAD ${appdir}/Contents/MacOS
113
114    reinplace -W ${appdir}/Contents "s,@@VERSION@@,${version},g" Info.plist
115    reinplace -W ${appdir}/Contents/MacOS "s,@@PREFIX@@,${prefix},g" FreeCAD
116}
117
118livecheck.regex         ${name}.(\[0-9.\]+)${extract.suffix}