Diff

Differences From Artifact [46b4f35d88]:

To Artifact [e5e03bff2f]:


1

















2
3
4
5
6
7
8
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

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







#! /usr/bin/env bash

upload='false'
for arg in "$@"; do
	case "${arg}" in
		--help)
			echo "Usage: build-precompiled [--upload]"
			exit 0
			;;
		--upload)
			upload='true'
			;;
		*)
			echo "Invalid argument \"${arg}\"" >&2
			exit 1
			;;
	esac
done

# Ensure we are in the correct working directory
cd "$(dirname "$(which "$0")")/.." || exit 1

# Determine the version of Filed
version=''
eval "$(( grep '^# *define  *FILED_VERSION' filed.c; echo '|version=FILED_VERSION' ) | cpp -E | grep '^|' | sed 's@^|@@')"
50
51
52
53
54
55
56

57
58
59



60






61
62
63
64
65
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







+


-
+
+
+

+
+
+
+
+
+





done

# Wait for that to get done
wait

# Rename the files into place
mkdir -p compiled
binaries=()
for binary in workdir-buildPrecompiled-*/filed; do
	platform="$(echo "${binary}" | sed 's@^.*-platform-@@;s@/.*$@@')"
	mv "${binary}" "compiled/filed-${version}-${platform}"
	binary_dest="compiled/filed-${version}-${platform}"
	mv "${binary}" "${binary_dest}"
	binaries+=("${binary_dest}")
done

if [ "${upload}" = 'true' ]; then
	for binary in "${binaries[@]}"; do
		fossil uv add "${binary}" --as "releases/${version}/$(basename "${binary}")"
	done
fi

# Cleanup
rm -rf workdir-buildPrecompiled-*

exit 0