1 | PortSystem 1.0 |
---|
2 | |
---|
3 | name TeXworks |
---|
4 | version 20080720_105 |
---|
5 | revision 0 |
---|
6 | categories editors aqua tex |
---|
7 | platforms macosx |
---|
8 | maintainers nomaintainer |
---|
9 | description TeX previewer for Mac OS X |
---|
10 | long_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 (scripts.sil.org/XeTeX), \ |
---|
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 tug.org/texworks/ ) |
---|
24 | |
---|
25 | homepage http://code.google.com/p/texworks/ |
---|
26 | |
---|
27 | fetch.type svn |
---|
28 | svn.url http://texworks.googlecode.com/svn/trunk/ |
---|
29 | |
---|
30 | set worksrcdir trunk |
---|
31 | |
---|
32 | depends_build bin:svn:subversion |
---|
33 | |
---|
34 | depends_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 | # ( poppler +qt4Splash +quartz ) |
---|
40 | |
---|
41 | variant HEAD description {subversion checkout of last source revision} { |
---|
42 | ui_msg "------------------------------------------------------------------------" |
---|
43 | ui_msg "Variant \"HEAD\" is untested. It may not compile, and may have major bugs." |
---|
44 | ui_msg "TeXworks is a free and open source software project, and" |
---|
45 | ui_msg "Jonathan Kew invites you to participate." |
---|
46 | ui_msg "------------------------------------------------------------------------" |
---|
47 | } |
---|
48 | |
---|
49 | pre-fetch { |
---|
50 | if {![variant_isset HEAD]} then { |
---|
51 | set svn.tag [lindex [split ${version} "_"] end] |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|
55 | post-fetch { |
---|
56 | set info [exec svn info --xml ${worksrcpath}] |
---|
57 | |
---|
58 | if {[variant_isset HEAD]} then { |
---|
59 | regexp "<commit.*?revision.*?=.*?\"(.*?)\".*?>" "${info}" commitElement svnRevision |
---|
60 | regexp "<date>(.*?)T.*?</date>" "${info}" datetimeElement dateOfLastCommit |
---|
61 | set version [join [list [join [split $dateOfLastCommit "-"] ""] $svnRevision] "_"] |
---|
62 | ui_debug "version: $version" |
---|
63 | } |
---|
64 | |
---|
65 | ui_debug "+++++ svn info +++++\n" |
---|
66 | ui_debug "$info" |
---|
67 | ui_debug "++++++++++++++++++++" |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | post-patch { |
---|
72 | ui_debug "Tcl version is [info patchlevel]" |
---|
73 | |
---|
74 | set project [exec cat ${worksrcpath}/TeXworks.pro] |
---|
75 | regexp {(^.*?)(macx \{.*?\})(.*$)} "$project" wholeText preMacx macx postMacx |
---|
76 | unset project |
---|
77 | |
---|
78 | set query1 [regexp {/usr/local/include/hunspell} $macx] |
---|
79 | set query2 [regexp {/usr/local/include[ \t]*\n} $macx] |
---|
80 | set query3 [regexp {QMAKE_MACOSX_DEPLOYMENT_TARGET} $macx] |
---|
81 | |
---|
82 | if "! ($query1 && $query2 && $query3)" then { |
---|
83 | set macxLines [split "$macx" "\n"] |
---|
84 | unset macx |
---|
85 | if "! $query1" then { |
---|
86 | set macxLines [linsert "$macxLines" end-1 "\tINCLUDEPATH += ${prefix}/include/hunspell"] |
---|
87 | } |
---|
88 | if "! $query2" then { |
---|
89 | set macxLines [linsert "$macxLines" end-1 "\tINCLUDEPATH += ${prefix}/include"] |
---|
90 | } |
---|
91 | |
---|
92 | set darwinMajorVersion [lindex [split ${os.version} "."] 0] |
---|
93 | set deploymentTarget "10.5" |
---|
94 | if "$darwinMajorVersion == 8" then { |
---|
95 | set deploymentTarget "10.4" |
---|
96 | } elseif "$darwinMajorVersion == 7" then { |
---|
97 | set deploymentTarget "10.3" |
---|
98 | } elseif "$darwinMajorVersion == 6" then { |
---|
99 | set deploymentTarget "10.2" |
---|
100 | } |
---|
101 | ui_debug "MACOSX_DEPLOYMENT_TARGET = $deploymentTarget" |
---|
102 | |
---|
103 | if "! $query3" then { |
---|
104 | # set deploymentTarget [option macosx_deployment_target] ;# MacPorts base version > 1.6.0 |
---|
105 | set macxLines [linsert "$macxLines" end-1 "\tQMAKE_MACOSX_DEPLOYMENT_TARGET = $deploymentTarget"] |
---|
106 | } |
---|
107 | set macx [join "$macxLines" "\n"] |
---|
108 | |
---|
109 | file copy ${worksrcpath}/TeXworks.pro ${worksrcpath}/TeXworks.pro.orig |
---|
110 | exec echo "$preMacx" > ${worksrcpath}/TeXworks.pro |
---|
111 | exec echo "$macx" >> ${worksrcpath}/TeXworks.pro |
---|
112 | exec echo "$postMacx" >> ${worksrcpath}/TeXworks.pro |
---|
113 | } |
---|
114 | |
---|
115 | reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/TeXworks.pro |
---|
116 | |
---|
117 | |
---|
118 | ### search path for tex/latex binaries ### |
---|
119 | |
---|
120 | set TWApp.cpp [exec cat ${worksrcpath}/src/TWApp.cpp] |
---|
121 | regexp {(^.*?)(void TWApp::setDefaultPaths.*?\{.*?\})(.*$)} "${TWApp.cpp}" wholeText preFunc func postFunc |
---|
122 | unset TWApp.cpp |
---|
123 | |
---|
124 | regexp {(^.*?#ifdef Q_WS_MAC)(.*?)(#endif.*$)} "$func" wholeText ifdef searchPath endif |
---|
125 | |
---|
126 | set searchPathLines [split [string trim "$searchPath" "\n"] "\n"] |
---|
127 | set searchPathLines [linsert "$searchPathLines" end "\t\t<< \"${prefix}/bin\""] |
---|
128 | set searchPath [join "$searchPathLines" "\n"] |
---|
129 | |
---|
130 | file copy ${worksrcpath}/src/TWApp.cpp ${worksrcpath}/src/TWApp.cpp.orig |
---|
131 | exec echo "$preFunc" > ${worksrcpath}/src/TWApp.cpp |
---|
132 | exec echo "$ifdef" >> ${worksrcpath}/src/TWApp.cpp |
---|
133 | exec echo "$searchPath" >> ${worksrcpath}/src/TWApp.cpp |
---|
134 | exec echo "$endif" >> ${worksrcpath}/src/TWApp.cpp |
---|
135 | exec echo "$postFunc" >> ${worksrcpath}/src/TWApp.cpp |
---|
136 | } |
---|
137 | |
---|
138 | configure { |
---|
139 | system "cd ${worksrcpath} && \ |
---|
140 | qmake -makefile -macx -d" |
---|
141 | } |
---|
142 | |
---|
143 | post-configure { |
---|
144 | # wrong library path in pkgconfig files *.pc of port qt4-mac. |
---|
145 | # see bug report, Ticket no.16120 |
---|
146 | reinplace "s|-L${portdbpath}/build/.*/lib||g" ${worksrcpath}/Makefile |
---|
147 | } |
---|
148 | |
---|
149 | destroot { |
---|
150 | set app ${destroot}/Applications/MacPorts |
---|
151 | xinstall -d ${app} |
---|
152 | file copy ${worksrcpath}/TexWorks.app ${app} |
---|
153 | } |
---|
154 | |
---|
155 | variant texlive_base { |
---|
156 | depends_run port:texlive_base |
---|
157 | } |
---|