OSDN Git Service

macvim 20100315
[splhack/MacPorts.git] / editors / macvim / Portfile
1 # $Id$
2 PortSystem      1.0
3
4 name                            macvim
5 version                         20100315
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                       ${distname}.zip sha1 \
19                                                 0229c044385ff5cae4f5cbdcc4f44fe7dafb7a8a
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          --with-features=huge \
32                                         --enable-multibyte \
33                                         --enable-netbeans \
34                                         --with-tlib=ncurses
35 configure.cppflags      -I${prefix}/include
36 configure.ldflags       -L${prefix}/lib
37
38 if {[variant_isset universal]} {
39         set macosx_deployment_target 10.5
40         configure.args-append   --with-macarchs="${universal_archs}" \
41                                                         --with-macsdk="${macosx_deployment_target}"
42 }
43
44 use_parallel_build      yes
45
46 variant perl description {Enable Perl scripting} {
47         configure.args-append   --enable-perlinterp
48         depends_lib-append              bin:perl:perl5.10
49 }
50 variant python description {Enable Python scripting} {
51         configure.args-append   --enable-pythoninterp
52         depends_lib-append              bin:python:python26
53 }
54 variant ruby description {Enable Ruby scripting} {
55         configure.args-append   --enable-rubyinterp
56         depends_lib-append              bin:ruby:ruby
57 }
58 variant tcl description {Enable Tcl scripting} {
59         configure.args-append   --enable-tclinterp
60         depends_lib-append              bin:tclsh:tcl
61 }
62 variant cscope description {Enable source code browsing with cscope} {
63         configure.args-append   --enable-cscope
64 }
65
66 post-patch {
67         reinplace \
68                 "s|^# VIM_APP_DIR=/Applications$|VIM_APP_DIR=${applications_dir}|" \
69                 ${worksrcpath}/MacVim/mvim
70 }
71
72 set appPath "${destroot}${applications_dir}/MacVim.app/Contents"
73 set runtimePath "${appPath}/Resources/vim/runtime"
74
75 destroot {
76         file copy ${worksrcpath}/MacVim/build/Release/MacVim.app ${destroot}${applications_dir}
77         xinstall -m 755 ${worksrcpath}/MacVim/mvim ${destroot}${prefix}/bin
78         xinstall -d 755 ${runtimePath}/lang/ja_JP.UTF-8/LC_MESSAGES
79         xinstall -m 644 ${worksrcpath}/po/ja_JP.UTF-8.mo \
80                 ${runtimePath}/lang/ja_JP.UTF-8/LC_MESSAGES/vim.mo
81         file copy ${prefix}/share/migemo/tools/migemo.vim \
82                 ${runtimePath}/plugin/migemo.vim
83 }
84
85 test.run                        yes
86
87 variant standalone description {Enable standalonize} {
88         depends_lib-append port:vimproc port:clewn
89         configure.env-append    PATH="/usr/bin:${env(PATH)}"
90         configure.cppflags-append       -DDYNAMIC_PERL -DDYNAMIC_PYTHON -DDYNAMIC_RUBY
91         pre-extract {
92                 if {[catch {system "port installed|grep -e \" ruby @.*(active)\" -e \" perl5 @.*(active)\" -e \" perl5.8 @.*(active)\""} result]} {} else {
93                         return -code error "perl or ruby is activated"
94                 }
95         }
96         post-configure {
97                 reinplace "s|^PERL_LIBS|#PERL_LIBS|" ${worksrcpath}/auto/config.mk
98                 reinplace "s|^PYTHON_LIBS|#PYTHON_LIBS|" ${worksrcpath}/auto/config.mk
99                 reinplace "s|^RUBY_LIBS|#RUBY_LIBS|" ${worksrcpath}/auto/config.mk
100         }
101         post-destroot {
102                 # ctags
103                 file copy ${prefix}/bin/ctags ${appPath}/MacOS
104
105                 # vimproc
106                 set vimprocPath ${prefix}/share/vimproc/autoload
107                 file copy ${vimprocPath}/proc.so ${runtimePath}/autoload
108                 file copy ${vimprocPath}/vimproc.vim ${runtimePath}/autoload
109
110                 # clewn
111                 file copy ${prefix}/bin/clewn ${appPath}/MacOS
112                 set clewnPath ${prefix}/share/clewn
113                 file copy ${clewnPath}/.clewn_keys ${runtimePath}
114                 file copy ${clewnPath}/clewn.vim ${runtimePath}
115                 file copy ${clewnPath}/doc/clewn.txt ${runtimePath}/doc
116                 file copy ${clewnPath}/macros/clewn_mappings.vim ${runtimePath}/macros
117                 file copy ${clewnPath}/syntax/gdbvar.vim ${runtimePath}/syntax
118
119                 # dylibs
120                 foreach dylib {intl.8 iconv.2 migemo.1 ncurses.5 readline.6} {
121                         set libname [lindex [split ${dylib} .] 0]
122                         set instname "@executable_path/../Frameworks/lib${libname}.dylib"
123                         set origname "${prefix}/lib/lib${dylib}.dylib"
124                         foreach exec {MacOS/Vim MacOS/clewn} {
125                                 system "install_name_tool \
126                                         -change ${origname} ${instname} ${appPath}/${exec}"
127                         }
128                         if {[file type ${origname}] == "link"} {
129                                 set realpath "${prefix}/lib/"
130                                 append realpath [file readlink ${origname}]
131                         } else {
132                                 set realpath ${origname}
133                         }
134                         xinstall -m 755 ${realpath} \
135                                 ${appPath}/Frameworks/lib${libname}.dylib
136                 }
137                 system "install_name_tool \
138                         -change ${prefix}/lib/libiconv.2.dylib \
139                         @executable_path/../Frameworks/libiconv.dylib \
140                         ${appPath}/Frameworks/libintl.dylib"
141                 system "install_name_tool \
142                         -change ${prefix}/lib/libncurses.5.dylib \
143                         @executable_path/../Frameworks/libncurses.dylib \
144                         ${appPath}/Frameworks/libreadline.dylib"
145
146                 # migemo dicts
147                 xinstall -d 755 ${runtimePath}/dict
148                 foreach mdict {han2zen.dat hira2kata.dat \
149                                 migemo-dict roma2hira.dat zen2han.dat} {
150                         xinstall -m 644 ${prefix}/share/migemo/utf-8/${mdict} \
151                                 ${runtimePath}/dict
152                 }
153
154                 # vim tags
155                 system "${appPath}/MacOS/Vim \
156                         --cmd \":helptag ${runtimePath}/doc\" --cmd :quit"
157         }
158 }