Line 0
Link Here
|
|
|
1 |
--- setup/konfigure.perl.orig 2016-10-07 21:59: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 |
+ $ARCH_FL = '-arch i386' if ($OSTYPE =~ /darwin/i && $BITS == 32); |
95 |
$OPT = '-O3'; |
96 |
$AR = 'ar rc'; |
97 |
- $LD = "clang $ARCH_FL"; |
98 |
+ $LD = "$LD $ARCH_FL"; |
99 |
$LP = "$CPP $versionMin $ARCH_FL"; |
100 |
} else { |
101 |
$MAKE_MANIFEST = '( echo "$^" > $@/manifest )'; |
102 |
$ARCH_FL = '-arch i386 -arch x86_64'; |
103 |
$OPT = '-O3'; |
104 |
$AR = 'libtool -static -o'; |
105 |
- $LD = "clang -Wl,-arch_multiple $ARCH_FL -Wl,-all_load"; |
106 |
+ $LD = "$LD -Wl,-arch_multiple $ARCH_FL -Wl,-all_load"; |
107 |
$LP = "$CPP $versionMin -Wl,-arch_multiple $ARCH_FL -Wl,-all_load"; |
108 |
} |
109 |
$ARX = 'ar x'; |
110 |
@@ -755,13 +772,13 @@ OS_ARCH = \$(shell perl \$(TOP)/setup/os |
111 |
# install paths |
112 |
EndText |
113 |
|
114 |
- L($F, "INST_BINDIR = $OPT{'bindir'}" ) if ($OPT{'bindir'}); |
115 |
- L($F, "INST_LIBDIR = $OPT{'libdir'}" ) if ($OPT{'libdir'}); |
116 |
- L($F, "INST_INCDIR = $OPT{'includedir'}" ) if ($OPT{'includedir'}); |
117 |
- L($F, "INST_SCHEMADIR = $OPT{'shemadir'}" ) if ($OPT{'shemadir'}); |
118 |
- L($F, "INST_SHAREDIR = $OPT{'sharedir'}" ) if ($OPT{'sharedir'}); |
119 |
- L($F, "INST_JARDIR = $OPT{'javadir'}" ) if ($OPT{'javadir'}); |
120 |
- L($F, "INST_PYTHONDIR = $OPT{'pythondir'}") if ($OPT{'pythondir'}); |
121 |
+ L($F, "INST_BINDIR = \$(DESTDIR)$OPT{'bindir'}" ) if ($OPT{'bindir'}); |
122 |
+ L($F, "INST_LIBDIR = \$(DESTDIR)$OPT{'libdir'}" ) if ($OPT{'libdir'}); |
123 |
+ L($F, "INST_INCDIR = \$(DESTDIR)$OPT{'includedir'}" ) if ($OPT{'includedir'}); |
124 |
+ L($F, "INST_SCHEMADIR = \$(DESTDIR)$OPT{'shemadir'}" ) if ($OPT{'shemadir'}); |
125 |
+ L($F, "INST_SHAREDIR = \$(DESTDIR)$OPT{'sharedir'}" ) if ($OPT{'sharedir'}); |
126 |
+ L($F, "INST_JARDIR = \$(DESTDIR)$OPT{'javadir'}" ) if ($OPT{'javadir'}); |
127 |
+ L($F, "INST_PYTHONDIR = \$(DESTDIR)$OPT{'pythondir'}") if ($OPT{'pythondir'}); |
128 |
|
129 |
my ($E_VERSION_SHLX, $VERSION_SHLX, |
130 |
$E_MAJVERS_SHLX , $MAJMIN_SHLX, $MAJVERS_SHLX); |
131 |
@@ -825,7 +842,7 @@ MAJMIN_EXEX = \$(EXEX).\$(MAJMIN) |
132 |
MAJVERS_EXEX = \$(EXEX).\$(MAJVERS) |
133 |
|
134 |
# system architecture and wordsize |
135 |
-ARCH = $ARCH |
136 |
+override ARCH = $ARCH |
137 |
EndText |
138 |
|
139 |
L($F, "# ARCH = $ARCH ( $MARCH )") if ($ARCH ne $MARCH); |
140 |
@@ -860,7 +877,7 @@ EndText |
141 |
} |
142 |
L($F, "PIC = $PIC") if ($PIC); |
143 |
if ($PKG{LNG} eq 'C') { |
144 |
- if ($TOOLS =~ /clang/i) { |
145 |
+ if ($OSTYPE =~ /darwin/i) { |
146 |
L($F, 'SONAME = -install_name ' . |
147 |
'$(INST_LIBDIR)$(BITS)/$(subst $(VERSION),$(MAJVERS),$(@F)) \\'); |
148 |
L($F, ' -compatibility_version $(MAJMIN) -current_version $(VERSION) \\'); |
149 |
@@ -884,7 +901,7 @@ EndText |
150 |
} |
151 |
} |
152 |
if ($PKG{LNG} eq 'C') { |
153 |
- L($F, "CFLAGS = \$(DBG) \$(OPT) \$(INCDIRS) $MD $ARCH_FL"); |
154 |
+ L($F, "CFLAGS += \$(DBG) \$(OPT) \$(INCDIRS) $MD $ARCH_FL"); |
155 |
} |
156 |
L($F, "LDFLAGS = $LDFLAGS") if ($LDFLAGS); |
157 |
|
158 |
@@ -970,7 +987,7 @@ EndText |
159 |
L($F, '# directory rules'); |
160 |
if ($PKG{LNG} eq 'C') { |
161 |
L($F, '$(BINDIR) $(LIBDIR) $(ILIBDIR) ' |
162 |
- . '$(OBJDIR) $(INST_LIBDIR) $(INST_LIBDIR)$(BITS):'); |
163 |
+ . '$(OBJDIR) $(INST_LIBDIR):'); |
164 |
T($F, 'mkdir -p $@'); |
165 |
} elsif ($PKG{LNG} eq 'JAVA') { |
166 |
# test if we have jni header path |
167 |
@@ -1000,12 +1017,12 @@ EndText |
168 |
L($F, 'export CONFIGURE_FOUND_XML2'); |
169 |
L($F); |
170 |
|
171 |
- if ($OS eq 'linux' || $OS eq 'mac') { |
172 |
+ if ($OS eq 'linux' || $OS eq 'bsd' || $OS eq 'mac') { |
173 |
L($F, '# installation rules'); |
174 |
L($F, |
175 |
- '$(INST_LIBDIR)$(BITS)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)'); |
176 |
+ '$(INST_LIBDIR)/%.$(VERSION_LIBX): $(LIBDIR)/%.$(VERSION_LIBX)'); |
177 |
T($F, '@ echo -n "installing \'$(@F)\'... "'); |
178 |
- T($F, '@ if cp $^ $@ && chmod 644 $@; \\'); |
179 |
+ T($F, '@ if $(BSD_INSTALL_DATA) $^ $@; \\'); |
180 |
T($F, ' then \\'); |
181 |
T($F, ' rm -f $(patsubst %$(VERSION),%$(MAJVERS),$@) ' |
182 |
. '$(patsubst %$(VERSION_LIBX),%$(LIBX),$@) ' |
183 |
@@ -1014,7 +1031,7 @@ EndText |
184 |
T($F, ' ln -s $(patsubst %$(VERSION),%$(MAJVERS),$(@F)) ' |
185 |
. '$(patsubst %$(VERSION_LIBX),%$(LIBX),$@); \\'); |
186 |
T($F, ' ln -s $(patsubst %$(VERSION_LIBX),%$(LIBX),$(@F)) ' . |
187 |
- '$(INST_LIBDIR)$(BITS)/$(patsubst %.$(VERSION_LIBX),%-static.$(LIBX),$(@F));' |
188 |
+ '$(INST_LIBDIR)/$(patsubst %.$(VERSION_LIBX),%-static.$(LIBX),$(@F));' |
189 |
. ' \\'); |
190 |
T($F, ' echo success; \\'); |
191 |
T($F, ' else \\'); |
192 |
@@ -1024,15 +1041,15 @@ EndText |
193 |
L($F); |
194 |
|
195 |
L($F, |
196 |
- '$(INST_LIBDIR)$(BITS)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)'); |
197 |
+ '$(INST_LIBDIR)/%.$(VERSION_SHLX): $(LIBDIR)/%.$(VERSION_SHLX)'); |
198 |
T($F, '@ echo -n "installing \'$(@F)\'... "'); |
199 |
- T($F, '@ if cp $^ $@ && chmod 755 $@; \\'); |
200 |
+ T($F, '@ if $(BSD_INSTALL_LIB) $^ $@; \\'); |
201 |
T($F, ' then \\'); |
202 |
if ($OS ne 'mac') { |
203 |
T($F, ' rm -f $(patsubst %$(VERSION),%$(MAJVERS),$@) ' |
204 |
. '$(patsubst %$(VERSION_SHLX),%$(SHLX),$@); \\'); |
205 |
} |
206 |
- if ($OS eq 'linux') { |
207 |
+ if ($OS eq 'linux' || $OS eq 'bsd') { |
208 |
T($F, ' ln -s $(@F) $(patsubst %$(VERSION),%$(MAJVERS),$@); \\'); |
209 |
} elsif ($OS eq 'mac') { |
210 |
T($F, ' ln -sf $(@F) ' |
211 |
@@ -1051,7 +1068,7 @@ EndText |
212 |
|
213 |
L($F, '$(INST_BINDIR)/%$(VERSION_EXEX): $(BINDIR)/%$(VERSION_EXEX)'); |
214 |
T($F, '@ echo -n "installing \'$(@F)\'... "'); |
215 |
- T($F, '@ if cp $^ $@ && chmod 755 $@; \\'); |
216 |
+ T($F, '@ if $(BSD_INSTALL_PROGRAM) $^ $@; \\'); |
217 |
T($F, ' then \\'); |
218 |
T($F, ' rm -f $(patsubst %$(VERSION),%$(MAJVERS),$@) ' |
219 |
. '$(patsubst %$(VERSION_EXEX),%$(EXEX),$@); \\'); |
220 |
@@ -1333,7 +1350,7 @@ sub find_in_dir { |
221 |
++$found; |
222 |
} |
223 |
if (! $found) { |
224 |
- my $libdir = File::Spec->catdir($dir, 'lib' . $BITS); |
225 |
+ my $libdir = File::Spec->catdir($dir, 'lib'); |
226 |
my $f = File::Spec->catdir($libdir, $lib); |
227 |
print "\tchecking $f\n\t" if ($OPT{'debug'}); |
228 |
if (-e $f) { |