forked from arsv/perl-cross
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.config.SH
executable file
·182 lines (159 loc) · 3.75 KB
/
Makefile.config.SH
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
#!/bin/sh
if [ ! -f config.sh ]; then
echo "config.sh not found" >&2
exit -1
fi
. ./config.sh
true > Makefile.config
if [ "$usecrosscompile" = 'define' ]; then
unset cc
unset ccflags
unset ar
unset ranlib
unset libs
if [ ! -f 'xconfig.sh' ]; then
echo 'xconfig.sh not found' >&2
exit -1
fi
. ./xconfig.sh
hostcc="$cc"
hostccflags="$ccflags $optimize"
hostldflags="$ldflags"
hostar="$ar"
hostranlib="$ranlib"
hostlibs="$perllibs"
host_o="$_o"
host_exe="$_exe"
hostbin="$bin"
hostprefix="$prefix"
# it's "from host", not host-arch
target_name="$target_name"
target_arch="$target_arch"
sysroot="$sysroot"
. ./config.sh
fi
ifprefixed() {
val=`echo "$2" | sed -e "s/^$1//"`
if [ "$1$val" = "$2" ]; then
echo "\$(CROSS)$val"
else
echo "$2"
fi
}
if [ "$usedl" = 'undef' ]; then
dynaloader=''
else
dynaloader="DynaLoader"
fi
cflags="-DPERL_CORE $ccflags $optimize"
test "$useshrplib" = 'true' && cflags="$cflags $cccdlflags"
if [ "$usecrosscompile" = "define" ]; then
test -n "$toolsprefix" && cross="$toolsprefix" || cross="$target_name-"
cat >> Makefile.config <<END
CROSS = $cross
CC = `ifprefixed "$cross" "$cc"`
AR = `ifprefixed "$cross" "$ar"`
RANLIB = `ifprefixed "$cross" "$ranlib"`
CFLAGS = $cflags
LDFLAGS = $ldflags
LDDLFLAGS = $lddlflags
LIBS = $perllibs
HOSTCC = $hostcc
HOSTCFLAGS = -DPERL_CORE -DUSE_CROSS_COMPILE $hostccflags
HOSTCFMINI = \$(HOSTCFLAGS) -DPERL_EXTERNAL_GLOB
HOSTLDFLAGS = $hostldflags
HOSTLIBS = $hostlibs
hostbin = \$(DESTDIR)$hostbin
hostarch = \$(DESTDIR)$hostarch
hostprefix = \$(DESTDIR)$hostprefix
target_name = $target_name
target_arch = $target_arch
sysroot = $sysroot
# suffixes for static library, object and executable files
# lowercase for target platform or native build, uppercase
# for build platform.
a = $_a
o = $_o
x =
l = .so
O = .host$host_o
X = $host_exe
so = $dlext
END
else
cat >> Makefile.config <<END
CC = $cc
AR = $ar
RANLIB = $ranlib
CFLAGS = $cflags
LDFLAGS = $ldflags
LDDLFLAGS = $lddlflags
LIBS = $perllibs
HOSTCC = \$(CC)
HOSTCFLAGS = \$(CFLAGS)
HOSTCFMINI = \$(HOSTCFLAGS) -DPERL_EXTERNAL_GLOB
HOSTLDFLAGS = \$(LDFLAGS)
HOSTLIBS = \$(LIBS)
# suffixes for static library, object and executable files
# lowercase for target platform or native build, uppercase
# for build platform.
a = $_a
o = $_o
x = $_exe
l = .so
O = $_o
X = $_exe
END
fi
cat >> Makefile.config <<END
package = $package
perlname = $perlname
version = $version
dynaloader = $dynaloader
useshrplib = $useshrplib
soname = $soname
patchset = $package-$version
installbin = $installbin
LIBPERL = $libperl
.SUFFIXES: .c \$o \$O
LNS = $lns
archlib = $archlib
fullpath_dynamic_ext = $fullpath_dynamic_ext
fullpath_static_ext = $fullpath_static_ext
fullpath_nonxs_ext = $fullpath_nonxs_ext
disabled_dynamic_ext=$disabled_dynamic_ext
disabled_nonxs_ext=$disabled_nonxs_ext
END
vertag=$PERL_REVISION$PERL_VERSION$PERL_SUBVERSION
echo >> Makefile.config
if [ "$package" = 'cperl' ]; then
# The version they diverged from mainline perl? Yikes
case "$version" in
5.26.*) pcpver=5260 ;;
5.28.*) pcpver=${vertag} ;;
5.30.*) pcpver=${vertag} ;;
*) pcpver=5240 ;;
esac
cat >> Makefile.config << END
perlcdeltapod=perl${vertag}cdelta.pod
perldeltapod=perl${pcpver}delta.pod
END
else
cat >> Makefile.config << END
perldeltapod=perl${vertag}delta.pod
END
fi
# Before 5.24, time64.c was included from pp_sys.c and could not be built
# separately. From 5.24 on, it's a regular standalone file. Ugly but there
# is probably no better way to handle this.
case "$version" in
5.22.*) ;;
*) echo "time64.c = time64.c" >> Makefile.config ;;
esac
# Before 5.27.7, PPPort was in cpan/. From that version on, it's in dist/
if [ -d "dist/Devel-PPPort" ]; then
ppport="dist/Devel-PPPort"
else
ppport="cpan/Devel-PPPort"
fi
echo "ppport = $ppport" >> Makefile.config