OSDN Git Service

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