-
Notifications
You must be signed in to change notification settings - Fork 9
/
Confix2.dir
executable file
·337 lines (312 loc) · 12.6 KB
/
Confix2.dir
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
IGNORE_FILE('config.h')
ADD_EXTRA_DIST('ReleaseNotes.txt')
PARITYsupported_archs = ''
PARITYsupported_versions = ''
PARITYsupported_runtimes = ''
parity_setup_in = open('parity.setup/parity-setup.in', 'r')
for line in parity_setup_in.readlines():
line = line.strip()
if line.startswith('PARITYsupported_archs="'):
if not line.startswith('PARITYsupported_archs="@'):
PARITYsupported_archs=line.split('"')[1]
if line.startswith('PARITYsupported_versions="'):
if not line.startswith('PARITYsupported_versions="@'):
PARITYsupported_versions=line.split('"')[1]
if line.startswith('PARITYsupported_runtimes="'):
if not line.startswith('PARITYsupported_runtimes="@'):
PARITYsupported_runtimes=line.split('"')[1]
if PARITYsupported_archs and PARITYsupported_versions and PARITYsupported_runtimes:
break
parity_setup_in = None
CONFIGURE_AC(
lines=['AC_CONFIG_FILES( \
parity.setup/parity-setup \
parity.setup/parity-environment.sh \
parity.gnu.ar/parity.gnu.ar \
parity.gnu.nm/parity.gnu.dumpbin \
parity.gnu.nm/parity.gnu.nm \
parity.ms.link/parity.ms.lib \
parity.ms.link/parity.ms.nmake \
parity.ms.link/parity.ms.rc \
)'],
order=AC_BOILERPLATE)
acm4 = ''
acm4 += 'AC_DEFUN([PARITY_KNOWN_MSVC_ARCHS], [' + PARITYsupported_archs + '])\n'
acm4 += 'AC_DEFUN([PARITY_KNOWN_MSVC_ARCHS_CS], [' + PARITYsupported_archs .replace(' ', ',') + '])\n'
acm4 += 'AC_DEFUN([PARITY_KNOWN_MSVC_VERSIONS], [' + PARITYsupported_versions + '])\n'
acm4 += 'AC_DEFUN([PARITY_KNOWN_MSVC_VERSIONS_CS], [' + PARITYsupported_versions.replace(' ', ',') + '])\n'
acm4 += 'AC_DEFUN([PARITY_KNOWN_MSVC_RUNTIMES], [' + PARITYsupported_runtimes + '])\n'
acm4 += 'AC_DEFUN([PARITY_KNOWN_MSVC_RUNTIMES_CS], [' + PARITYsupported_runtimes.replace(' ', ',') + '])\n'
acm4 += """
AC_DEFUN([PARITY_DIR], [
prefix_NONE=
exec_prefix_NONE=
test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
eval ac_define_dir="\"[$]$2\""
eval ac_define_dir="\"$ac_define_dir\""
AC_SUBST($1, "$ac_define_dir")
AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
test "$prefix_NONE" && prefix=NONE
test "$exec_prefix_NONE" && exec_prefix=NONE
])
AC_DEFUN([PARITY_CONFIGURE],
[
PARITY_DIR([PARITY_SYSCONFDIR], ['${sysconfdir}/${PACKAGE}'],
[Path where user specific configuration is installed])
PARITY_DIR([PARITY_LOCALSTATEDIR], ['${localstatedir}/${PACKAGE}'],
[Path where site specific configuration is maintained])
PARITY_DIR([PARITY_INCLUDEDIR], ['${libdir}/${PACKAGE}/include'],
[Path where internal header files are installed])
PARITY_DIR([PARITY_LIBDIR], ['${libdir}/${PACKAGE}'],
[Path where internal libraries are installed])
PARITY_DIR([PARITY_LIBEXECDIR], ['${libexecdir}/${PACKAGE}'],
[Path where internal executables are installed])
PARITY_DIR([PARITY_BINDIR], ['${bindir}'],
[Path where executables are installed])
AC_SUBST([LN_S], [${as_ln_s}])
AC_MSG_CHECKING([for MSVC architectures to support])
AC_ARG_ENABLE([msvc-archs],
[AS_HELP_STRING([--enable-msvc-archs=@<:@PARITY_KNOWN_MSVC_ARCHS_CS@:>@],
[MSVC architectures to compile in support for. Default is all of them.])],
[enable_msvc_archs=$enableval],
[enable_msvc_archs="PARITY_KNOWN_MSVC_ARCHS_CS"])
parity_enabled_msvc_archs=
as_save_IFS=$IFS
IFS=", "
for parityarch in ${enable_msvc_archs:-PARITY_KNOWN_MSVC_ARCHS}
do
IFS=$as_save_IFS
AS_CASE([" ]PARITY_KNOWN_MSVC_ARCHS[ "],
[*" $parityarch "*], [],
[AS_CASE([$parityarch],
[yes|no], [AC_MSG_ERROR([Need specific argument to --enable-msvc-archs.])],
[AC_MSG_ERROR([Unknown argument $parityarch to --enable-msvc-archs.])])])
parity_enabled_msvc_archs="$parity_enabled_msvc_archs $parityarch "
done
IFS=$as_save_IFS
enable_msvc_archs=
# sort unique
for parityarch in PARITY_KNOWN_MSVC_ARCHS
do
AS_CASE([$parity_enabled_msvc_archs],
[*" $parityarch "*],
[AS_CASE([" $enable_msvc_archs "],
[*" $parityarch "*], [],
[" "], [enable_msvc_archs=$parityarch],
[enable_msvc_archs="$enable_msvc_archs $parityarch"])])
done
AC_SUBST([PARITY_SUPPORTED_ARCHS], [$enable_msvc_archs])
AC_MSG_RESULT([$PARITY_SUPPORTED_ARCHS])
AC_MSG_CHECKING([for MSVC versions to support])
AC_ARG_ENABLE([msvc-versions],
[AS_HELP_STRING([--enable-msvc-versions=@<:@PARITY_KNOWN_MSVC_VERSIONS_CS@:>@],
[MSVC versions to compile in support for. Defaults to all of them.])],
[enable_msvc_versions=$enableval],
[enable_msvc_versions="PARITY_KNOWN_MSVC_VERSIONS_CS"])
parity_enabled_msvc_versions=
as_save_IFS=$IFS
IFS=", "
for paritymsvcver in ${enable_msvc_versions:-PARITY_KNOWN_MSVC_VERSIONS}
do
IFS=$as_save_IFS
AS_CASE([" PARITY_KNOWN_MSVC_VERSIONS "],
[*" $paritymsvcver "*], [],
[AS_CASE([$paritymsvcver],
[yes|no], [AC_MSG_ERROR([Need specific argument to --enable-msvc-versions.])],
[AC_MSG_ERROR([Unknown argument $paritymsvcver to --enable-msvc-versions.])])])
parity_enabled_msvc_versions="$parity_enabled_msvc_versions $paritymsvcver "
done
IFS=$as_save_IFS
# sort unique
enable_msvc_versions=
for paritymsvcver in PARITY_KNOWN_MSVC_VERSIONS
do
AS_CASE([$parity_enabled_msvc_versions],
[*" $paritymsvcver "*],
[AS_CASE([" $enable_msvc_versions "],
[*" $paritymsvcver "*], [],
[" "], [enable_msvc_versions=$paritymsvcver],
[enable_msvc_versions="$enable_msvc_versions $paritymsvcver"])])
done
AC_SUBST([PARITY_SUPPORTED_VERSIONS], [$enable_msvc_versions])
AC_MSG_RESULT([$enable_msvc_versions])
AC_MSG_CHECKING([for MSVC runtime variants to support])
AC_ARG_ENABLE([msvc-runtimes],
[AS_HELP_STRING([--enable-msvc-runtimes=@<:@PARITY_KNOWN_MSVC_RUNTIMES_CS@:>@],
[MSVC runtimes to compile in support for. Defaults to all of them.])],
[enable_msvc_runtimes=$enableval],
[enable_msvc_runtimes="PARITY_KNOWN_MSVC_RUNTIMES_CS"])
parity_enabled_msvc_runtimes=
as_save_IFS=$IFS
IFS=", "
for paritymsvccrt in ${enable_msvc_runtimes:-PARITY_KNOWN_MSVC_RUNTIMES}
do
IFS=$as_save_IFS
AS_CASE([" PARITY_KNOWN_MSVC_RUNTIMES "],
[*" $paritymsvccrt "*], [],
[AS_CASE([$paritymsvccrt],
[yes|no], [AC_MSG_ERROR([Need specific argument to --enable-msvc-runtimes.])],
[AC_MSG_ERROR([Unknown argument $paritymsvccrt to --enable-msvc-runtimes.])])])
parity_enabled_msvc_runtimes="$parity_enabled_msvc_runtimes $paritymsvccrt "
done
IFS=$as_save_IFS
# sort unique
enable_msvc_runtimes=
for paritymsvccrt in PARITY_KNOWN_MSVC_RUNTIMES
do
AS_CASE([$parity_enabled_msvc_runtimes],
[*" $paritymsvccrt "*],
[AS_CASE([" $enable_msvc_runtimes "],
[*" $paritymsvccrt "*], [],
[" "], [enable_msvc_runtimes=$paritymsvccrt],
[enable_msvc_runtimes="$enable_msvc_runtimes $paritymsvccrt"])])
done
AC_SUBST([PARITY_SUPPORTED_RUNTIMES], [$enable_msvc_runtimes])
AC_MSG_RESULT([$enable_msvc_runtimes])
AC_MSG_CHECKING([whether to support distinct binary packages per CHOST])
AC_ARG_ENABLE([binpkg-per-chost],
[AS_HELP_STRING([--enable-binpkg-per-chost],
[Support distinct binary packages per CHOST.])],
[AS_CASE([$enable_binpkg_per_chost],
[yes], [enable_binpkg_per_chost=yes],
[enable_binpkg_per_chost=no])],
[enable_binpkg_per_chost=no])
AC_SUBST([PARITY_BINPKG_PER_CHOST], [$enable_binpkg_per_chost])
AC_MSG_RESULT([$enable_binpkg_per_chost])
AC_MSG_CHECKING([whether to support Remote EXecution service])
AC_ARG_WITH([default-remote-execution-support],
[AS_HELP_STRING([--with-remote-execution-support=[[yes|no|enabled|disabled]]],
[Support for Remote EXecution service (https://github.com/mduft/rex)
can be either always enabled (yes), completely disabled (no),
disabled later using parity-setup (enabled), or enabled later
using parity-setup (disabled, default).])],
[AS_CASE([$withval],[yes|no|enabled|disabled],[],
[AC_MSG_ERROR([Invalid argument to --with-default-remote-execution-support.])])],
[with_default_remote_execution_support=disabled])
AC_SUBST([PARITY_REX_SUPPORT], [$with_default_remote_execution_support])
AS_CASE([$with_default_remote_execution_support],
[yes],[AC_DEFINE([PARITY_REX_SUPPORT], [1 /* forced */], [Support Remote EXecution service])],
[*abled],[AC_DEFINE([PARITY_REX_SUPPORT], [0 /* probably */])])
AC_MSG_RESULT([$with_default_remote_execution_support])
])
"""
ACINCLUDE_M4(lines=[acm4])
CONFIGURE_AC(
lines=['PARITY_CONFIGURE'],
order=AC_PROGRAMS)
CONFIGURE_AC(
lines=['ACX_PTHREAD'],
order=AC_PROGRAMS)
import os
import re
_re_cfile = re.compile('^.*\\.(c|cc|cpp)$')
_re_hfile = re.compile('^.*\\.h$')
_re_invalid_variable_character = re.compile('[^a-zA-Z0-9]')
for dir in [
'parity.runtime',
'parity.runtime/internal',
'parity.runtime/sys',
'parity.loader',
]:
dirvar = re.sub(_re_invalid_variable_character, '_', dir)
MAKEFILE_AM(line=dirvar + 'dir = $(PARITY_LIBDIR)/' + dir)
MAKEFILE_AM(line=dirvar + 'includedir = $(PARITY_INCLUDEDIR)/' + dir)
ADD_EXTRA_DIST('$(' + dirvar + '_DATA)')
ADD_EXTRA_DIST('$(' + dirvar + 'include_DATA)')
libcfiles = []
libhfiles = []
for file in os.listdir(dir):
if os.path.isfile(dir + '/' + file):
if _re_cfile.match(file):
libcfiles.append(dir + '/' + file)
if _re_hfile.match(file):
libhfiles.append(dir + '/' + file)
MAKEFILE_AM(line=dirvar + '_DATA = ' + ' \\\n\t'.join(libcfiles))
MAKEFILE_AM(line=dirvar + 'include_DATA = ' + ' \\\n\t'.join(libhfiles))
MAKEFILE_AM(line='''
GNUCOMMANDS = \
gcc:gcc$(EXEEXT) \
g++:gcc$(EXEEXT) \
cpp:gcc$(EXEEXT):-E \
ld:ld$(EXEEXT) \
windres:windres$(EXEEXT) \
ar \
dumpbin \
nm \
ranlib \
strip
MSCOMMANDS = \
cl$(EXEEXT) \
link$(EXEEXT) \
lib$(EXEEXT):lib \
nmake$(EXEEXT):nmake \
rc$(EXEEXT):rc
install-setup-files: install-recursive
chosts=`"$(DESTDIR)$(bindir)/parity-setup" --list-supported`; \\
cd "$(DESTDIR)$(bindir)" || exit $$? ; \\
for chost in $${chosts} ; do \\
$(MKDIR_P) "$(DESTDIR)$(exec_prefix)/$${chost}/bin" || exit $$? ; \\
cd "$(DESTDIR)$(exec_prefix)/$${chost}/bin" || exit $$? ; \\
case $${chost%%-*} in \\
x64|x86_64|amd64) mopt=-m64 ;; \\
x86|i?86*) mopt=-m32 ;; \\
esac ; \\
case $${chost} in \\
*-libcmtd*) mcrt="libcmtd" ;; \\
*-libcmt*) mcrt="libcmt" ;; \\
*-msvcd*) mcrt="msvcd" ;; \\
*) mcrt="msvc" ;; \\
esac ; \\
mver=$${chost#*-$${mcrt}} ; \\
mver=$${mver%%-*} ; \\
mopt="$${mopt} -m$${mcrt}$${mver}" ; \\
for exe in $(GNUCOMMANDS) ; do \\
set -- `IFS=: eval 'echo $${exe}'` ; \\
out=$$1; shift ; \\
real=$${1-$${out}}; $${1+shift} ; \\
echo "creating $(DESTDIR)$(exec_prefix)/$${chost}/bin/$${out} for parity.gnu.$${real} $${mopt} $$*" ; \\
$(CC) $(CFLAGS) "$(DESTDIR)$(parity_runtimedir)/optswrap.c" -o $${out} -DWRAP_REALBIN="$(bindir)/parity.gnu.$${real}" -DWRAP_OPTIONS="$${mopt} $$*" || exit $$? ; \\
echo "creating $(DESTDIR)$(bindir)/$${chost}-$${out}" ; \\
cp -f $${out} "$(DESTDIR)$(bindir)/$${chost}-$${out}" || exit $$? ; \\
done ; \\
for exe in $(MSCOMMANDS) ; do \\
set -- `IFS=: eval 'echo $${exe}'` ; \\
out=$$1; shift ; \\
real=$${1-$${out}}; $${1+shift} ; \\
echo "creating $(DESTDIR)$(exec_prefix)/$${chost}/bin/$${out} for parity.ms.$${real} $${mopt} $$*" ; \\
$(CC) $(CFLAGS) "$(DESTDIR)$(parity_runtimedir)/optswrap.c" -o $${out} -DWRAP_REALBIN="$(bindir)/parity.ms.$${real}" -DWRAP_OPTIONS="$${mopt} $$*" || exit $$? ; \\
echo "creating $(DESTDIR)$(bindir)/$${chost}-$${out}" ; \\
cp -f $${out} "$(DESTDIR)$(bindir)/$${chost}-$${out}" || exit $$? ; \\
done ; \\
echo "creating $(DESTDIR)$(exec_prefix)/$${chost}/bin/cmd.exe" ; \\
$(CC) $(CFLAGS) "$(DESTDIR)$(parity_runtimedir)/optswrap.c" -o cmd.exe -DWRAP_REALBIN="`cygpath -S`/cmd.exe" -DWRAP_OPTIONS= || exit $$? ; \\
rm -f paritywrapper.c || exit $$? ; \\
done
$(MKDIR_P) "$(DESTDIR)$(localstatedir)"
"$(DESTDIR)$(bindir)/parity-setup" --destdir="$(DESTDIR)" --install
test -n "$(DESTDIR)" || "$(bindir)/parity-setup" --enable-all
test no = "$(PARITY_BINPKG_PER_CHOST)" || \\
sed -e '/^CHOSTS_TO_MANAGE=/s/builtin/installed/' -i "$(DESTDIR)$(bindir)/parity-setup"
install: install-setup-files
uninstall-setup-files:
chosts=`"$(DESTDIR)$(bindir)/parity-setup" --list-supported`; \\
for chost in $${chosts}; do \\
if cd "$(DESTDIR)$(bindir)" ; then \\
for exe in $(GNUCOMMANDS) $(MSCOMMANDS) ; do \\
set -- `IFS=: eval 'echo $${exe}'` ; \\
rm -f $${chost}-$$1 ; \\
done ; \\
fi ; \\
if cd "$(DESTDIR)$(exec_prefix)/$${chost}/bin" ; then \\
for exe in $(GNUCOMMANDS) $(MSCOMMANDS) ; do \\
set -- `IFS=: eval 'echo $${exe}'` ; \\
rm -f $$1 ; \\
done ; \\
rm -f cmd.exe ; \\
fi ; \\
done ; :
sed -e '/^CHOSTS_TO_MANAGE=/s/installed/builtin/' -i "$(DESTDIR)$(bindir)/parity-setup"
"$(DESTDIR)$(bindir)/parity-setup" --destdir="$(DESTDIR)" --uninstall ; :
uninstall-recursive: uninstall-setup-files
''')