OSDN Git Service

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