OSDN Git Service

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