Line 0
Link Here
|
|
|
1 |
--- setup/konfigure.perl.orig 2017-07-14 21:55:36 UTC |
2 |
+++ setup/konfigure.perl |
3 |
@@ -186,7 +186,7 @@ if ($OPT{'help'}) { |
4 |
foreach (@ARGV) { |
5 |
@_ = split('='); |
6 |
next if ($#_ != 1); |
7 |
- $OPT{$_[0]} = $_[1] if ($_[0] eq 'CXX' || $_[0] eq 'LDFLAGS'); |
8 |
+ $OPT{$_[0]} = $_[1] if ($_[0] eq 'CC' || $_[0] eq 'CXX' || $_[0] eq 'LDFLAGS' || $_[0] eq 'TOOLS'); |
9 |
} |
10 |
|
11 |
println "Configuring $PACKAGE_NAME package"; |
12 |
@@ -198,7 +198,7 @@ print "checking system type... " unless |
13 |
my ($OS, $ARCH, $OSTYPE, $MARCH, @ARCHITECTURES) = OsArch(); |
14 |
println $OSTYPE unless ($AUTORUN); |
15 |
|
16 |
-unless ($OSTYPE =~ /linux/i || $OSTYPE =~ /darwin/i || $OSTYPE eq 'win') { |
17 |
+unless ($OSTYPE =~ /linux/i || $OSTYPE =~ /freebsd/i || $OSTYPE =~ /darwin/i || $OSTYPE eq 'win') { |
18 |
println "configure: error: unsupported system '$OSTYPE'"; |
19 |
exit 1; |
20 |
} |
21 |
@@ -213,7 +213,7 @@ if ($OS eq 'linux') { |
22 |
|
23 |
print "checking machine architecture... " unless ($AUTORUN); |
24 |
println $MARCH unless ($AUTORUN); |
25 |
-unless ($MARCH =~ /x86_64/i || $MARCH =~ /i?86/i) { |
26 |
+unless ($MARCH =~ /x86_64/i || $MARCH =~ /amd64/i || $MARCH =~ /i?86/i) { |
27 |
println "configure: error: unsupported architecture '$OSTYPE'"; |
28 |
exit 1; |
29 |
} |
30 |
@@ -298,7 +298,7 @@ print "checking for supported architectu |
31 |
|
32 |
my $BITS; |
33 |
|
34 |
-if ($MARCH =~ /x86_64/i) { |
35 |
+if ($MARCH =~ /(x86_|amd)64/i) { |
36 |
$BITS = 64; |
37 |
} elsif ($MARCH eq 'fat86') { |
38 |
$BITS = '32_64'; |
39 |
@@ -331,6 +331,18 @@ if ($OSTYPE =~ /linux/i) { |
40 |
$EXEX = ''; |
41 |
$OSINC = 'unix'; |
42 |
$TOOLS = 'clang' unless ($TOOLS); |
43 |
+} elsif ($OSTYPE =~ /freebsd/i) { |
44 |
+ $LPFX = 'lib'; |
45 |
+ $OBJX = 'o'; |
46 |
+ $LOBX = 'pic.o'; |
47 |
+ $LIBX = 'a'; |
48 |
+ $SHLX = 'so'; |
49 |
+ $EXEX = ''; |
50 |
+ $OSINC = 'unix'; |
51 |
+ unless ($TOOLS) { |
52 |
+ $TOOLS = 'clang'; |
53 |
+ $TOOLS = $OPT{TOOLS} if ($OPT{TOOLS}); |
54 |
+ } |
55 |
} elsif ($OSTYPE eq 'win') { |
56 |
$TOOLS = 'vc++'; |
57 |
} else { |
58 |
@@ -346,17 +358,19 @@ my ($ARCH_FL, $DBG, $OPT, $PIC, $INC, $M |
59 |
|
60 |
print "checking for supported tool chain... " unless ($AUTORUN); |
61 |
|
62 |
+$CC = $OPT{CC } if ($OPT{CC }); |
63 |
$CPP = $OPT{CXX } if ($OPT{CXX }); |
64 |
$LDFLAGS = $OPT{LDFLAGS} if ($OPT{LDFLAGS}); |
65 |
|
66 |
if ($TOOLS =~ /gcc$/) { |
67 |
$CPP = 'g++' unless ($CPP); |
68 |
- $CC = "$TOOLS -c"; |
69 |
+ $CC = 'gcc' unless ($CC); |
70 |
+ $LD = $CC; |
71 |
+ $CC = "$CC -c"; |
72 |
$CP = "$CPP -c"; |
73 |
$AR = 'ar rc'; |
74 |
$ARX = 'ar x'; |
75 |
$ARLS = 'ar t'; |
76 |
- $LD = $TOOLS; |
77 |
$LP = $CPP; |
78 |
|
79 |
$DBG = '-g -DDEBUG'; |
80 |
@@ -366,21 +380,24 @@ if ($TOOLS =~ /gcc$/) { |
81 |
$MD = '-MD'; |
82 |
} elsif ($TOOLS eq 'clang') { |
83 |
$CPP = 'clang++' unless ($CPP); |
84 |
- $CC = 'clang -c'; |
85 |
- my $versionMin = '-mmacosx-version-min=10.6'; |
86 |
+ $CC = 'clang' unless ($CC); |
87 |
+ $LD = $CC; |
88 |
+ $CC = "$CC -c"; |
89 |
+ my $versionMin = ''; |
90 |
+ $versionMin = '-mmacosx-version-min=10.6' if ($OSTYPE =~ /darwin/i); |
91 |
$CP = "$CPP -c $versionMin"; |
92 |
if ($BITS ne '32_64') { |
93 |
$ARCH_FL = '-arch i386' if ($BITS == 32); |
94 |
$OPT = '-O3'; |
95 |
$AR = 'ar rc'; |
96 |
- $LD = "clang $ARCH_FL"; |
97 |
+ $LD = "$LD $ARCH_FL"; |
98 |
$LP = "$CPP $versionMin $ARCH_FL"; |
99 |
} else { |
100 |
$MAKE_MANIFEST = '( echo "$^" > $@/manifest )'; |
101 |
$ARCH_FL = '-arch i386 -arch x86_64'; |
102 |
$OPT = '-O3'; |
103 |
$AR = 'libtool -static -o'; |
104 |
- $LD = "clang -Wl,-arch_multiple $ARCH_FL -Wl,-all_load"; |
105 |
+ $LD = "$LD -Wl,-arch_multiple $ARCH_FL -Wl,-all_load"; |
106 |
$LP = "$CPP $versionMin -Wl,-arch_multiple $ARCH_FL -Wl,-all_load"; |
107 |
} |
108 |
$ARX = 'ar x'; |
109 |
@@ -762,13 +779,13 @@ OS_ARCH = \$(shell perl \$(TOP)/setup/os |
110 |
# install paths |
111 |
EndText |
112 |
|
113 |
- L($F, "INST_BINDIR = $OPT{'bindir'}" ) if ($OPT{'bindir'}); |
114 |
- L($F, "INST_LIBDIR = $OPT{'libdir'}" ) if ($OPT{'libdir'}); |
115 |
- L($F, "INST_INCDIR = $OPT{'includedir'}" ) if ($OPT{'includedir'}); |
116 |
- L($F, "INST_SCHEMADIR = $OPT{'shemadir'}" ) if ($OPT{'shemadir'}); |
117 |
- L($F, "INST_SHAREDIR = $OPT{'sharedir'}" ) if ($OPT{'sharedir'}); |
118 |
- L($F, "INST_JARDIR = $OPT{'javadir'}" ) if ($OPT{'javadir'}); |
119 |
- L($F, "INST_PYTHONDIR = $OPT{'pythondir'}") if ($OPT{'pythondir'}); |
120 |
+ L($F, "INST_BINDIR = \$(DESTDIR)$OPT{'bindir'}" ) if ($OPT{'bindir'}); |
121 |
+ L($F, "INST_LIBDIR = \$(DESTDIR)$OPT{'libdir'}" ) if ($OPT{'libdir'}); |
122 |
+ L($F, "INST_INCDIR = \$(DESTDIR)$OPT{'includedir'}" ) if ($OPT{'includedir'}); |
123 |
+ L($F, "INST_SCHEMADIR = \$(DESTDIR)$OPT{'shemadir'}" ) if ($OPT{'shemadir'}); |
124 |
+ L($F, "INST_SHAREDIR = \$(DESTDIR)$OPT{'sharedir'}" ) if ($OPT{'sharedir'}); |
125 |
+ L($F, "INST_JARDIR = \$(DESTDIR)$OPT{'javadir'}" ) if ($OPT{'javadir'}); |
126 |
+ L($F, "INST_PYTHONDIR = \$(DESTDIR)$OPT{'pythondir'}") if ($OPT{'pythondir'}); |
127 |
|
128 |
my ($E_VERSION_SHLX, $VERSION_SHLX, |
129 |
$E_MAJVERS_SHLX , $MAJMIN_SHLX, $MAJVERS_SHLX); |
130 |
@@ -832,7 +849,7 @@ MAJMIN_EXEX = \$(EXEX).\$(MAJMIN) |
131 |
MAJVERS_EXEX = \$(EXEX).\$(MAJVERS) |
132 |
|
133 |
# system architecture and wordsize |
134 |
-ARCH = $ARCH |
135 |
+override ARCH = $ARCH |
136 |
EndText |
137 |
|
138 |
L($F, "# ARCH = $ARCH ( $MARCH )") if ($ARCH ne $MARCH); |
139 |
@@ -867,7 +884,7 @@ EndText |
140 |
} |
141 |
L($F, "PIC = $PIC") if ($PIC); |
142 |
if ($PKG{LNG} eq 'C') { |
143 |
- if ($TOOLS =~ /clang/i) { |
144 |
+ if ($OSTYPE =~ /darwin/i) { |
145 |
L($F, 'SONAME = -install_name ' . |
146 |
'$(INST_LIBDIR)$(BITS)/$(subst $(VERSION),$(MAJVERS),$(@F)) \\'); |
147 |
L($F, ' -compatibility_version $(MAJMIN) -current_version $(VERSION) \\'); |
148 |
@@ -978,7 +995,7 @@ EndText |
149 |
L($F, '# directory rules'); |
150 |
if ($PKG{LNG} eq 'C') { |
151 |
L($F, '$(BINDIR) $(LIBDIR) $(ILIBDIR) ' |
152 |
- . '$(OBJDIR) $(INST_LIBDIR) $(INST_LIBDIR)$(BITS):'); |
153 |
+ . '$(OBJDIR) $(INST_LIBDIR):'); |
154 |
T($F, 'mkdir -p $@'); |
155 |
} elsif ($PKG{LNG} eq 'JAVA') { |
156 |
# test if we have jni header path |
157 |
@@ -1008,12 +1025,12 @@ EndText |
158 |
L($F, 'export CONFIGURE_FOUND_XML2'); |
159 |
L($F); |
160 |
|
161 |
- if ($OS eq 'linux' || $OS eq 'mac') { |
162 |
+ if ($OS eq 'linux' || $OS eq 'bsd' || $OS eq 'mac') { |
163 |
L($F, '# installation rules'); |
164 |
L($F, |
165 |
- '$(INST_LIBDIR)$(BITS)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)'); |
166 |
+ '$(INST_LIBDIR)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)'); |
167 |
T($F, '@ echo -n "installing \'$(@F)\'... "'); |
168 |
- T($F, '@ if cp $^ $@ && chmod 644 $@; \\'); |
169 |
+ T($F, '@ if $(BSD_INSTALL_DATA) $^ $@; \\'); |
170 |
T($F, ' then \\'); |
171 |
T($F, ' rm -f $(patsubst %$(VERSION),%$(MAJVERS),$@) ' |
172 |
. '$(patsubst %$(VERSION_LIBX),%$(LIBX),$@) ' |
173 |
@@ -1022,7 +1039,7 @@ EndText |
174 |
T($F, ' ln -s $(patsubst %$(VERSION),%$(MAJVERS),$(@F)) ' |
175 |
. '$(patsubst %$(VERSION_LIBX),%$(LIBX),$@); \\'); |
176 |
T($F, ' ln -s $(patsubst %$(VERSION_LIBX),%$(LIBX),$(@F)) ' . |
177 |
- '$(INST_LIBDIR)$(BITS)/$(patsubst %.$(VERSION_LIBX),%-static.$(LIBX),$(@F));' |
178 |
+ '$(INST_LIBDIR)/$(patsubst %.$(VERSION_LIBX),%-static.$(LIBX),$(@F));' |
179 |
. ' \\'); |
180 |
T($F, ' echo success; \\'); |
181 |
T($F, ' else \\'); |
182 |
@@ -1032,15 +1049,15 @@ EndText |
183 |
L($F); |
184 |
|
185 |
L($F, |
186 |
- '$(INST_LIBDIR)$(BITS)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)'); |
187 |
+ '$(INST_LIBDIR)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)'); |
188 |
T($F, '@ echo -n "installing \'$(@F)\'... "'); |
189 |
- T($F, '@ if cp $^ $@ && chmod 755 $@; \\'); |
190 |
+ T($F, '@ if $(BSD_INSTALL_LIB) $^ $@; \\'); |
191 |
T($F, ' then \\'); |
192 |
if ($OS ne 'mac') { |
193 |
T($F, ' rm -f $(patsubst %$(VERSION),%$(MAJVERS),$@) ' |
194 |
. '$(patsubst %$(VERSION_SHLX),%$(SHLX),$@); \\'); |
195 |
} |
196 |
- if ($OS eq 'linux') { |
197 |
+ if ($OS eq 'linux' || $OS eq 'bsd') { |
198 |
T($F, ' ln -s $(@F) $(patsubst %$(VERSION),%$(MAJVERS),$@); \\'); |
199 |
} elsif ($OS eq 'mac') { |
200 |
T($F, ' ln -sf $(@F) ' |
201 |
@@ -1059,7 +1076,7 @@ EndText |
202 |
|
203 |
L($F, '$(INST_BINDIR)/%$(VERSION_EXEX): $(BINDIR)/%$(VERSION_EXEX)'); |
204 |
T($F, '@ echo -n "installing \'$(@F)\'... "'); |
205 |
- T($F, '@ if cp $^ $@ && chmod 755 $@; \\'); |
206 |
+ T($F, '@ if $(BSD_INSTALL_PROGRAM) $^ $@; \\'); |
207 |
T($F, ' then \\'); |
208 |
T($F, ' rm -f $(patsubst %$(VERSION),%$(MAJVERS),$@) ' |
209 |
. '$(patsubst %$(VERSION_EXEX),%$(EXEX),$@); \\'); |
210 |
@@ -1341,7 +1358,7 @@ sub find_in_dir { |
211 |
++$found; |
212 |
} |
213 |
if (! $found) { |
214 |
- my $libdir = File::Spec->catdir($dir, 'lib' . $BITS); |
215 |
+ my $libdir = File::Spec->catdir($dir, 'lib'); |
216 |
my $f = File::Spec->catdir($libdir, $lib); |
217 |
print "\tchecking $f\n\t" if ($OPT{'debug'}); |
218 |
if (-e $f) { |
219 |
@@ -1483,12 +1500,12 @@ sub find_lib { |
220 |
|
221 |
sub check_compiler { |
222 |
my ($t, $n, $I, @l) = @_; |
223 |
- my $tool = $TOOLS; |
224 |
+ my $tool = $CC; |
225 |
|
226 |
if ($t eq 'L') { |
227 |
print "checking for $n library... "; |
228 |
} elsif ($t eq 'O') { |
229 |
- if ($tool && ($tool =~ /gcc$/ || $tool =~ /g\+\+$/)) { |
230 |
+ if ($tool && ($tool =~ /gcc/ || $tool =~ /g\+\+/)) { |
231 |
print "checking whether $tool accepts $n... "; |
232 |
} else { |
233 |
return; |
234 |
@@ -1518,6 +1535,9 @@ sub check_compiler { |
235 |
} elsif ($n eq 'magic') { |
236 |
$library = '-lmagic'; |
237 |
$log = '#include <magic.h> \n int main() { magic_open (0); }\n' |
238 |
+ } elsif ($n eq 'mbedtls') { |
239 |
+ $library = '-lmbedtls'; |
240 |
+ $log = '#include <mbedtls/version.h> \n int main() { mbedtls_version_get_string(0); }\n' |
241 |
} elsif ($n eq 'xml2') { |
242 |
$library = '-lxml2'; |
243 |
$library .= ' -liconv' if ($OS eq 'mac'); |
244 |
@@ -1554,7 +1574,7 @@ sub check_compiler { |
245 |
my $l = $l [ $i ]; |
246 |
next if ( $l && ! -d $l ); |
247 |
my $gcc = "| $tool -xc $flags " . ($I ? "-I$I " : ' ') |
248 |
- . ($l ? "-L$l " : ' ') . "- $library"; |
249 |
+ . ($l ? "-L$l " : ' ') . "-o a.out - $library"; |
250 |
$gcc .= ' 2> /dev/null' unless ($OPT{'debug'}); |
251 |
|
252 |
open GCC, $gcc or last; |