Ticket #16055: Portfile

File Portfile, 4.2 KB (added by jens.traube@…, 16 years ago)
Line 
1PortSystem 1.0
2                   
3name                TeXworks
4version             ""
5revision            ""
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 )
24
25homepage            (1) http://code.google.com/p/texworks/      (2) http://tug.org/texworks/
26
27fetch.type          svn
28svn.url             http://texworks.googlecode.com/svn/trunk/
29
30set worksrcdir      texworks
31svn.pre_args-append --quiet
32svn.post_args-append    ${worksrcdir}
33
34
35depends_build       port:subversion
36
37depends_lib         port:qt4-mac \
38                    port:poppler \
39                    port:hunspell
40
41# poppler has to be build with Qt4 frontend and Splash rendering backend
42
43post-fetch {
44    set info [exec svn info --xml ${worksrcpath}]
45    regexp "<commit.*?revision.*?=.*?\"(.*?)\".*?>" "${info}" commitElement revision
46    regexp "<date>(.*?)T.*?</date>" "${info}" datetimeElement dateOfLastCommit
47    set version [join [split $dateOfLastCommit "-"] ""]
48    ui_debug "version: $version"
49
50    ui_debug "+++++ svn info +++++\n"
51    ui_debug "$info"
52    ui_debug "++++++++++++++++++++"
53}
54
55
56post-patch {
57    ui_debug "Tcl version is [info patchlevel]"
58
59    cd ${worksrcpath}
60    set project [exec cat TeXworks.pro]
61    regexp {(^.*?)(macx \{.*?\})(.*$)} "$project"  wholeText  preMacx  macx  postMacx
62    unset project
63
64    set query1 [regexp {/usr/local/include/hunspell} $macx]
65    set query2 [regexp {/usr/local/include[ \t]*\n} $macx]
66    set query3 [regexp {QMAKE_MACOSX_DEPLOYMENT_TARGET} $macx]
67
68    if "! ($query1 && $query2 && $query3)" then {
69        file copy TeXworks.pro TeXworks.pro.orig
70        exec echo "$preMacx" > TeXworks.pro
71        set macxLines [split "$macx" "\n"]
72        unset macx
73        set nLines [llength "$macxLines"]
74        if "! $query1" then {
75            set macxLines [linsert "$macxLines" end-1 "\tINCLUDEPATH += ${prefix}/include/hunspell"]
76            set nLines [expr $nLines + 1]
77        }
78        if "! $query2" then {
79            set macxLines [linsert "$macxLines" end-1 "\tINCLUDEPATH += ${prefix}/include"]
80            set nLines [expr $nLines + 1]
81        }
82
83        set darwinMajorVersion [lindex [split ${os.version} "."] 0]
84        set deploymentTarget "10.5"
85        if "$darwinMajorVersion == 8" then {
86            set deploymentTarget "10.4"
87        } elseif "$darwinMajorVersion == 7" then {
88            set deploymentTarget "10.3"
89        } elseif "$darwinMajorVersion == 6" then {
90            set deploymentTarget "10.2"
91        }
92        ui_debug "MACOSX_DEPLOYMENT_TARGET = $deploymentTarget"
93
94        if "! $query3" then {
95            set macxLines [linsert "$macxLines" end-1 "\tQMAKE_MACOSX_DEPLOYMENT_TARGET = $deploymentTarget"]
96            set nLines [expr $nLines + 1]
97        }
98        set macx [join "$macxLines" "\n"]
99        exec echo "$macx" >> TeXworks.pro
100        exec echo "$postMacx" >> TeXworks.pro
101    }
102
103    reinplace "s|/usr/local|${prefix}|g" TeXworks.pro
104}
105
106
107
108
109configure {
110    system "cd ${worksrcpath}  && \
111            qmake -makefile -macx -d"
112}
113
114post-configure {
115    # wrong library path in pkgconfig files *.pc of port qt4-mac
116    reinplace "s|-L${portdbpath}/build/.*/lib||g" ${worksrcpath}/Makefile
117}
118
119destroot {
120    set app ${destroot}/Applications/MacPorts
121    xinstall -d ${app}
122    system "cd ${worksrcpath}  && \
123            cp -pR TexWorks.app ${app}"
124}