blob: 3b16f175c72470d1ac35840ed82fa9a950ad76e8 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# A-A-P recipe for building Vim
2#
3# There are no user choices in here!
4# Put configure arguments in the file config.arg.
5# Later there will be a config.txt file that contains examples and
6# explanations.
7#
8# Optional arguments:
Bram Moolenaar1e015462005-09-25 22:16:38 +00009# PREFIX=dir Overrules the install directory.
10# Can be specified when installing only.
11# Example: aap install PREFIX=$HOME
Bram Moolenaar071d4272004-06-13 20:20:40 +000012#
13
14# Skip the configure stuff when "link.sh" is executing this recipe recursively
15# to build pathdef.c or not building something and auto/config.aap does exist.
16@if ((_no.TARGETARG != "pathdef" and has_build_target())
Bram Moolenaar1e015462005-09-25 22:16:38 +000017@ or not os.path.exists("auto/config.aap")):
Bram Moolenaar071d4272004-06-13 20:20:40 +000018
19 #
20 # A U T O C O N F
21 #
22
23 # Run autoconf when configure.in has been changed since it was last run.
24 # This is skipped when the signatures in "mysign" are up-to-date. When
25 # there is no autoconf program skip this (the signature is often the only
26 # thing that's outdated)
27 auto/configure {signfile = mysign} : configure.in
Bram Moolenaar1e015462005-09-25 22:16:38 +000028 @if not program_path("autoconf"):
29 :print Can't find autoconf, using existing configure script.
30 @else:
Bram Moolenaar071d4272004-06-13 20:20:40 +000031 # Move configure aside, autoconf would overwrite it
32 :move {exist} configure configure.save
33 :sys autoconf
34 :cat configure | :eval re.sub('\\./config.log', 'auto/config.log', stdin) >! auto/configure
35 :chmod 755 auto/configure
36 :move configure.save configure
37 :del {force} auto/config.cache auto/config.status
38
39 # Change the configure script to produce config.aap instead of config.mk.
40 auto/configure.aap : auto/configure
Bram Moolenaar1e015462005-09-25 22:16:38 +000041 :print Adjusting auto/configure for A-A-P.
42 :cat auto/configure | :eval re.sub("config.mk", "config.aap", stdin)
43 >! auto/configure.aap
44 :chmod 755 auto/configure.aap
Bram Moolenaar071d4272004-06-13 20:20:40 +000045
46 # The configure script uses the directory where it's located, use a link.
47 configure.aap: {buildcheck=}
Bram Moolenaar1e015462005-09-25 22:16:38 +000048 :symlink {f} auto/configure.aap configure.aap
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
50 # Dependency: run configure.aap to update config.h and config.aap in the
51 # "auto" directory.
52 config {virtual} auto/config.h auto/config.aap :
Bram Moolenaar1e015462005-09-25 22:16:38 +000053 auto/configure.aap configure.aap
54 config.arg config.h.in config.aap.in
55 :sys CONFIG_STATUS=auto/config.status
Bram Moolenaar071d4272004-06-13 20:20:40 +000056 ./configure.aap `file2string("config.arg")`
57 --cache-file=auto/config.cache
58
59 # Configure arguments: create an empty "config.arg" file when its missing
60 config.arg:
Bram Moolenaar1e015462005-09-25 22:16:38 +000061 :touch {exist} config.arg
Bram Moolenaar071d4272004-06-13 20:20:40 +000062
63 # "auto/config.aap" contains a lot of settings, such as the name of the
64 # executable "Target".
65 # First update it, forcefully if the "reconfig" target was used.
66 @if _no.TARGETARG != "comment" and _no.TARGETARG != "make":
Bram Moolenaar1e015462005-09-25 22:16:38 +000067 @if "reconfig" in var2list(_no.TARGETARG):
68 :del {force} auto/config.cache auto/config.status
69 :update {force} auto/config.aap
70 @else:
71 :update auto/config.aap
Bram Moolenaar071d4272004-06-13 20:20:40 +000072
73# Include the recipe that autoconf generated.
74:include auto/config.aap
75
76# A "PREFIX=dir" argument overrules the value of $prefix
77@if _no.get("PREFIX"):
78 prefix = $PREFIX
79
80# Don't want "~/" in prefix.
81prefix = `os.path.expanduser(prefix)`
82
83#
84# G U I variant
85#
86# The GUI is selected by configure, a lot of other things depend on it.
87#
88:variant GUI
89 GTK
Bram Moolenaar1e015462005-09-25 22:16:38 +000090 GUI_SRC = gui.c gui_gtk.c gui_gtk_x11.c pty.c gui_beval.c
91 gui_gtk_f.c
92 GUI_OBJ =
93 GUI_DEFS = -DFEAT_GUI_GTK $NARROW_PROTO
94 GUI_IPATH = $GUI_INC_LOC
95 GUI_LIBS_DIR = $GUI_LIB_LOC
96 GUI_LIBS1 =
97 GUI_LIBS2 = $GTK_LIBNAME
98 GUI_TARGETS = installglinks
99 GUI_MAN_TARGETS = installghelplinks
100 GUI_TESTTARGET = gui
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000101 KDE
Bram Moolenaar1e015462005-09-25 22:16:38 +0000102 GUI_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc
Bram Moolenaar5eb86f92004-07-26 12:53:41 +0000103 gui_kde_wid_moc.cc
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000104 kvim_iface_skel.cc
Bram Moolenaar1e015462005-09-25 22:16:38 +0000105 GUI_OBJ = $BDIR/gui_kde_wid.o
106 GUI_DEFS = -DFEAT_GUI_KDE $NARROW_PROTO
107 GUI_IPATH = $GUI_INC_LOC
108 GUI_LIBS_DIR = $GUI_LIB_LOC
109 GUI_LIBS1 =
110 GUI_LIBS2 =
111 GUI_TARGETS = installglinks installkdeicons
112 GUI_MAN_TARGETS = installghelplinks
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000113 GUI_TESTTARGET = gui
114
Bram Moolenaar071d4272004-06-13 20:20:40 +0000115 MOTIF
Bram Moolenaar1e015462005-09-25 22:16:38 +0000116 GUI_SRC = gui.c gui_motif.c gui_x11.c pty.c gui_beval.c
117 gui_xmdlg.c gui_xmebw.c
118 GUI_OBJ =
119 GUI_DEFS = -DFEAT_GUI_MOTIF $NARROW_PROTO
120 GUI_IPATH = $GUI_INC_LOC
121 GUI_LIBS_DIR = $GUI_LIB_LOC
122 GUI_LIBS1 =
123 GUI_LIBS2 = $MOTIF_LIBNAME -lXt
124 GUI_TARGETS = installglinks
125 GUI_MAN_TARGETS = installghelplinks
126 GUI_TESTTARGET = gui
Bram Moolenaar071d4272004-06-13 20:20:40 +0000127 ATHENA
Bram Moolenaar1e015462005-09-25 22:16:38 +0000128 # XAW_LIB et al. can be overruled to use Xaw3d widgets
129 XAW_LIB ?= -lXaw
130 GUI_SRC = gui.c gui_athena.c gui_x11.c pty.c gui_beval.c \
131 gui_at_sb.c gui_at_fs.c
132 GUI_OBJ =
133 GUI_DEFS = -DFEAT_GUI_ATHENA $NARROW_PROTO
134 GUI_IPATH = $GUI_INC_LOC
135 GUI_LIBS_DIR = $GUI_LIB_LOC
136 GUI_LIBS1 = $XAW_LIB
137 GUI_LIBS2 = -lXt
138 GUI_TARGETS = installglinks
139 GUI_MAN_TARGETS = installghelplinks
140 GUI_TESTTARGET = gui
Bram Moolenaar071d4272004-06-13 20:20:40 +0000141 NEXTAW
Bram Moolenaar1e015462005-09-25 22:16:38 +0000142 # XAW_LIB et al. can be overruled to use Xaw3d widgets
143 XAW_LIB ?= -lXaw
144 GUI_SRC = gui.c gui_athena.c gui_x11.c pty.c gui_beval.c
145 gui_at_fs.c
146 GUI_OBJ =
147 GUI_DEFS = -DFEAT_GUI_ATHENA -DFEAT_GUI_NEXTAW $NARROW_PROTO
148 GUI_IPATH = $GUI_INC_LOC
149 GUI_LIBS_DIR = $GUI_LIB_LOC
150 GUI_LIBS1 = $NEXTAW_LIB
151 GUI_LIBS2 = -lXt
152 GUI_TARGETS = installglinks
153 GUI_MAN_TARGETS = installghelplinks
154 GUI_TESTTARGET = gui
Bram Moolenaar071d4272004-06-13 20:20:40 +0000155 PHOTONGUI
Bram Moolenaar1e015462005-09-25 22:16:38 +0000156 GUI_SRC = gui.c gui_photon.c pty.c
157 GUI_OBJ =
158 GUI_DEFS = -DFEAT_GUI_PHOTON
159 GUI_IPATH =
160 GUI_LIBS_DIR =
161 GUI_LIBS1 = -lph -lphexlib
162 GUI_LIBS2 =
163 GUI_TARGETS = installglinks
164 GUI_MAN_TARGETS = installghelplinks
165 GUI_TESTTARGET = gui
Bram Moolenaar071d4272004-06-13 20:20:40 +0000166 *
Bram Moolenaar1e015462005-09-25 22:16:38 +0000167 GUI_SRC =
168 GUI_OBJ =
169 GUI_DEFS =
170 GUI_IPATH =
171 GUI_LIBS_DIR =
172 GUI_LIBS1 =
173 GUI_LIBS2 =
174 GUI_TARGETS =
175 GUI_MAN_TARGETS =
176 GUI_TESTTARGET =
Bram Moolenaar071d4272004-06-13 20:20:40 +0000177
178
179PRE_DEFS = -Iproto -I. $DEFS $GUI_DEFS $GUI_IPATH $CPPFLAGS $?(EXTRA_IPATHS)
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000180POST_DEFS = $X_CFLAGS $MZSCHEME_CFLAGS $PERL_CFLAGS $PYTHON_CFLAGS $TCL_CFLAGS $RUBY_CFLAGS $?(EXTRA_DEFS)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000181CFLAGS = $PRE_DEFS $CONF_CFLAGS $?(PROFILE_CFLAGS) $POST_DEFS
182CPPFLAGS =
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000183# Need C++ flags for KDE
184CXXFLAGS = $CFLAGS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000185
186ALL_LIB_DIRS = $GUI_LIBS_DIR $X_LIBS_DIR
187LDFLAGS = $ALL_LIB_DIRS $CONF_LDFLAGS
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000188LIBS = $GUI_LIBS1 $GUI_X_LIBS $GUI_LIBS2 $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $CONF_LIBS $?(EXTRA_LIBS) $MZSCHEME_LIBS $PERL_LIBS $PYTHON_LIBS $TCL_LIBS $RUBY_LIBS $?(PROFILE_LIBS)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000189
190Target = $VIMNAME
191
192# reconfig target also builds Vim (reconfiguration is handled above).
193reconfig {virtual}: $Target
194
195
196# Execute the test scripts. Run these after compiling Vim, before installing.
197#
198# This will produce a lot of garbage on your screen, including a few error
199# messages. Don't worry about that.
200# If there is a real error, there will be a difference between "test.out" and
201# a "test99.ok" file.
202# If everything is allright, the final message will be "ALL DONE".
203#
204test check:
205 VimProg = ../$Target
206 :execute testdir/main.aap $GUI_TESTTARGET
207
208testclean {virtual}:
209 :del {force} testdir/*.out testdir/test.log
210
Bram Moolenaar5eb86f92004-07-26 12:53:41 +0000211CLEANFILES += gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl
Bram Moolenaar071d4272004-06-13 20:20:40 +0000212
213# When no fetch target exists we are not a child of the ../main.aap recipe,
214# Use ../main.aap to do the fetching.
215# --- If you get an error here for wrong number of arguments, you need to
216# update to a newer version of A-A-P.
217@if not has_target("fetch"):
218 fetch:
Bram Moolenaar1e015462005-09-25 22:16:38 +0000219 :execute ../main.aap fetch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220
221
222# All the source files that need to be compiled.
223# Some are optional and depend on configure.
224# "version.c" is missing, it's always compiled (see below).
225Source =
Bram Moolenaar1e015462005-09-25 22:16:38 +0000226 buffer.c
227 charset.c
228 diff.c
229 digraph.c
230 edit.c
231 eval.c
232 ex_cmds.c
233 ex_cmds2.c
234 ex_docmd.c
235 ex_eval.c
236 ex_getln.c
237 fileio.c
238 fold.c
239 getchar.c
Bram Moolenaar87e25fd2005-07-27 21:13:01 +0000240 hardcopy.c
Bram Moolenaar1e015462005-09-25 22:16:38 +0000241 hashtable.c
242 if_cscope.c
243 if_xcmdsrv.c
244 main.c
245 mark.c
246 memfile.c
247 memline.c
248 menu.c
249 message.c
250 misc1.c
251 misc2.c
252 move.c
253 mbyte.c
254 normal.c
255 ops.c
256 option.c
257 os_unix.c
258 auto/pathdef.c
Bram Moolenaarbb15b652005-10-03 21:52:09 +0000259 popupmenu.c
Bram Moolenaar1e015462005-09-25 22:16:38 +0000260 quickfix.c
261 regexp.c
262 screen.c
263 search.c
264 spell.c
265 syntax.c
266 tag.c
267 term.c
268 ui.c
269 undo.c
270 window.c
271 $OS_EXTRA_SRC
272 $GUI_SRC
273 $HANGULIN_SRC
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000274 $MZSCHEME_SRC
Bram Moolenaar1e015462005-09-25 22:16:38 +0000275 $PERL_SRC
276 $NETBEANS_SRC
277 $PYTHON_SRC
278 $TCL_SRC
279 $RUBY_SRC
280 $SNIFF_SRC
281 $WORKSHOP_SRC
Bram Moolenaar071d4272004-06-13 20:20:40 +0000282
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000283Objects =
Bram Moolenaar1e015462005-09-25 22:16:38 +0000284 $GUI_OBJ
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000285
Bram Moolenaar071d4272004-06-13 20:20:40 +0000286# TODO: make is still used for subdirectories, need to write a recipe.
287MAKE ?= make
288
289all: $Target
290
291# This dependency is required to build auto/osdef.h before automatic
292# dependencies are generated.
293$Source version.c : auto/osdef.h
294
295# Need to mention that the target also depends on version.c, since it's not
296# inluded in $Source
297$Target : version.c
298
299# Some sources are to be found in the "auto" directory.
300SRCPATH += auto
301
302# When building Vim always compile version.c to get the timestamp.
303:filetype
304 declare my_prog
305:attr {filetype = my_prog} $Target
306
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000307:program $Target : $Source $Objects
Bram Moolenaar071d4272004-06-13 20:20:40 +0000308
309:action build my_prog object
Bram Moolenaar1e015462005-09-25 22:16:38 +0000310 version_obj = `src2obj("version.c")`
311 :do compile {target = $version_obj} version.c
312 #:do build {target = $target {filetype = program}} $source $version_obj
313 link_sed = $BDIR/link.sed
314 @if os.path.exists(link_sed):
315 :move {force} $link_sed auto/link.sed
316 @else:
317 :del {force} auto/link.sed
318 :update link2.sh
319 :sys LINK="$?(PURIFY) $?(SHRPENV) $CC $LDFLAGS \
320 -o $target $source $version_obj $LIBS" \
321 MAKE="aap" sh ./link2.sh
322 :copy {force} auto/link.sed $BDIR/link.sed
Bram Moolenaar071d4272004-06-13 20:20:40 +0000323
324# "link.sh" must be modified for A-A-P
325link2.sh : link.sh
326 :print Adjusting $-source for A-A-P.
327 :cat $source | :eval re.sub("objects/pathdef.o", "pathdef", stdin)
Bram Moolenaar1e015462005-09-25 22:16:38 +0000328 >! $target
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329
330xxd/xxd$EXESUF: xxd/xxd.c
331 :sys cd xxd; CC="$CC" CFLAGS="$CPPFLAGS $CFLAGS" \
Bram Moolenaar1e015462005-09-25 22:16:38 +0000332 $MAKE -f Makefile
Bram Moolenaar071d4272004-06-13 20:20:40 +0000333
334# Build the language specific files if they were unpacked.
335# Generate the converted .mo files separately, it's no problem if this fails.
336languages {virtual}:
Bram Moolenaar1e015462005-09-25 22:16:38 +0000337 @if _no.MAKEMO:
338 :sys cd $PODIR; CC="$CC" $MAKE prefix=$DESTDIR$prefix
339 @try:
340 :sys cd $PODIR; CC="$CC" $MAKE prefix=$DESTDIR$prefix converted
341 @except:
342 :print Generated converted language files failed, continuing
Bram Moolenaar071d4272004-06-13 20:20:40 +0000343
344# Update the *.po files for changes in the sources. Only run manually.
345update-po {virtual}:
Bram Moolenaar1e015462005-09-25 22:16:38 +0000346 cd $PODIR; CC="$CC" $MAKE prefix=$DESTDIR$prefix update-po
Bram Moolenaar071d4272004-06-13 20:20:40 +0000347
348auto/if_perl.c: if_perl.xs
Bram Moolenaar1e015462005-09-25 22:16:38 +0000349 :sys $PERL -e 'unless ( $$] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$$_ $$_\n" }}' > $target
350 :sys $PERL $PERLLIB/ExtUtils/xsubpp -prototypes -typemap \
351 $PERLLIB/ExtUtils/typemap if_perl.xs >> $target
Bram Moolenaar071d4272004-06-13 20:20:40 +0000352
Bram Moolenaar5eb86f92004-07-26 12:53:41 +0000353$BDIR/gui_kde_wid.o: gui_kde_wid.cc
354 :sys $MOC -o gui_kde_wid_moc.cc gui_kde_wid.h
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000355 @try:
356 :sys $KDE_PREFIX/bin/dcopidl kvim_iface.h > kvim_iface.kidl
357 @except:
358 :del {f} kvim_iface.kidl
359 :sys $KDE_PREFIX/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl
Bram Moolenaar5eb86f92004-07-26 12:53:41 +0000360 :do compile gui_kde_wid.cc
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000361
Bram Moolenaar5eb86f92004-07-26 12:53:41 +0000362gui_kde_wid_moc.cc: $BDIR/gui_kde_wid.o
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000363
Bram Moolenaar5eb86f92004-07-26 12:53:41 +0000364kvim_iface_skel.cc: $BDIR/gui_kde_wid.o
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000365
366
Bram Moolenaar071d4272004-06-13 20:20:40 +0000367auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in
Bram Moolenaar1e015462005-09-25 22:16:38 +0000368 :sys CC="$CC $CFLAGS" srcdir=$srcdir sh $srcdir/osdef.sh
Bram Moolenaar071d4272004-06-13 20:20:40 +0000369
370pathdef {virtual} : $BDIR/auto/pathdef$OBJSUF
371
372auto/pathdef.c: auto/config.aap
Bram Moolenaar1e015462005-09-25 22:16:38 +0000373 :print Creating $target
374 :print >! $target /* pathdef.c */
375 :print >> $target /* This file is automatically created by main.aap */
376 :print >> $target /* DO NOT EDIT! Change main.aap only. */
377 :print >> $target $#include "vim.h"
378 :print >> $target char_u *default_vim_dir = (char_u *)"$VIMRCLOC";
379 :print >> $target char_u *default_vimruntime_dir = (char_u *)"$?VIMRUNTIMEDIR";
380 v = $CC -c -I$srcdir $CFLAGS
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000381 @v = string.replace(v, '"', '\\"')
Bram Moolenaar1e015462005-09-25 22:16:38 +0000382 :print >> $target char_u *all_cflags = (char_u *)"$v";
383 linkcmd = $CC $LDFLAGS -o $VIMTARGET $LIBS
384 link_sed = $BDIR/link.sed
385 @if os.path.exists(link_sed):
386 # filter $linkcmd through $BDIR/link.sed
387 :print $linkcmd | :syseval sed -f $link_sed | :eval re.sub("\n", "", stdin) | :assign linkcmd
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000388 @linkcmd = string.replace(linkcmd, '"', '\\"')
Bram Moolenaar1e015462005-09-25 22:16:38 +0000389 :print >> $target char_u *all_lflags = (char_u *)"$linkcmd";
390 @if _no.get("COMPILEDBY"):
391 who = $COMPILEDBY
392 where = ''
393 @else:
394 :syseval whoami | :eval re.sub("\n", "", stdin) | :assign who
Bram Moolenaar071d4272004-06-13 20:20:40 +0000395
Bram Moolenaar1e015462005-09-25 22:16:38 +0000396 :syseval hostname | :eval re.sub("\n", "", stdin) | :assign where
397 :print >> $target char_u *compiled_user = (char_u *)"$who";
398 :print >> $target char_u *compiled_sys = (char_u *)"$where";
Bram Moolenaar071d4272004-06-13 20:20:40 +0000399
400
401### Names of the programs and targets
Bram Moolenaar1e015462005-09-25 22:16:38 +0000402VIMTARGET = $VIMNAME$EXESUF
403EXTARGET = $EXNAME$LNKSUF
404VIEWTARGET = $VIEWNAME$LNKSUF
405GVIMNAME = g$VIMNAME
406GVIMTARGET = $GVIMNAME$LNKSUF
407GVIEWNAME = g$VIEWNAME
408GVIEWTARGET = $GVIEWNAME$LNKSUF
409RVIMNAME = r$VIMNAME
410RVIMTARGET = $RVIMNAME$LNKSUF
411RVIEWNAME = r$VIEWNAME
412RVIEWTARGET = $RVIEWNAME$LNKSUF
413RGVIMNAME = r$GVIMNAME
414RGVIMTARGET = $RGVIMNAME$LNKSUF
415RGVIEWNAME = r$GVIEWNAME
416RGVIEWTARGET = $RGVIEWNAME$LNKSUF
417VIMDIFFNAME = $(VIMNAME)diff
418GVIMDIFFNAME = g$VIMDIFFNAME
419VIMDIFFTARGET = $VIMDIFFNAME$LNKSUF
420GVIMDIFFTARGET = $GVIMDIFFNAME$LNKSUF
421EVIMNAME = e$VIMNAME
422EVIMTARGET = $EVIMNAME$LNKSUF
423EVIEWNAME = e$VIEWNAME
424EVIEWTARGET = $EVIEWNAME$LNKSUF
Bram Moolenaar071d4272004-06-13 20:20:40 +0000425
426### Names of the tools that are also made
427TOOLS = xxd/xxd$EXESUF
428
429# Root of the installation tree. Empty for a normal install, set to an
430# existing path to install into a special place (for generating a package).
431DESTDIR ?=
432
433### Location of man pages
434MANSUBDIR = $MANDIR/man1
435
436### Location of Vim files (should not need to be changed, and
437### some things might not work when they are changed!)
438VIMDIR = /vim
439@r = re.compile('.*VIM_VERSION_NODOT\\s*"(vim\\d\\d[^"]*)".*', re.S)
440VIMRTDIR = /`r.match(open("version.h").read()).group(1)`
441HELPSUBDIR = /doc
442COLSUBDIR = /colors
443SYNSUBDIR = /syntax
444INDSUBDIR = /indent
Bram Moolenaar87e25fd2005-07-27 21:13:01 +0000445AUTOSUBDIR = /autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +0000446PLUGSUBDIR = /plugin
447FTPLUGSUBDIR = /ftplugin
448LANGSUBDIR = /lang
449COMPSUBDIR = /compiler
450KMAPSUBDIR = /keymap
451MACROSUBDIR = /macros
452TOOLSSUBDIR = /tools
453TUTORSUBDIR = /tutor
454PRINTSUBDIR = /print
455PODIR = po
456
Bram Moolenaar1e015462005-09-25 22:16:38 +0000457### VIMLOC common root of the Vim files (all versions)
458### VIMRTLOC common root of the runtime Vim files (this version)
459### VIMRCLOC compiled-in location for global [g]vimrc files (all versions)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000460### VIMRUNTIMEDIR compiled-in location for runtime files (optional)
Bram Moolenaar1e015462005-09-25 22:16:38 +0000461### HELPSUBLOC location for help files
462### COLSUBLOC location for colorscheme files
463### SYNSUBLOC location for syntax files
464### INDSUBLOC location for indent files
465### AUTOSUBLOC location for standard autoload files
466### PLUGSUBLOC location for standard plugin files
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467### FTPLUGSUBLOC location for ftplugin files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000468### LANGSUBLOC location for language files
469### COMPSUBLOC location for compiler files
470### KMAPSUBLOC location for keymap files
471### MACROSUBLOC location for macro files
472### TOOLSSUBLOC location for tools files
473### TUTORSUBLOC location for tutor files
474### PRINTSUBLOC location for print files
475### SCRIPTLOC location for script files (menu.vim, bugreport.vim, ..)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000476### You can override these if you want to install them somewhere else.
477### Edit feature.h for compile-time settings.
Bram Moolenaar1e015462005-09-25 22:16:38 +0000478VIMLOC = $DATADIR$VIMDIR
479VIMRTLOC = $DATADIR$VIMDIR$VIMRTDIR
480VIMRCLOC = $VIMLOC
481HELPSUBLOC = $VIMRTLOC$HELPSUBDIR
482COLSUBLOC = $VIMRTLOC$COLSUBDIR
483SYNSUBLOC = $VIMRTLOC$SYNSUBDIR
484INDSUBLOC = $VIMRTLOC$INDSUBDIR
485AUTOSUBLOC = $VIMRTLOC$AUTOSUBDIR
486PLUGSUBLOC = $VIMRTLOC$PLUGSUBDIR
487FTPLUGSUBLOC = $VIMRTLOC$FTPLUGSUBDIR
488LANGSUBLOC = $VIMRTLOC$LANGSUBDIR
489COMPSUBLOC = $VIMRTLOC$COMPSUBDIR
490KMAPSUBLOC = $VIMRTLOC$KMAPSUBDIR
491MACROSUBLOC = $VIMRTLOC$MACROSUBDIR
492TOOLSSUBLOC = $VIMRTLOC$TOOLSSUBDIR
493TUTORSUBLOC = $VIMRTLOC$TUTORSUBDIR
494PRINTSUBLOC = $VIMRTLOC$PRINTSUBDIR
495SCRIPTLOC = $VIMRTLOC
Bram Moolenaar071d4272004-06-13 20:20:40 +0000496
497### Only set VIMRUNTIMEDIR when VIMRTLOC is set to a different location and
498### the runtime directory is not below it.
499#VIMRUNTIMEDIR = $VIMRTLOC
500
501### Name of the evim file target.
Bram Moolenaar1e015462005-09-25 22:16:38 +0000502EVIM_FILE = $DESTDIR$SCRIPTLOC/evim.vim
503MSWIN_FILE = $DESTDIR$SCRIPTLOC/mswin.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000504
505### Name of the menu file target.
Bram Moolenaar1e015462005-09-25 22:16:38 +0000506SYS_MENU_FILE = $DESTDIR$SCRIPTLOC/menu.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000507SYS_SYNMENU_FILE = $DESTDIR$SCRIPTLOC/synmenu.vim
508SYS_DELMENU_FILE = $DESTDIR$SCRIPTLOC/delmenu.vim
509
510### Name of the bugreport file target.
Bram Moolenaar1e015462005-09-25 22:16:38 +0000511SYS_BUGR_FILE = $DESTDIR$SCRIPTLOC/bugreport.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000512
513### Name of the file type detection file target.
514SYS_FILETYPE_FILE = $DESTDIR$SCRIPTLOC/filetype.vim
515
516### Name of the file type detection file target.
Bram Moolenaar1e015462005-09-25 22:16:38 +0000517SYS_FTOFF_FILE = $DESTDIR$SCRIPTLOC/ftoff.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000518
519### Name of the file type detection script file target.
520SYS_SCRIPTS_FILE = $DESTDIR$SCRIPTLOC/scripts.vim
521
522### Name of the ftplugin-on file target.
523SYS_FTPLUGIN_FILE = $DESTDIR$SCRIPTLOC/ftplugin.vim
524
525### Name of the ftplugin-off file target.
526SYS_FTPLUGOF_FILE = $DESTDIR$SCRIPTLOC/ftplugof.vim
527
528### Name of the indent-on file target.
529SYS_INDENT_FILE = $DESTDIR$SCRIPTLOC/indent.vim
530
531### Name of the indent-off file target.
532SYS_INDOFF_FILE = $DESTDIR$SCRIPTLOC/indoff.vim
533
534### Name of the option window script file target.
535SYS_OPTWIN_FILE = $DESTDIR$SCRIPTLOC/optwin.vim
536
537### Permissions for binaries
538BINMOD = 755
539
540### Permissions for man page
541MANMOD = 644
542
543### Permissions for help files
544HELPMOD = 644
545
546### Permissions for Perl and shell scripts
547SCRIPTMOD = 755
548
549### Permission for Vim script files (menu.vim, bugreport.vim, ..)
550VIMSCRIPTMOD = 644
551
552### Permissions for all directories that are created
553DIRMOD = 755
554
555### Permissions for all other files that are created
556FILEMOD = 644
557
558# Where to copy the man and help files from
559HELPSOURCE = ../runtime/doc
560
561# Where to copy the script files from (menu, bugreport)
562SCRIPTSOURCE = ../runtime
563
564# Where to copy the colorscheme files from
565COLSOURCE = ../runtime/colors
566
567# Where to copy the syntax files from
568SYNSOURCE = ../runtime/syntax
569
570# Where to copy the indent files from
571INDSOURCE = ../runtime/indent
572
573# Where to copy the standard plugin files from
Bram Moolenaar87e25fd2005-07-27 21:13:01 +0000574AUTOSOURCE = ../runtime/autoload
575
576# Where to copy the standard plugin files from
Bram Moolenaar071d4272004-06-13 20:20:40 +0000577PLUGSOURCE = ../runtime/plugin
578
579# Where to copy the ftplugin files from
580FTPLUGSOURCE = ../runtime/ftplugin
581
582# Where to copy the macro files from
583MACROSOURCE = ../runtime/macros
584
585# Where to copy the tools files from
586TOOLSSOURCE = ../runtime/tools
587
588# Where to copy the tutor files from
589TUTORSOURCE = ../runtime/tutor
590
591# Where to look for language specific files
592LANGSOURCE = ../runtime/lang
593
594# Where to look for compiler files
595COMPSOURCE = ../runtime/compiler
596
597# Where to look for keymap files
598KMAPSOURCE = ../runtime/keymap
599
600# Where to look for print resource files
601PRINTSOURCE = ../runtime/print
602
603# abbreviations
604DEST_BIN = $DESTDIR$BINDIR
605DEST_VIM = $DESTDIR$VIMLOC
606DEST_RT = $DESTDIR$VIMRTLOC
607DEST_HELP = $DESTDIR$HELPSUBLOC
608DEST_COL = $DESTDIR$COLSUBLOC
609DEST_SYN = $DESTDIR$SYNSUBLOC
610DEST_IND = $DESTDIR$INDSUBLOC
Bram Moolenaar87e25fd2005-07-27 21:13:01 +0000611DEST_AUTO = $DESTDIR$AUTOSUBLOC
Bram Moolenaar071d4272004-06-13 20:20:40 +0000612DEST_PLUG = $DESTDIR$PLUGSUBLOC
613DEST_FTP = $DESTDIR$FTPLUGSUBLOC
614DEST_LANG = $DESTDIR$LANGSUBLOC
615DEST_COMP = $DESTDIR$COMPSUBLOC
616DEST_KMAP = $DESTDIR$KMAPSUBLOC
617DEST_MACRO = $DESTDIR$MACROSUBLOC
618DEST_TOOLS = $DESTDIR$TOOLSSUBLOC
619DEST_TUTOR = $DESTDIR$TUTORSUBLOC
620DEST_SCRIPT = $DESTDIR$SCRIPTLOC
621DEST_PRINT = $DESTDIR$PRINTSUBLOC
622DEST_MAN = $DESTDIR$MANSUBDIR
623
624# These are directories, create them when needed.
625:attr {directory = $DIRMOD} $DEST_BIN $DEST_VIM $DEST_RT $DEST_HELP $DEST_COL
Bram Moolenaar1e015462005-09-25 22:16:38 +0000626 $DEST_SYN $DEST_IND $DEST_AUTO $DEST_PLUG $DEST_FTP $DEST_LANG
627 $DEST_COMP $DEST_KMAP $DEST_MACRO $DEST_TOOLS $DEST_TUTOR
628 $DEST_SCRIPT $DEST_PRINT $DEST_MAN
Bram Moolenaar071d4272004-06-13 20:20:40 +0000629
630#
631# I N S T A L L
632#
633install:
634 @if not os.path.isdir(_no.DEST_BIN):
635 @try:
636 :mkdir $DEST_BIN
637 @except:
638 @ pass
639 @if os.access(_no.DEST_BIN, os.W_OK):
640 # Bin directory is writable, install directly.
641 :update installvim installtools install-languages install-icons
642 @else:
643 # Bin directory is not writable, need to become root.
Bram Moolenaar1e015462005-09-25 22:16:38 +0000644 :print The destination directory "$DEST_BIN" is not writable.
645 :print If this is the wrong directory, use PREFIX to specify another one.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000646 :print Otherwise, type the root password to continue installing.
647 :asroot $AAP install
648
649installvim {virtual}: installvimbin installruntime installlinks \
Bram Moolenaar1e015462005-09-25 22:16:38 +0000650 installhelplinks installmacros installtutor
Bram Moolenaar071d4272004-06-13 20:20:40 +0000651
652installvimbin {virtual}{force}: $Target $DEST_BIN
Bram Moolenaar1e015462005-09-25 22:16:38 +0000653 exe = $DEST_BIN/$VIMTARGET
654 @if os.path.exists(exe):
655 # Move the old executable aside and delete it. Any other method
656 # may cause a crash if the executable is currently being used.
657 :move {force} $exe $(exe).rm
658 :del {force} $(exe).rm
659 :copy $VIMTARGET $DEST_BIN
660 :do strip $exe
661 :chmod $BINMOD $DEST_BIN/$VIMTARGET
Bram Moolenaar071d4272004-06-13 20:20:40 +0000662# may create a link to the new executable from /usr/bin/vi
Bram Moolenaar1e015462005-09-25 22:16:38 +0000663 @if _no.get("LINKIT"):
664 :sys $LINKIT
Bram Moolenaar071d4272004-06-13 20:20:40 +0000665
666# install the help files; first adjust the contents for the location
667installruntime {virtual}{force}: $HELPSOURCE/vim.1 $DEST_MAN $DEST_VIM
Bram Moolenaar1e015462005-09-25 22:16:38 +0000668 $DEST_RT $DEST_HELP $DEST_COL $DEST_SYN $DEST_IND
669 $DEST_FTP $DEST_AUTO $DEST_PLUG $DEST_TUTOR $DEST_COMP
Bram Moolenaar87e25fd2005-07-27 21:13:01 +0000670 $DEST_PRINT
Bram Moolenaar1e015462005-09-25 22:16:38 +0000671 :print generating $DEST_MAN/$(VIMNAME).1
672 :cat $HELPSOURCE/vim.1 |
673 :eval re.sub("/usr/local/lib/vim", _no.VIMLOC, stdin) |
674 :eval re.sub(_no.VIMLOC + "/doc", _no.HELPSUBLOC, stdin) |
675 :eval re.sub(_no.VIMLOC + "/syntax", _no.SYNSUBLOC, stdin) |
676 :eval re.sub(_no.VIMLOC + "/tutor", _no.TUTORSUBLOC, stdin) |
677 :eval re.sub(_no.VIMLOC + "/vimrc",
678 _no.VIMRCLOC + "/vimrc", stdin) |
679 :eval re.sub(_no.VIMLOC + "/gvimrc",
680 _no.VIMRCLOC + "/gvimrc", stdin) |
681 :eval re.sub(_no.VIMLOC + "/menu.vim",
682 _no.SCRIPTLOC + "/menu.vim", stdin) |
683 :eval re.sub(_no.VIMLOC + "/bugreport.vim",
684 _no.SCRIPTLOC + "/bugreport.vim", stdin) |
685 :eval re.sub(_no.VIMLOC + "/filetype.vim",
686 _no.SCRIPTLOC + "/filetype.vim", stdin) |
687 :eval re.sub(_no.VIMLOC + "/ftoff.vim",
688 _no.SCRIPTLOC + "/ftoff.vim", stdin) |
689 :eval re.sub(_no.VIMLOC + "/scripts.vim",
690 _no.SCRIPTLOC + "/scripts.vim", stdin) |
691 :eval re.sub(_no.VIMLOC + "/optwin.vim",
692 _no.SCRIPTLOC + "/optwin.vim", stdin) |
693 :eval re.sub(_no.VIMLOC + "/\\*.ps",
694 _no.SCRIPTLOC + "/*.ps", stdin)
695 >! $DEST_MAN/$(VIMNAME).1
696 :chmod $MANMOD $DEST_MAN/$(VIMNAME).1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000697
Bram Moolenaar1e015462005-09-25 22:16:38 +0000698 :print generating $DEST_MAN/$(VIMNAME)tutor.1
699 :cat $HELPSOURCE/vimtutor.1 |
700 :eval re.sub("/usr/local/lib/vim", _no.VIMLOC, stdin) |
701 :eval re.sub(_no.VIMLOC + "/tutor", _no.TUTORSUBLOC, stdin)
702 >! $DEST_MAN/$(VIMNAME)tutor.1
703 :chmod $MANMOD $DEST_MAN/$(VIMNAME)tutor.1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000704
Bram Moolenaar1e015462005-09-25 22:16:38 +0000705 :copy $HELPSOURCE/vimdiff.1 $DEST_MAN/$(VIMDIFFNAME).1
706 :chmod $MANMOD $DEST_MAN/$(VIMDIFFNAME).1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000707
Bram Moolenaar1e015462005-09-25 22:16:38 +0000708 :print generating $DEST_MAN/$(EVIMNAME).1
709 :cat $HELPSOURCE/evim.1 |
710 :eval re.sub("/usr/local/lib/vim", _no.SCRIPTLOC, stdin)
711 >! $DEST_MAN/$(EVIMNAME).1
712 :chmod $MANMOD $DEST_MAN/$(EVIMNAME).1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000713
714 :cd $HELPSOURCE
715 @try:
716 XTRA = `glob.glob("*.??x")` `glob.glob("tags-??")`
717 @except:
718 XTRA = # It's OK if there are no matches.
Bram Moolenaar1e015462005-09-25 22:16:38 +0000719 :copy *.txt tags $XTRA $DEST_HELP
Bram Moolenaar071d4272004-06-13 20:20:40 +0000720 :cd -
721 :cd $DEST_HELP
Bram Moolenaar1e015462005-09-25 22:16:38 +0000722 :chmod $HELPMOD *.txt tags $XTRA
Bram Moolenaar071d4272004-06-13 20:20:40 +0000723 :cd -
Bram Moolenaar1e015462005-09-25 22:16:38 +0000724 :copy $HELPSOURCE/*.pl $DEST_HELP
725 :chmod $SCRIPTMOD $DEST_HELP/*.pl
Bram Moolenaar071d4272004-06-13 20:20:40 +0000726# install the menu files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000727 :copy $SCRIPTSOURCE/menu.vim $SYS_MENU_FILE
728 :chmod $VIMSCRIPTMOD $SYS_MENU_FILE
729 :copy $SCRIPTSOURCE/synmenu.vim $SYS_SYNMENU_FILE
730 :chmod $VIMSCRIPTMOD $SYS_SYNMENU_FILE
731 :copy $SCRIPTSOURCE/delmenu.vim $SYS_DELMENU_FILE
732 :chmod $VIMSCRIPTMOD $SYS_DELMENU_FILE
Bram Moolenaar071d4272004-06-13 20:20:40 +0000733# install the evim file
Bram Moolenaar1e015462005-09-25 22:16:38 +0000734 :copy $SCRIPTSOURCE/mswin.vim $MSWIN_FILE
735 :chmod $VIMSCRIPTMOD $MSWIN_FILE
736 :copy $SCRIPTSOURCE/evim.vim $EVIM_FILE
737 :chmod $VIMSCRIPTMOD $EVIM_FILE
Bram Moolenaar071d4272004-06-13 20:20:40 +0000738# install the bugreport file
Bram Moolenaar1e015462005-09-25 22:16:38 +0000739 :copy $SCRIPTSOURCE/bugreport.vim $SYS_BUGR_FILE
740 :chmod $VIMSCRIPTMOD $SYS_BUGR_FILE
Bram Moolenaar071d4272004-06-13 20:20:40 +0000741# install the example vimrc files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000742 :copy $SCRIPTSOURCE/vimrc_example.vim $DEST_SCRIPT
743 :chmod $VIMSCRIPTMOD $DEST_SCRIPT/vimrc_example.vim
744 :copy $SCRIPTSOURCE/gvimrc_example.vim $DEST_SCRIPT
745 :chmod $VIMSCRIPTMOD $DEST_SCRIPT/gvimrc_example.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000746# install the file type detection files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000747 :copy $SCRIPTSOURCE/filetype.vim $SYS_FILETYPE_FILE
748 :chmod $VIMSCRIPTMOD $SYS_FILETYPE_FILE
749 :copy $SCRIPTSOURCE/ftoff.vim $SYS_FTOFF_FILE
750 :chmod $VIMSCRIPTMOD $SYS_FTOFF_FILE
751 :copy $SCRIPTSOURCE/scripts.vim $SYS_SCRIPTS_FILE
752 :chmod $VIMSCRIPTMOD $SYS_SCRIPTS_FILE
753 :copy $SCRIPTSOURCE/ftplugin.vim $SYS_FTPLUGIN_FILE
754 :chmod $VIMSCRIPTMOD $SYS_FTPLUGIN_FILE
755 :copy $SCRIPTSOURCE/ftplugof.vim $SYS_FTPLUGOF_FILE
756 :chmod $VIMSCRIPTMOD $SYS_FTPLUGOF_FILE
757 :copy $SCRIPTSOURCE/indent.vim $SYS_INDENT_FILE
758 :chmod $VIMSCRIPTMOD $SYS_INDENT_FILE
759 :copy $SCRIPTSOURCE/indoff.vim $SYS_INDOFF_FILE
760 :chmod $VIMSCRIPTMOD $SYS_INDOFF_FILE
761 :copy $SCRIPTSOURCE/optwin.vim $SYS_OPTWIN_FILE
762 :chmod $VIMSCRIPTMOD $SYS_OPTWIN_FILE
Bram Moolenaar071d4272004-06-13 20:20:40 +0000763# install the print resource files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000764 :copy $PRINTSOURCE/*.ps $DEST_PRINT
765 :chmod $FILEMOD $DEST_PRINT/*.ps
Bram Moolenaar071d4272004-06-13 20:20:40 +0000766# install the colorscheme files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000767 :copy $COLSOURCE/*.vim $COLSOURCE/README.txt $DEST_COL
768 :chmod $HELPMOD $DEST_COL/*.vim $DEST_COL/README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000769# install the syntax files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000770 :copy $SYNSOURCE/*.vim $SYNSOURCE/README.txt $DEST_SYN
771 :chmod $HELPMOD $DEST_SYN/*.vim $DEST_SYN/README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000772# install the indent files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000773 :copy $INDSOURCE/*.vim $INDSOURCE/README.txt $DEST_IND
774 :chmod $HELPMOD $DEST_IND/*.vim
Bram Moolenaar87e25fd2005-07-27 21:13:01 +0000775# install the standard autoload files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000776 :copy $AUTOSOURCE/*.vim $AUTOSOURCE/README.txt $DEST_AUTO
777 :chmod $HELPMOD $DEST_AUTO/*.vim $DEST_AUTO/README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000778# install the standard plugin files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000779 :copy $PLUGSOURCE/*.vim $PLUGSOURCE/README.txt $DEST_PLUG
780 :chmod $HELPMOD $DEST_PLUG/*.vim $DEST_PLUG/README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000781# install the ftplugin files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000782 :copy $FTPLUGSOURCE/*.vim $FTPLUGSOURCE/README.txt $DEST_FTP
783 :chmod $HELPMOD $DEST_FTP/*.vim $DEST_FTP/README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000784# install the compiler files
Bram Moolenaar1e015462005-09-25 22:16:38 +0000785 :copy $COMPSOURCE/*.vim $COMPSOURCE/README.txt $DEST_COMP
786 :chmod $HELPMOD $DEST_COMP/*.vim $DEST_COMP/README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000787
788installmacros {virtual}{force}: $MACROSOURCE $DEST_VIM $DEST_RT $DEST_MACRO
Bram Moolenaar1e015462005-09-25 22:16:38 +0000789 :copy {recursive}{force} $MACROSOURCE/* $DEST_MACRO
790 # Delete any CVS and AAPDIR directories.
791 # Use the ":tree" command if possible. It was added later, fall back
792 # to using "find" when it doesn't work.
793 @try:
794 :tree $DEST_MACRO {dirname = CVS}
795 :del {recursive} $name
796 :tree $DEST_MACRO {dirname = AAPDIR}
797 :del {recursive} $name
798 :tree $DEST_MACRO {dirname = .*}
799 :chmod $DIRMOD $name
800 :tree $DEST_MACRO {filename = .*}
801 :chmod $FILEMOD $name
802 @except:
803 @ ok, cvsdirs = redir_system('find %s -name CVS -print' % _no.DEST_MACRO)
804 @ if ok and cvsdirs:
805 :del {recursive} $cvsdirs
806 :sys chmod $DIRMOD ``find $DEST_MACRO -type d -print``
807 :sys chmod $FILEMOD ``find $DEST_MACRO -type f -print``
808 :chmod $SCRIPTMOD $DEST_MACRO/less.sh
Bram Moolenaar071d4272004-06-13 20:20:40 +0000809
810# install the tutor files
811installtutor {virtual}{force}: $TUTORSOURCE $DEST_VIM $DEST_RT $DEST_TUTOR
Bram Moolenaar1e015462005-09-25 22:16:38 +0000812 :copy vimtutor $DEST_BIN/$(VIMNAME)tutor
813 :chmod $SCRIPTMOD $DEST_BIN/$(VIMNAME)tutor
814 :copy $TUTORSOURCE/tutor* $TUTORSOURCE/README* $DEST_TUTOR
815 :chmod $HELPMOD $DEST_TUTOR/*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000816
817# install helper program xxd
818installtools {virtual}{force}: $TOOLS $DEST_BIN $DEST_MAN \
Bram Moolenaar1e015462005-09-25 22:16:38 +0000819 $TOOLSSOURCE $DEST_VIM $DEST_RT $DEST_TOOLS
820 xxd = $DEST_BIN/xxd$EXESUF
821 @if os.path.exists(xxd):
822 :move {force} $xxd $(xxd).rm
823 :del $(xxd).rm
824 :copy xxd/xxd$EXESUF $DEST_BIN
825 :do strip $DEST_BIN/xxd$EXESUF
826 :chmod $BINMOD $DEST_BIN/xxd$EXESUF
827 :copy $HELPSOURCE/xxd.1 $DEST_MAN
828 :chmod $MANMOD $DEST_MAN/xxd.1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000829# install the runtime tools
Bram Moolenaar1e015462005-09-25 22:16:38 +0000830 @try:
831 @ if aap_has(":tree"):
832 # New method: copy everything and delete CVS and AAPDIR dirs
833 :copy {recursive} $TOOLSSOURCE/* $DEST_TOOLS
834 :tree $DEST_TOOLS {dirname = CVS}
835 :delete {recursive} $name
836 :tree $DEST_TOOLS {dirname = AAPDIR}
837 :delete {recursive} $name
838 @except:
839 # Old method: copy only specific files and directories.
840 :copy {recursive} $TOOLSSOURCE/README.txt $TOOLSSOURCE/[a-z]* $DEST_TOOLS
841 :chmod $FILEMOD $DEST_TOOLS/*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000842# replace the path in some tools
Bram Moolenaar1e015462005-09-25 22:16:38 +0000843 :progsearch perlpath perl
844 @if perlpath:
845 :cat $TOOLSSOURCE/efm_perl.pl |
846 :eval re.sub("/usr/bin/perl", perlpath, stdin)
847 >! $DEST_TOOLS/efm_perl.pl
848 @else:
849 :copy $TOOLSSOURCE/efm_perl.pl $DEST_TOOLS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000850
Bram Moolenaar1e015462005-09-25 22:16:38 +0000851 :progsearch awkpath nawk gawk awk
852 @if awkpath:
853 :cat $TOOLSSOURCE/mve.awk |
854 :eval re.sub("/usr/bin/nawk", awkpath, stdin)
855 >! $DEST_TOOLS/mve.awk
856 @else:
857 :copy $TOOLSSOURCE/mve.awk $DEST_TOOLS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000858
Bram Moolenaar1e015462005-09-25 22:16:38 +0000859 :sys chmod $SCRIPTMOD ``grep -l "^#!" $DEST_TOOLS/*``
Bram Moolenaar071d4272004-06-13 20:20:40 +0000860
861# install the language specific files, if they were unpacked
862install-languages {virtual}{force}: languages $DEST_LANG $DEST_KMAP
Bram Moolenaar1e015462005-09-25 22:16:38 +0000863 @if _no.MAKEMO:
864 :sys cd $PODIR; $MAKE prefix=$DESTDIR$prefix \
865 LOCALEDIR=$DEST_LANG INSTALL_DATA=cp FILEMOD=$FILEMOD install
866 @if os.path.exists(_no.LANGSOURCE):
867 :print installing language files
868 :copy $LANGSOURCE/README.txt $LANGSOURCE/*.vim $DEST_LANG
869 :chmod $FILEMOD $DEST_LANG/*.vim
870 @if os.path.exists(_no.KMAPSOURCE):
871 :copy $KMAPSOURCE/README.txt $KMAPSOURCE/*.vim $DEST_KMAP
872 :chmod $FILEMOD $DEST_KMAP/*.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000873
Bram Moolenaar2df6dcc2004-07-12 15:53:54 +0000874# Install the icons for the KDE GUI. This differs from the KDE icons for
875# other GUIs.
876installkdeicons:
877 :copy {mkdir} ../runtime/KVim.desktop $DESTDIR$KDE_PREFIX/share/applnk/Editors/
878 :chmod 644 $DESTDIR$KDE_PREFIX/share/applnk/Editors/KVim.desktop
879 :copy {mkdir} ../runtime/kvim32x32.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/32x32/apps/gvim.png
880 :chmod 644 $DESTDIR$KDE_PREFIX/share/icons/hicolor/32x32/apps/gvim.png
881 :copy {mkdir} ../runtime/kvim48x48.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/48x48/apps/gvim.png
882 :chmod 644 $DESTDIR$KDE_PREFIX/share/icons/hicolor/48x48/apps/gvim.png
883 :copy {mkdir} ../runtime/hi16-action-make.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/16x16/actions/hi16-action-make.png
884 :copy {mkdir} ../runtime/hi22-action-make.png $DESTDIR$KDE_PREFIX/share/icons/hicolor/22x22/actions/hi22-action-make.png
885 :copy {mkdir} ../runtime/kde-tips $DESTDIR$KDE_PREFIX/share/apps/gvim/tips
886 :chmod 644 $DESTDIR$KDE_PREFIX/share/apps/kvim/tips
887
Bram Moolenaar071d4272004-06-13 20:20:40 +0000888# install the icons for KDE, if the directory exists and the icon doesn't.
889ICON48PATH = $DESTDIR$DATADIR/icons/hicolor/48x48/apps
890ICON32PATH = $DESTDIR$DATADIR/icons/locolor/32x32/apps
891ICON16PATH = $DESTDIR$DATADIR/icons/locolor/16x16/apps
892KDEPATH = $HOME/.kde/share/icons
893install-icons {virtual}:
Bram Moolenaar1e015462005-09-25 22:16:38 +0000894 gp = $ICON48PATH/gvim.png
895 @if os.path.isdir(_no.ICON48PATH) and not os.path.exists(gp):
896 :copy $SCRIPTSOURCE/vim48x48.png $gp
897 gp = $ICON32PATH/gvim.png
898 @if os.path.isdir(_no.ICON32PATH) and not os.path.exists(gp):
899 :copy $SCRIPTSOURCE/vim32x32.png $gp
900 gp = $ICON16PATH/gvim.png
901 @if os.path.isdir(_no.ICON16PATH) and not os.path.exists(gp):
902 :copy $SCRIPTSOURCE/vim16x16.png $gp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000903
904
905$HELPSOURCE/vim.1 $MACROSOURCE $TOOLSSOURCE:
Bram Moolenaar1e015462005-09-25 22:16:38 +0000906 @if not os.path.exists(_no.TOOLSSOURCE):
907 :print Runtime files not found.
908 :error You need to unpack the runtime archive before running "make install".
Bram Moolenaar071d4272004-06-13 20:20:40 +0000909
910# create links from various names to vim. This is only done when the links
911# (or executables with the same name) don't exist yet.
912installlinks {virtual}: $GUI_TARGETS \
Bram Moolenaar1e015462005-09-25 22:16:38 +0000913 $DEST_BIN/$EXTARGET \
914 $DEST_BIN/$VIEWTARGET \
915 $DEST_BIN/$RVIMTARGET \
916 $DEST_BIN/$RVIEWTARGET \
917 $INSTALLVIMDIFF
Bram Moolenaar071d4272004-06-13 20:20:40 +0000918
919installglinks {virtual}: $DEST_BIN/$GVIMTARGET \
Bram Moolenaar1e015462005-09-25 22:16:38 +0000920 $DEST_BIN/$GVIEWTARGET \
921 $DEST_BIN/$RGVIMTARGET \
922 $DEST_BIN/$RGVIEWTARGET \
923 $DEST_BIN/$EVIMTARGET \
924 $DEST_BIN/$EVIEWTARGET \
925 $INSTALLGVIMDIFF
Bram Moolenaar071d4272004-06-13 20:20:40 +0000926
927installvimdiff {virtual}: $DEST_BIN/$VIMDIFFTARGET
928installgvimdiff {virtual}: $DEST_BIN/$GVIMDIFFTARGET
929
930# These dependencies use an empty buildcheck so that they are only done when
931# the target doesn't exist.
932$DEST_BIN/$EXTARGET: {buildcheck = }
933 :sys cd $DEST_BIN; ln -s $VIMTARGET $EXTARGET
934
935$DEST_BIN/$VIEWTARGET: {buildcheck = }
936 :sys cd $DEST_BIN; ln -s $VIMTARGET $VIEWTARGET
937
938$DEST_BIN/$GVIMTARGET: {buildcheck = }
939 :sys cd $DEST_BIN; ln -s $VIMTARGET $GVIMTARGET
940
941$DEST_BIN/$GVIEWTARGET: {buildcheck = }
942 :sys cd $DEST_BIN; ln -s $VIMTARGET $GVIEWTARGET
943
944$DEST_BIN/$RVIMTARGET: {buildcheck = }
945 :sys cd $DEST_BIN; ln -s $VIMTARGET $RVIMTARGET
946
947$DEST_BIN/$RVIEWTARGET: {buildcheck = }
948 :sys cd $DEST_BIN; ln -s $VIMTARGET $RVIEWTARGET
949
950$DEST_BIN/$RGVIMTARGET: {buildcheck = }
951 :sys cd $DEST_BIN; ln -s $VIMTARGET $RGVIMTARGET
952
953$DEST_BIN/$RGVIEWTARGET: {buildcheck = }
954 :sys cd $DEST_BIN; ln -s $VIMTARGET $RGVIEWTARGET
955
956$DEST_BIN/$VIMDIFFTARGET: {buildcheck = }
957 :sys cd $DEST_BIN; ln -s $VIMTARGET $VIMDIFFTARGET
958
959$DEST_BIN/$GVIMDIFFTARGET: {buildcheck = }
960 :sys cd $DEST_BIN; ln -s $VIMTARGET $GVIMDIFFTARGET
961
962$DEST_BIN/$EVIMTARGET: {buildcheck = }
963 :sys cd $DEST_BIN; ln -s $VIMTARGET $EVIMTARGET
964
965$DEST_BIN/$EVIEWTARGET: {buildcheck = }
966 :sys cd $DEST_BIN; ln -s $VIMTARGET $EVIEWTARGET
967
Bram Moolenaar1e015462005-09-25 22:16:38 +0000968# create links for the manual pages with various names to vim. This is only
Bram Moolenaar071d4272004-06-13 20:20:40 +0000969# done when the links (or manpages with the same name) don't exist yet.
970installhelplinks {virtual}: $GUI_MAN_TARGETS \
Bram Moolenaar1e015462005-09-25 22:16:38 +0000971 $DEST_MAN/$(EXNAME).1 \
972 $DEST_MAN/$(VIEWNAME).1 \
973 $DEST_MAN/$(RVIMNAME).1 \
974 $DEST_MAN/$(RVIEWNAME).1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000975
976installghelplinks {virtual}: $DEST_MAN/$(GVIMNAME).1 \
Bram Moolenaar1e015462005-09-25 22:16:38 +0000977 $DEST_MAN/$(GVIEWNAME).1 \
978 $DEST_MAN/$(RGVIMNAME).1 \
979 $DEST_MAN/$(RGVIEWNAME).1 \
980 $DEST_MAN/$(GVIMDIFFNAME).1 \
981 $DEST_MAN/$(EVIEWNAME).1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000982
983$DEST_MAN/$(EXNAME).1: {buildcheck = }
984 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(EXNAME).1
985
986$DEST_MAN/$(VIEWNAME).1: {buildcheck = }
987 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(VIEWNAME).1
988
989$DEST_MAN/$(GVIMNAME).1: {buildcheck = }
990 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(GVIMNAME).1
991
992$DEST_MAN/$(GVIEWNAME).1: {buildcheck = }
993 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(GVIEWNAME).1
994
995$DEST_MAN/$(RVIMNAME).1: {buildcheck = }
996 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(RVIMNAME).1
997
998$DEST_MAN/$(RVIEWNAME).1: {buildcheck = }
999 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(RVIEWNAME).1
1000
1001$DEST_MAN/$(RGVIMNAME).1: {buildcheck = }
1002 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(RGVIMNAME).1
1003
1004$DEST_MAN/$(RGVIEWNAME).1: {buildcheck = }
1005 :sys cd $DEST_MAN; ln -s $(VIMNAME).1 $(RGVIEWNAME).1
1006
1007$DEST_MAN/$(GVIMDIFFNAME).1: {buildcheck = }
1008 :sys cd $DEST_MAN; ln -s $(VIMDIFFNAME).1 $(GVIMDIFFNAME).1
1009
1010$DEST_MAN/$(EVIEWNAME).1: {buildcheck = }
1011 :sys cd $DEST_MAN; ln -s $(EVIMNAME).1 $(EVIEWNAME).1
1012
1013#
1014# U N I N S T A L L
1015#
1016uninstall {virtual}{force}: uninstall_runtime
1017 :del {force} $DEST_BIN/$VIMTARGET
1018 :del {force} $DEST_MAN/$(VIMNAME).1 $DEST_MAN/$(VIMNAME)tutor.1
1019 :del {force} $DEST_BIN/vimtutor
1020 :del {force} $DEST_BIN/xxd$EXESUF $DEST_MAN/xxd.1
1021 :del {force} $DEST_BIN/$EXTARGET $DEST_BIN/$VIEWTARGET
1022 :del {force} $DEST_BIN/$GVIMTARGET $DEST_BIN/$GVIEWTARGET
1023 :del {force} $DEST_BIN/$RVIMTARGET $DEST_BIN/$RVIEWTARGET
1024 :del {force} $DEST_BIN/$RGVIMTARGET $DEST_BIN/$RGVIEWTARGET
1025 :del {force} $DEST_BIN/$VIMDIFFTARGET $DEST_BIN/$GVIMDIFFTARGET
1026 :del {force} $DEST_BIN/$EVIMTARGET $DEST_BIN/$EVIEWTARGET
1027 :del {force} $DEST_MAN/$(EXNAME).1 $DEST_MAN/$(VIEWNAME).1
1028 :del {force} $DEST_MAN/$(GVIMNAME).1 $DEST_MAN/$(GVIEWNAME).1
1029 :del {force} $DEST_MAN/$(RVIMNAME).1 $DEST_MAN/$(RVIEWNAME).1
1030 :del {force} $DEST_MAN/$(RGVIMNAME).1 $DEST_MAN/$(RGVIEWNAME).1
1031 :del {force} $DEST_MAN/$(VIMDIFFNAME).1 $DEST_MAN/$(GVIMDIFFNAME).1
1032 :del {force} $DEST_MAN/$(EVIMNAME).1 $DEST_MAN/$(EVIEWNAME).1
1033
1034# Note: "deldir" will fail if any files were added after "make install", that
1035# is intentionally: Keep files the user added.
1036uninstall_runtime {virtual}{force}:
1037 :del {force} $DEST_HELP/*.txt $DEST_HELP/tags $DEST_HELP/*.pl
1038 :del {force} $SYS_MENU_FILE $SYS_SYNMENU_FILE $SYS_DELMENU_FILE
1039 :del {force} $SYS_BUGR_FILE $EVIM_FILE $MSWIN_FILE
1040 :del {force} $DEST_SCRIPT/gvimrc_example.vim $DEST_SCRIPT/vimrc_example.vim
1041 :del {force} $SYS_FILETYPE_FILE $SYS_FTOFF_FILE $SYS_SCRIPTS_FILE
1042 :del {force} $SYS_INDOFF_FILE $SYS_INDENT_FILE
1043 :del {force} $SYS_FTPLUGOF_FILE $SYS_FTPLUGIN_FILE
1044 :del {force} $SYS_OPTWIN_FILE
1045 :del {force} $DEST_COL/*.vim $DEST_COL/README.txt
1046 :del {force} $DEST_SYN/*.vim $DEST_SYN/README.txt
1047 :del {force} $DEST_IND/*.vim $DEST_IND/README.txt
1048 :del {force} $DEST_PRINT/*.ps
1049 :del {force}{recursive} $DEST_MACRO
1050 :del {force}{recursive} $DEST_TUTOR
1051 :del {force}{recursive} $DEST_TOOLS
1052 :del {force}{recursive} $DEST_LANG
1053 :del {force}{recursive} $DEST_KMAP
1054 :del {force}{recursive} $DEST_COMP
1055 :deldir {force} $DEST_HELP $DEST_COL $DEST_SYN $DEST_IND
1056 :del {force}{recursive} $DEST_FTP/*.vim $DEST_FTP/README.txt
Bram Moolenaar87e25fd2005-07-27 21:13:01 +00001057 :del {force} $DEST_AUTO/*.vim $DEST_AUTO/README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +00001058 :del {force} $DEST_PLUG/*.vim $DEST_PLUG/README.txt
Bram Moolenaar87e25fd2005-07-27 21:13:01 +00001059 :deldir {force} $DEST_FTP $DEST_AUTO $DEST_PLUG $DEST_PRINT $DEST_RT
Bram Moolenaar1e015462005-09-25 22:16:38 +00001060# This will fail when other Vim versions are installed, no worries.
Bram Moolenaar071d4272004-06-13 20:20:40 +00001061 @try:
Bram Moolenaar1e015462005-09-25 22:16:38 +00001062 :deldir $DEST_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001063 @except:
Bram Moolenaar1e015462005-09-25 22:16:38 +00001064 :print Cannot delete $DEST_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001065
1066
1067# vim: sts=4 sw=4 :