Ticket #16055: Portfile_v2

File Portfile_v2, 4.2 KB (added by jens.traube@…, 16 years ago)

Portfile -- version 2

Line 
1PortSystem 1.0
2                   
3name                TeXworks
4version             ""
5revision            0
6categories          editors aqua tex
7platforms           macosx
8maintainers         nomaintainer
9description         TeX previewer for Mac OS X
10long_description \
11    TeXworks is a TeX previewer for Mac OS X, Linux, and Windows. \
12    It uses the Qt4 GUI framework and the Poppler PDF rendering library \
13    (compiled with Qt4 wrapper). \
14    The TeXworks project has been founded by Jonathan Kew (www.sil.org), \
15    the developer of XeTeX. It is inspired by TeXShop, the only TeX previewer \
16    with a relative simple user interface. \
17    Jonathan Kew: \"TeXworks aims to provide a simple TeX environment \
18    based on modern standards (including Unicode encoding and PDF output by default) \
19    with an uncluttered interface that does not overwhelm the newcomer. \
20    It is built using cross-platform, open-source tools and libraries, \
21    so as to be available on all today's major operating systems, \
22    with a native look and feel for each.\" \
23    ( --> tug.org/tug2008/abstracts/kew.pdf  and  http://tug.org/texworks/ )
24
25homepage            http://code.google.com/p/texworks/
26
27fetch.type          svn
28svn.url             http://texworks.googlecode.com/svn/trunk/
29
30set worksrcdir      trunk
31
32depends_build       port:subversion
33
34depends_lib         port:qt4-mac \
35                    port:poppler \
36                    port:hunspell
37
38# poppler has to be build with Qt4 frontend and Splash rendering backend
39
40post-fetch {
41    set info [exec svn info --xml ${worksrcpath}]
42    regexp "<commit.*?revision.*?=.*?\"(.*?)\".*?>" "${info}" commitElement svnRevision
43    regexp "<date>(.*?)T.*?</date>" "${info}" datetimeElement dateOfLastCommit
44    set version [join [list [join [split $dateOfLastCommit "-"] ""] $svnRevision] "_"]
45    ui_debug "version: $version"
46
47    ui_debug "+++++ svn info +++++\n"
48    ui_debug "$info"
49    ui_debug "++++++++++++++++++++"
50}
51
52
53post-patch {
54    ui_debug "Tcl version is [info patchlevel]"
55
56    cd ${worksrcpath}
57    set project [exec cat TeXworks.pro]
58    regexp {(^.*?)(macx \{.*?\})(.*$)} "$project"  wholeText  preMacx  macx  postMacx
59    unset project
60
61    set query1 [regexp {/usr/local/include/hunspell} $macx]
62    set query2 [regexp {/usr/local/include[ \t]*\n} $macx]
63    set query3 [regexp {QMAKE_MACOSX_DEPLOYMENT_TARGET} $macx]
64
65    if "! ($query1 && $query2 && $query3)" then {
66        file copy TeXworks.pro TeXworks.pro.orig
67        exec echo "$preMacx" > TeXworks.pro
68        set macxLines [split "$macx" "\n"]
69        unset macx
70        set nLines [llength "$macxLines"]
71        if "! $query1" then {
72            set macxLines [linsert "$macxLines" end-1 "\tINCLUDEPATH += ${prefix}/include/hunspell"]
73            set nLines [expr $nLines + 1]
74        }
75        if "! $query2" then {
76            set macxLines [linsert "$macxLines" end-1 "\tINCLUDEPATH += ${prefix}/include"]
77            set nLines [expr $nLines + 1]
78        }
79
80        set darwinMajorVersion [lindex [split ${os.version} "."] 0]
81        set deploymentTarget "10.5"
82        if "$darwinMajorVersion == 8" then {
83            set deploymentTarget "10.4"
84        } elseif "$darwinMajorVersion == 7" then {
85            set deploymentTarget "10.3"
86        } elseif "$darwinMajorVersion == 6" then {
87            set deploymentTarget "10.2"
88        }
89        ui_debug "MACOSX_DEPLOYMENT_TARGET = $deploymentTarget"
90
91        if "! $query3" then {
92            set macxLines [linsert "$macxLines" end-1 "\tQMAKE_MACOSX_DEPLOYMENT_TARGET = $deploymentTarget"]
93            set nLines [expr $nLines + 1]
94        }
95        set macx [join "$macxLines" "\n"]
96        exec echo "$macx" >> TeXworks.pro
97        exec echo "$postMacx" >> TeXworks.pro
98    }
99
100    reinplace "s|/usr/local|${prefix}|g" TeXworks.pro
101}
102
103configure {
104    system "cd ${worksrcpath}  && \
105            qmake -makefile -macx -d"
106}
107
108post-configure {
109    # wrong library path in pkgconfig files *.pc of port qt4-mac.
110    # see bug report, Ticket no.16120
111    reinplace "s|-L${portdbpath}/build/.*/lib||g" ${worksrcpath}/Makefile
112}
113
114destroot {
115    set app ${destroot}/Applications/MacPorts
116    xinstall -d ${app}
117    file copy ${worksrcpath}/TexWorks.app ${app}
118}