Ticket #4148: patch-mkmf

File patch-mkmf, 4.4 KB (added by andre@…, 19 years ago)

patch-mkmf: fixes peter jones' custom made makefile maker so that it understand destrooting

Line 
1diff -ruN xmlwrapp-0.5.0.orig/tools/mkmf xmlwrapp-0.5.0/tools/mkmf
2--- xmlwrapp-0.5.0.orig/tools/mkmf      2003-08-03 21:57:28.000000000 -0700
3+++ xmlwrapp-0.5.0/tools/mkmf   2005-07-26 15:49:42.000000000 -0700
4@@ -555,38 +555,38 @@
5 
6     if (@static_libraries or @shared_libraries or @binaries or @include_dirs or @include_files or @man_pages) {
7        print MF "install: all\n";
8-       print MF "\tmkdir -p $vars{'BINDIR'}\n" if @binaries;
9-       print MF "\tmkdir -p $vars{'INCLUDEDIR'}\n" if @include_files or @include_dirs;
10-       print MF "\tmkdir -p $vars{'LIBDIR'}\n" if @static_libraries or @shared_libraries;
11-       print MF "\tmkdir -p $vars{'LIBDIR'}/pkgconfig\n" if @pkgconfig;
12-       print MF "\tmkdir -p $vars{'MANDIR'}\n" if @man_pages;
13+       print MF "\tmkdir -p \${DESTDIR}$vars{'BINDIR'}\n" if @binaries;
14+       print MF "\tmkdir -p \${DESTDIR}$vars{'INCLUDEDIR'}\n" if @include_files or @include_dirs;
15+       print MF "\tmkdir -p \${DESTDIR}$vars{'LIBDIR'}\n" if @static_libraries or @shared_libraries;
16+       print MF "\tmkdir -p \${DESTDIR}$vars{'LIBDIR'}/pkgconfig\n" if @pkgconfig;
17+       print MF "\tmkdir -p \${DESTDIR}$vars{'MANDIR'}\n" if @man_pages;
18 
19        foreach my $binary (@binaries) {
20-           print MF "\tcp $binary->[0] $vars{'BINDIR'}/$binary->[1]\n";
21-           print MF "\tchmod 755 $vars{'BINDIR'}/$binary->[1]\n";
22+           print MF "\tinstall $binary->[0] \${DESTDIR}$vars{'BINDIR'}/$binary->[1]\n";
23+           print MF "\tchmod 755 \${DESTDIR}$vars{'BINDIR'}/$binary->[1]\n";
24        }
25 
26        foreach my $pc (@pkgconfig) {
27-           print MF "\tcp $pc $vars{'LIBDIR'}/pkgconfig/$pc\n";
28-           print MF "\tchmod 644 $vars{'LIBDIR'}/pkgconfig/$pc\n";
29+           print MF "\tinstall $pc \${DESTDIR}$vars{'LIBDIR'}/pkgconfig/$pc\n";
30+           print MF "\tchmod 644 \${DESTDIR}$vars{'LIBDIR'}/pkgconfig/$pc\n";
31        }
32 
33        foreach my $directory (@include_dirs) {
34-           print MF "\tmkdir -p $vars{'INCLUDEDIR'}/$directory->[1]\n";
35-           print MF "\tcp -r $directory->[0]/* $vars{'INCLUDEDIR'}/$directory->[1]\n";
36-           print MF "\tfind $vars{'INCLUDEDIR'}/$directory->[1] -type d | xargs chmod 755\n";
37-           print MF "\tfind $vars{'INCLUDEDIR'}/$directory->[1] -type f | xargs chmod 644\n";
38+           print MF "\tmkdir -p \${DESTDIR}$vars{'INCLUDEDIR'}/$directory->[1]\n";
39+           print MF "\tinstall $directory->[0]/* \${DESTDIR}$vars{'INCLUDEDIR'}/$directory->[1]\n";
40+           print MF "\tfind \${DESTDIR}$vars{'INCLUDEDIR'}/$directory->[1] -type d | xargs chmod 755\n";
41+           print MF "\tfind \${DESTDIR}$vars{'INCLUDEDIR'}/$directory->[1] -type f | xargs chmod 644\n";
42        }
43 
44        foreach my $file (@include_files) {
45-           print MF "\tcp $file->[0] $vars{'INCLUDEDIR'}/$file->[1]\n";
46-           print MF "\tchmod 644 $vars{'INCLUDEDIR'}/$file->[1]\n";
47+           print MF "\tinstall $file->[0] \${DESTDIR}$vars{'INCLUDEDIR'}/$file->[1]\n";
48+           print MF "\tchmod 644 \${DESTDIR}$vars{'INCLUDEDIR'}/$file->[1]\n";
49        }
50 
51        foreach my $library (@static_libraries) {
52            my $libname = "$static_lib_prefix$library->[1]$static_lib_extension";
53-           print MF "\tcp $library->[0]/$libname $vars{'LIBDIR'}/$libname\n";
54-           print MF "\tchmod 755 $vars{'LIBDIR'}/$libname\n";
55+           print MF "\tinstall $library->[0]/$libname \${DESTDIR}$vars{'LIBDIR'}/$libname\n";
56+           print MF "\tchmod 755 \${DESTDIR}$vars{'LIBDIR'}/$libname\n";
57        }
58 
59        foreach my $library (@shared_libraries) {
60@@ -595,18 +595,18 @@
61 
62            chomp($major_name); clean($major_name);
63 
64-           print MF "\tcp $library->[0]/$libname $vars{'LIBDIR'}/$major_name\n";
65-           print MF "\tchmod 755 $vars{'LIBDIR'}/$major_name\n";
66-           print MF "\trm -f $vars{'LIBDIR'}/$libname\n";
67-           print MF "\t(cd $vars{'LIBDIR'}; ln -s $major_name $libname)\n";
68+           print MF "\tinstall $library->[0]/$libname \${DESTDIR}$vars{'LIBDIR'}/$major_name\n";
69+           print MF "\tchmod 755 \${DESTDIR}$vars{'LIBDIR'}/$major_name\n";
70+           print MF "\trm -f \${DESTDIR}$vars{'LIBDIR'}/$libname\n";
71+           print MF "\t(cd \${DESTDIR}$vars{'LIBDIR'}; ln -s $major_name $libname)\n";
72        }
73 
74        foreach my $manpage (@man_pages) {
75            my $file = basename($manpage->[1]);
76 
77-           print MF "\tmkdir -p $vars{'MANDIR'}/man$manpage->[0]\n";
78-           print MF "\tcp $manpage->[1] $vars{'MANDIR'}/man$manpage->[0]\n";
79-           print MF "\tchmod 644 $vars{'MANDIR'}/man$manpage->[0]/$file\n";
80+           print MF "\tmkdir -p \${DESTDIR}$vars{'MANDIR'}/man$manpage->[0]\n";
81+           print MF "\tinstall $manpage->[1] \${DESTDIR}$vars{'MANDIR'}/man$manpage->[0]\n";
82+           print MF "\tchmod 644 \${DESTDIR}$vars{'MANDIR'}/man$manpage->[0]/$file\n";
83        }
84 
85        print MF "\n";