-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautogen
executable file
·261 lines (232 loc) · 7.94 KB
/
autogen
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
#! /bin/sh -
#
# Copyright (C) 2021 Stealth Software Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# This script uses the SST Bash library to bootstrap from /bin/sh into
# bash. See the Bash library > Bootstrapping section of the SST manual
# for more information.
#
#-----------------------------------------------------------------------
# Load the prelude
#-----------------------------------------------------------------------
case $0 in /*) x=$0 ;; *) x=./$0 ;; esac
r='\(.*/\)'
x=`expr "$x" : "$r"`. || exit $?
set -e || exit $?
. "$x/src/bash/prelude.bash"
#-----------------------------------------------------------------------
autogen_ac_start build-aux/autogen.ac
autogen_am_start build-aux/autogen.am
#-----------------------------------------------------------------------
# Loose distributed files
#-----------------------------------------------------------------------
#
# If a file needs to be distributed and there's no more specific place
# to do it, then do it here.
#
sst_am_distribute_if_not_dir \
.github/** \
ATTRIBUTIONS.adoc \
CircuitBuilderREADME.adoc \
LICENSE \
README.adoc \
build-aux/gatbps-gen-date.sh \
build-aux/gatbps-gen-date.sh.cache \
build-aux/gatbps-gen-libtool-c.sh \
build-aux/gatbps-gen-libtool-c.sh.cache \
build-aux/gatbps-gen-version.sh \
build-aux/gatbps-gen-version.sh.args \
build-aux/gatbps-gen-version.sh.cache \
src/aar/build.gradle \
src/aar/gradle.properties \
src/aar/gradle/wrapper/gradle-wrapper.jar \
src/aar/gradle/wrapper/gradle-wrapper.properties \
src/aar/gradlew \
src/aar/gradlew.bat \
src/aar/pulsar-mpc/src/main/AndroidManifest.xml \
src/aar/pulsar-mpc/src/main/java/com/stealthsoftwareinc/bmc/MpcTask.java \
src/aar/settings.gradle \
src/bash/functions/** \
src/bash/prelude.bash \
src/circuits/** \
src/com/**/*.java \
src/pulsar-mpc-aar.dockerfile \
;
#-----------------------------------------------------------------------
sst_ajh_download build-aux/downloads
sst_ajh_gitbundle build-aux/gitbundles
#-----------------------------------------------------------------------
declare -A archs
archs=(
[aarch64]=arm64-v8a
[x86_64]=x86_64
)
readonly archs
apis=(
27
)
readonly apis
#-----------------------------------------------------------------------
for ARCH in ${!archs[@]}; do
for LEVEL in ${apis[@]}; do
sed \
"
s/@ARCH@/$ARCH/g
s/@LEVEL@/$LEVEL/g
" \
<parcels/pulsar-mpc-ARCH-linux-android-apiLEVEL-1.ac \
>parcels/pulsar-mpc-$ARCH-linux-android-api$LEVEL.ac \
;
sst_ac_include parcels/pulsar-mpc-$ARCH-linux-android-api$LEVEL.ac
sed \
"
s/@ARCH@/$ARCH/g
s/@LEVEL@/$LEVEL/g
" \
<parcels/pulsar-mpc-ARCH-linux-android-apiLEVEL-1.am \
>parcels/pulsar-mpc-$ARCH-linux-android-api$LEVEL.am \
;
sst_am_include parcels/pulsar-mpc-$ARCH-linux-android-api$LEVEL.am
mkdir -p \
parcels/pulsar-mpc-$ARCH-linux-android-api$LEVEL/builder \
;
ln -s \
../../pulsar-mpc-ARCH-linux-android-apiLEVEL-1/builder/Dockerfile \
parcels/pulsar-mpc-$ARCH-linux-android-api$LEVEL/builder/Dockerfile \
;
sst_am_distribute \
parcels/pulsar-mpc-$ARCH-linux-android-api$LEVEL/builder/Dockerfile \
;
done
done
#-----------------------------------------------------------------------
for arch in ${!archs[@]}; do
for api in ${apis[@]}; do
src=pulsar-mpc-'$(PACKAGE_VERSION)'-$arch-linux-android-api$api
sst_ihs <<<'
pulsar-mpc-$(PACKAGE_VERSION)-android: parcels/'"$src"'.tar
' | sst_am_append
done
done
sst_ihs <<<'
pulsar-mpc-$(PACKAGE_VERSION)-android:
$(AM_V_at)$(GATBPS_RECIPE_MARKER_TOP)
$(AM_V_at)rm -f -r ./$@$(TSUF)* ./$@
$(AM_V_at)$(MKDIR_P) $@$(TSUF)1
$(AM_V_at)$(MKDIR_P) $@$(TSUF)2/$@
$(AM_V_at){ \
out=$@$(TSUF)2/$@; \
for arch in '"${!archs[@]}"'; do \
for api in '"${apis[@]}"'; do \
src=pulsar-mpc-$(PACKAGE_VERSION)-$$arch-linux-android-api$$api; \
dst=$$out/lib/$$arch-linux-android-api$$api; \
cp parcels/$$src.tar $@$(TSUF)1 || exit $$?; \
(cd $@$(TSUF)1 && tar xf $$src.tar) || exit $$?; \
$(MKDIR_P) $$dst || exit $$?; \
rmdir $$dst || exit $$?; \
cp -L -R $@$(TSUF)1/$$src/shared/usr/lib $$dst || exit $$?; \
if test -d $$out/circuits; then \
:; \
else \
cp -L -R $@$(TSUF)1/$$src/circuits $$out || exit $$?; \
fi; \
done; \
done; \
src=src/com/stealthsoftwareinc/bmc; \
dst=$$out/com/stealthsoftwareinc/bmc; \
$(MKDIR_P) $$dst || exit $$?; \
cp $$src/MpcTask.java $$dst || exit $$?; \
for x in \
$$out/circuits/* \
$$out/lib/*/* \
; do \
if test -f $$x; then \
printf %s\\n "PULSAR-MPC $(PACKAGE_VERSION)" >$$x.version || exit $$?; \
fi; \
done; \
}
$(AM_V_at)mv -f $@$(TSUF)2 $@
$(AM_V_at)-rm -f -r ./$@$(TSUF)*
$(AM_V_at)$(GATBPS_RECIPE_MARKER_BOT)
' | sst_am_append
sst_ihs <<<'
GATBPS_TAR(
[pulsar-mpc-$(PACKAGE_VERSION)-android.tar],
[pulsar-mpc-$(PACKAGE_VERSION)-android],
[directory_contents])
GATBPS_XZ(
[pulsar-mpc-$(PACKAGE_VERSION)-android.tar.xz],
[pulsar-mpc-$(PACKAGE_VERSION)-android.tar])
' | sst_ac_append
#-----------------------------------------------------------------------
# TODO: This is missing proper src/aar prerequisites.
sst_ihs <<<'
pulsar-mpc-$(PACKAGE_VERSION).aar: pulsar-mpc-$(PACKAGE_VERSION)-android.tar
pulsar-mpc-$(PACKAGE_VERSION).aar: build-aux/downloads/android-commandlinetools-linux-7583922_latest.zip
pulsar-mpc-$(PACKAGE_VERSION).aar: src/pulsar-mpc-aar.dockerfile
$(AM_V_at)$(GATBPS_RECIPE_MARKER_TOP)
$(AM_V_at)rm -f -r ./$@$(TSUF)* ./$@
$(AM_V_at)$(MKDIR_P) $@$(TSUF)1
$(AM_V_at){ \
cp \
pulsar-mpc-$(PACKAGE_VERSION)-android.tar \
$@$(TSUF)1/pulsar-mpc.tar \
|| exit $$?; \
cp \
build-aux/downloads/android-commandlinetools-linux-7583922_latest.zip \
$@$(TSUF)1/tools.zip \
|| exit $$?; \
cp \
src/pulsar-mpc-aar.dockerfile \
$@$(TSUF)1/Dockerfile \
|| exit $$?; \
cp -L -R \
src/aar \
$@$(TSUF)1/aar \
|| exit $?; \
$(DOCKER) build \
--build-arg api='${apis[0]}' \
$${GITHUB_ACTOR:+--build-arg GITHUB_ACTOR="$$GITHUB_ACTOR"} \
$${GITHUB_MAVEN_PKG_URL:+--build-arg GITHUB_MAVEN_PKG_URL="$$GITHUB_MAVEN_PKG_URL"} \
$${GITHUB_TOKEN:+--build-arg GITHUB_TOKEN="$$GITHUB_TOKEN"} \
--tag tmp$$$$ \
$@$(TSUF)1 \
|| exit $$?; \
$(DOCKER) create \
--name tmp$$$$ \
tmp$$$$ \
|| exit $$?; \
$(DOCKER) cp \
tmp$$$$:/x/pulsar-mpc-release.aar \
$@$(TSUF)2 \
|| exit $$?; \
}
$(AM_V_at)mv -f $@$(TSUF)2 $@
$(AM_V_at)-rm -f -r ./$@$(TSUF)*
$(AM_V_at)$(GATBPS_RECIPE_MARKER_BOT)
' | sst_am_append
#-----------------------------------------------------------------------
autogen_ac_finish
autogen_am_finish
autoreconf -f -i -v -W all