]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/Please_avoid_using___39__cp_-a__39___in_Makefile.PL.mdwn
rename bugs/pipe-symbol_in_wikilink_target.mdwn to bugs/pipe-symbol_in_taglink_target...
[ikiwiki.git] / doc / bugs / Please_avoid_using___39__cp_-a__39___in_Makefile.PL.mdwn
1 In ikiwiki-2.60, external plug-ins are yet again installed using 'cp -a' instead of 'install -m 755'. This poses a problem on at least FreeBSD 6.x, since the cp(1) command doesn't support the '-a' flag.
2
3 The change in question (from 2.56 to 2.60) can be seen here:
4
5     -       for file in `find plugins -maxdepth 1 -type f ! -wholename plugins/.\*`; do \
6     -               install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
7     -       done; \
8     +       for file in `find plugins -maxdepth 1 -type f ! -wholename plugins/.\* | grep -v demo`; do \
9     +               cp -a $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
10     +       done \
11
12 Please restore the old behaviour of using 'install' :-)
13
14   -- [[HenrikBrixAndersen]]
15
16 > I use cp -a because I don't want non-executable files to be installed
17 > executable. (Causes breakage with setup file creation code) I really
18 > wish *BSD could get out of the 70's in this area..
19 > --[[Joey]]
20
21 >> Well, really what's happening here is that *BSD (along with, for
22 >> example, Solaris) is adhering rather closely to the Single UNIX
23 >> Specification, whereas `-a` is a nonstandard option added to the
24 >> GNU variant of `cp` (a habit Richard Stallman never really got under
25 >> control). To install ikiwiki on Solaris I had to replace all uses not
26 >> only of `cp` but also of `install` and `xgettext` with the GNU
27 >> embrace-and-extend variants, and make sure I had those installed.
28 >> That really is a bit of a PITA.
29
30 >> I think there's an opportunity here for a really clean solution, though.
31
32 >> Why not do the installation in pure Perl?
33
34 >> The file manipulations being done by `cp` and `install` would be
35 >> straightforward to code in Perl, and there really isn't a complicated
36 >> build requiring the full functionality of `gmake`. `gxgettext` I'm
37 >> not so sure about, but even getting rid of _almost_ all the
38 >> nonstandard-utility dependencies would be a win.
39
40 >> The idea is that if you're distributing a Perl-based app, one thing
41 >> you'll always be absolutely certain of in the target environment is a
42 >> working Perl. The fact that the current build starts out in Perl, but
43 >> uses it to write a Makefile and then hand off to other utilities that
44 >> are less dependably compatible across platforms is a disadvantage.
45
46 >> A pure-Perl install can also query the very Perl it's running in to
47 >> determine the proper places to install files, and that will be less
48 >> error-prone that making a human edit the right paths into some files.
49 >> It would be quite useful here, actually, where we have several distinct
50 >> Perl builds installed at different paths, and ikiwiki could be correctly
51 >> installed for any one of them simply by using the chosen Perl to run the
52 >> install. That means this would also be a complete solution to
53 >> [[todo/assumes_system_perl|todo/assumes_system_perl]].
54 >> --ChapmanFlack
55
56 >>> Joey: How about the following patch, then? -- [[HenrikBrixAndersen]]
57
58     --- Makefile.PL.orig        2008-08-16 14:57:00.000000000 +0200
59     +++ Makefile.PL     2008-08-16 15:03:45.000000000 +0200
60     @@ -67,9 +67,12 @@ extra_install:
61         done
62         
63         install -d $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins
64     -   for file in `find plugins -maxdepth 1 -type f ! -wholename plugins/.\* | grep -v demo`; do \
65     -           cp -a $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
66     -   done \
67     +   for file in `find plugins -maxdepth 1 -type f ! -wholename plugins/.\* ! -name \*demo\* -name \*.py`; do \
68     +           install -m 644 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
69     +   done
70     +   for file in `find plugins -maxdepth 1 -type f ! -wholename plugins/.\* ! -name \*demo\* ! -name \*.py`; do \
71     +           install -m 755 $$file $(DESTDIR)$(PREFIX)/lib/ikiwiki/plugins; \
72     +   done
73      
74         install -d $(DESTDIR)$(PREFIX)/share/man/man1
75         install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
76
77 [[!tag done]]