OSDN Git Service

macvim 20090802
[splhack/MacPorts.git] / editors / macvim / Portfile
1 # $Id$
2 PortSystem      1.0
3
4 name                            macvim
5 version                         20090802
6 revision                        0
7 categories                      editors
8 platforms                       darwin
9 maintainers                     nomaintainer
10 description                     MacVim is a port of the text editor Vim to Mac OS X.
11 long_description        MacVim supports multiple windows with tabbed editing and a host of other features. \
12                                         MacVim brings you the full power of Vim to Mac OS X.
13 homepage                        http://code.google.com/p/macvim-kaoriya/
14
15 set gittag                      ${version}
16 distname                        KaoriYa-${gittag}
17 use_zip                         yes
18 checksums                       \
19         ${distname}.zip sha1 d276f8e1d109689dba82ccefcf4ec1744ea4c9e5
20 master_sites            \
21         "http://repo.or.cz/w/MacVim/KaoriYa.git?a=snapshot;h=${gittag};sf=zip&"
22 worksrcdir                      KaoriYa/src
23 extract.only            ${distname}.zip
24
25 depends_lib                     port:cmigemo \
26                                         port:gettext \
27                                         port:libiconv \
28                                         port:ncurses
29
30 configure.pre_args      --prefix=${applications_dir}
31 configure.args          --enable-gui=macvim \
32                                         --without-x \
33                                         --disable-gpm \
34                                         --with-features=huge \
35                                         --enable-multibyte \
36                                         --enable-netbeans \
37                                         --with-tlib=ncurses
38 configure.cppflags      -I${prefix}/include
39 configure.ldflags       -L${prefix}/lib
40
41 if {[variant_isset universal]} {
42         configure.universal_target      10.4
43         configure.args-append           --with-mac-arch=both
44         set xcodeconfig Universal
45 } else {
46         set xcodeconfig Release
47 }
48
49 use_parallel_build      yes
50
51 variant perl description {Enable Perl scripting} {
52         configure.args-append   --enable-perlinterp
53         depends_lib-append              bin:perl:perl5.8
54 }
55 variant python description {Enable Python scripting} {
56         configure.args-append   --enable-pythoninterp
57         depends_lib-append              bin:python:python25
58 }
59 variant ruby description {Enable Ruby scripting} {
60         configure.args-append   --enable-rubyinterp
61         configure.env-append    ARCHFLAGS="-L${prefix}/lib"
62         depends_lib-append              bin:ruby:ruby
63 }
64 variant tcl description {Enable Tcl scripting} {
65         configure.args-append   --enable-tclinterp
66         depends_lib-append              bin:tclsh:tcl
67 }
68 variant cscope description {Enable source code browsing with cscope} {
69         configure.args-append   --enable-cscope
70 }
71
72 post-patch {
73         reinplace \
74                 "s|^# VIM_APP_DIR=/Applications$|VIM_APP_DIR=${applications_dir}|" \
75                 ${worksrcpath}/MacVim/mvim
76 }
77
78 post-build {
79         system "cd ${worksrcpath}/po; make ja_JP.UTF-8.mo"
80         system "cd ${worksrcpath}/MacVim; xcodebuild -configuration ${xcodeconfig}"
81 }
82
83 # Can be removed once MacPorts 1.7.1 is released
84 pre-destroot {
85         xinstall -d ${destroot}${applications_dir}
86 }
87
88 set appPath "${destroot}${applications_dir}/MacVim.app/Contents"
89 set runtimePath "${appPath}/Resources/vim/runtime"
90
91 destroot {
92         file copy ${worksrcpath}/MacVim/build/${xcodeconfig}/MacVim.app ${destroot}${applications_dir}
93         xinstall -m 755 ${worksrcpath}/MacVim/mvim ${destroot}${prefix}/bin
94         xinstall -d 755 ${runtimePath}/lang/ja_JP.UTF-8/LC_MESSAGES
95         xinstall -m 644 ${worksrcpath}/po/ja_JP.UTF-8.mo \
96                 ${runtimePath}/lang/ja_JP.UTF-8/LC_MESSAGES/vim.mo
97         file copy ${prefix}/share/migemo/tools/migemo.vim \
98                 ${runtimePath}/plugin/migemo.vim
99 }
100
101 test.run                        yes
102
103 variant standalone description {Enable standalonize} {
104         depends_lib-append port:vimproc port:clewn
105         configure.env-append    PATH="/usr/bin:${env(PATH)}"
106         configure.cppflags-append       -DDYNAMIC_PERL -DDYNAMIC_PYTHON -DDYNAMIC_RUBY
107         post-configure {
108                 reinplace "s|^PERL_LIBS|#PERL_LIBS|" ${worksrcpath}/auto/config.mk
109                 reinplace "s|^PYTHON_LIBS|#PYTHON_LIBS|" ${worksrcpath}/auto/config.mk
110                 reinplace "s|^RUBY_LIBS|#RUBY_LIBS|" ${worksrcpath}/auto/config.mk
111         }
112         post-destroot {
113                 # ctags
114                 file copy ${prefix}/bin/ctags ${appPath}/MacOS
115
116                 # vimproc
117                 set vimprocPath ${prefix}/share/vimproc/autoload
118                 file copy ${vimprocPath}/proc.so ${runtimePath}/autoload
119                 file copy ${vimprocPath}/proc.vim ${runtimePath}/autoload
120
121                 # clewn
122                 file copy ${prefix}/bin/clewn ${appPath}/MacOS
123                 set clewnPath ${prefix}/share/clewn
124                 file copy ${clewnPath}/.clewn_keys ${runtimePath}
125                 file copy ${clewnPath}/clewn.vim ${runtimePath}
126                 file copy ${clewnPath}/doc/clewn.txt ${runtimePath}/doc
127                 file copy ${clewnPath}/macros/clewn_mappings.vim ${runtimePath}/macros
128                 file copy ${clewnPath}/syntax/gdbvar.vim ${runtimePath}/syntax
129
130                 # dylibs
131                 foreach dylib {intl.8 iconv.2 migemo.1 ncurses.5 readline.6} {
132                         set libname [lindex [split ${dylib} .] 0]
133                         set instname "@executable_path/../Frameworks/lib${libname}.dylib"
134                         set origname "${prefix}/lib/lib${dylib}.dylib"
135                         foreach exec {MacOS/Vim MacOS/clewn} {
136                                 system "install_name_tool \
137                                         -change ${origname} ${instname} ${appPath}/${exec}"
138                         }
139                         if {[file type ${origname}] == "link"} {
140                                 set realpath "${prefix}/lib/"
141                                 append realpath [file readlink ${origname}]
142                         } else {
143                                 set realpath ${origname}
144                         }
145                         xinstall -m 755 ${realpath} \
146                                 ${appPath}/Frameworks/lib${libname}.dylib
147                 }
148                 system "install_name_tool \
149                         -change ${prefix}/lib/libiconv.2.dylib \
150                         @executable_path/../Frameworks/libiconv.dylib \
151                         ${appPath}/Frameworks/libintl.dylib"
152                 system "install_name_tool \
153                         -change ${prefix}/lib/libncurses.5.dylib \
154                         @executable_path/../Frameworks/libncurses.dylib \
155                         ${appPath}/Frameworks/libreadline.dylib"
156
157                 # migemo dicts
158                 xinstall -d 755 ${runtimePath}/dict
159                 foreach mdict {han2zen.dat hira2kata.dat \
160                                 migemo-dict roma2hira.dat zen2han.dat} {
161                         xinstall -m 644 ${prefix}/share/migemo/utf-8/${mdict} \
162                                 ${runtimePath}/dict
163                 }
164
165                 # vim tags
166                 system "${appPath}/MacOS/Vim \
167                         --cmd \":helptag ${runtimePath}/doc\" --cmd :quit"
168         }
169 }