-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile.PL
222 lines (186 loc) · 6.08 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#
# Fake MakeMaker Makefile.PL - top level Makefile.PL for Redland
#
# $Id$
#
# Copyright (C) 2001-2005 David Beckett http://www.dajobe.org/
# Copyright (C) 2001-2005 University of Bristol, UK http://www.bristol.ac.uk/
#
# This package is Free Software and part of Redland http://librdf.org/
#
# It is licensed under the following three licenses as alternatives:
# 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
# 2. GNU General Public License (GPL) V2 or any newer version
# 3. Apache License, V2.0 or any newer version
#
# You may not use this file except in compliance with at least one of
# the above three licenses.
#
# See LICENSE.html or LICENSE.txt at the top of this package for the
# complete terms and further detail along with the license texts for
# the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
#
#
require 5.6.0;
use File::Basename;
use Config;
my $program=basename $0;
# Inspired by the way that ePerl does its configuration of perl.
# See http://www.engelschall.com/sw/eperl/
#
# There are many makefiles :) and this is their story
# Makefile.am Makefile.in - GNU automake, autoconf source files
# which generate Makefile after ./configure is run
# Makefile.PL - this file runs ./configure and renames
# the autoconfigure-made top level makefile Makefile to
# Makefile.stand and then uses it to do the top level build of
# Redland.
# Makefile.stand - autoconfigure-made makefile, renamed as described above
# Makefile - created by this script. A skeleton makefile that
# calls either the GNU autoconfigure-made top-level
# Makefile.stand or one of the makefiles in the perl directory.
# OR if this perl script isn't run, remains the top-level
# autoconfigure-made generated makefile built from
# Makefile.am/Makefile.in after substitution.
# perl/Makefile - autoconfigure made makefile for building the Redland
# perl interface inside Redland. Calls perl/Makefile.PL to create
# perl/Makefile.perl via the usual perl MakeMaker.
# perl/Makefile.perl - makefile built by perl/Makefile.PL using MakeMaker
# perl/Makefile.PL - MakeMaker source file for Redland perl interface
#
# All clear now?
#
$TOP_SRCDIR=$ENV{TOP_SRCDIR} || '.';
$PACKAGE=$ENV{PACKAGE} || "Redland";
my $version=$ENV{VERSION};
if(!$version) {
my $conf_in_file="$TOP_SRCDIR/configure.ac";
open(CONF, $conf_in_file) or die "Cannot open $conf_in_file for version - $!\n";
while(<CONF>) {
if(/^AC_INIT\(\[[^]]+\],\s*([^,]+)/) {
$version=$1;
}
}
close(CONF);
die "Cannot find AC_INIT in $conf_in_file for version\n"
unless $version;
}
my $perl_makefile="Makefile";
my $standalone_makefile="Makefile.stand";
unlink "$TOP_SRCDIR/$perl_makefile";
unlink "$TOP_SRCDIR/$standalone_makefile";
my $perl = $Config{perlpath};
my $prefix = $Config{prefix};
my $cc = $Config{cc};
my $ccarg = "";
if ($args =~ m|CC=(\S+)|) {
$cc = $1;
$ccarg = "CC=$1 ";
}
open(MK, ">$TOP_SRCDIR/$perl_makefile")
or die "Cannot create $TOP_SRCDIR/$perl_makefile - $!";
print MK <<"EOM";
# Fake MakeMaker-compatible generated Makefile
# Generated automatically by $program
# DO NOT EDIT THIS FILE - changes will be lost
# To rebuild this makefile, run $perl $program with no arguments
#
DISTNAME = $PACKAGE
VERSION = $version
SHELL = /bin/sh
NOOP = \$(SHELL) -c true
RM_RF = rm -rf
DISTVNAME = \$(DISTNAME)-\$(VERSION)
TAR = tar
TARFLAGS = cvf
ZIP = zip
ZIPFLAGS = -r
COMPRESS = gzip --best
SUFFIX = .gz
SHAR = shar
PREOP = @\$(NOOP)
POSTOP = @\$(NOOP)
TO_UNIX = @\$(NOOP)
CI = ci -u
DIST_CP = best
DIST_DEFAULT = tardist
# MakeMaker target
all: config
# MakeMaker target
config:
\@if [ ! -f ${standalone_makefile} ]; then \\
cp ${perl_makefile} Makefile.perl; \\
echo "${ccarg}PERL=$perl ./configure --prefix=$prefix"; \\
${ccarg}PERL=$perl ./configure --prefix=$prefix; \\
cp Makefile ${standalone_makefile}; \\
cp Makefile.perl ${perl_makefile}; \\
rm Makefile.perl; \\
echo \$(MAKE) -f ${standalone_makefile}; \\
\$(MAKE) -f ${standalone_makefile}; \\
fi
\@if [ ! -f perl/Makefile.perl ]; then \\
echo "cd perl"; \\
cd perl; \\
echo "\$(MAKE) \$(MFLAGS) Makefile.perl"; \\
\$(MAKE) \$(MFLAGS) Makefile.perl; \\
echo "\$(MAKE) \$(MFLAGS) -f Makefile.perl all"; \\
\$(MAKE) \$(MFLAGS) -f Makefile.perl all; \\
fi
# MakeMaker targets
test: config
cd perl && \$(MAKE) \$(MFLAGS) -f Makefile.perl \$@
install: config
cd perl && \$(MAKE) \$(MFLAGS) -f Makefile.perl \$@
# MakeMaker target
clean:
\@if [ -f ${standalone_makefile} ]; then \\
echo \$(MAKE) -k \$(MFLAGS) -f ${standalone_makefile} \$@; \\
(\$(MAKE) -k \$(MFLAGS) -f ${standalone_makefile} \$@; exit 0; ); \\
fi
\@if [ -f perl/Makefile.perl ]; then \\
echo "cd perl"; \\
cd perl; \\
echo "\$(MAKE) \$(MFLAGS) \$@\-perl"; \\
\$(MAKE) \$(MFLAGS) \$\@-perl; \\
fi
# MakeMaker/GNU target
distclean:
\$(MAKE) \$(MFLAGS) -f ${standalone_makefile} distclean
cd perl && \$(MAKE) \$(MFLAGS) realclean-perl
-rm -f ${standalone_makefile}
-rm -f ${perl_makefile}
# Rebuild this generated makefile when the source file changes
Makefile: Makefile.PL
${perl} Makefile.PL
# MakeMaker[dist]/GNU targets
# Pass on some targets to GNU autoconfigured makefile in order
# so that 'make [all]' and 'make dist' work
all-recursive all-am dist dist-hook: config
\$(MAKE) \$(MFLAGS) -f ${standalone_makefile} \$@
# MakeMaker targets
distcheck:
${perl} -MExtUtils::Manifest=fullcheck -e fullcheck
skipcheck:
${perl} -MExtUtils::Manifest=skipcheck -e skipcheck
manifest: MANIFEST
# MakeMaker dist_dir section:
perl-distdir: MANIFEST
rm -rf \$(DISTVNAME)
$perl -MExtUtils::Manifest=manicopy,maniread \\
-e "manicopy(maniread(),'\$(DISTVNAME)', '\$(DIST_CP)');"
tardist : \$(DISTVNAME).tar\$(SUFFIX)
zipdist : \$(DISTVNAME).zip
\$(DISTVNAME).tar\$(SUFFIX) : perl-distdir
\$(PREOP)
\$(TO_UNIX)
\$(TAR) \$(TARFLAGS) \$(DISTVNAME).tar \$(DISTVNAME)
\$(RM_RF) \$(DISTVNAME)
\$(COMPRESS) \$(DISTVNAME).tar
\$(POSTOP)
\$(DISTVNAME).zip : perl-distdir
\$(PREOP)
\$(ZIP) \$(ZIPFLAGS) \$(DISTVNAME).zip \$(DISTVNAME)
\$(RM_RF) \$(DISTVNAME)
\$(POSTOP)
EOM
close(MK)