aboutsummaryrefslogtreecommitdiff
path: root/examples/mswin-build/mkprerelease
blob: 7562c8557501f70c6a34a7c112e0de5ccfe487ca (plain)
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
#!/bin/sh
#
# Build busybox prerelease binaries
#
TARGETS="build_pre_32 build_pre_64 build_pre_64a build_pre_64u"

# If an argument is supplied it overrides the default source directory.
SRC=busybox-w32
if [ $# -eq 1 ]
then
	SRC=$1
fi

if [ ! -d $SRC ]
then
	echo "$SRC doesn't exist"
	exit 0
fi

# remove old and make new build directories
for i in $TARGETS
do
	rm -rf $i
	cp -rp $SRC $i
done

# apply default configuration
for i in $TARGETS
do
	(
		if [ $i = "build_pre_64" ]
		then
			CONFIG=mingw64_defconfig
		elif [ $i = "build_pre_64u" ]
		then
			CONFIG=mingw64u_defconfig
		elif [ $i = "build_pre_64a" ]
		then
			CONFIG=mingw64a_defconfig
			PATH="/data2/llvm/current/bin:$PATH"
		elif [ $i = "build_pre_32" ]
		then
			CONFIG=mingw32_defconfig
		fi

		cd $i
		git checkout master
		SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \
			make ${CONFIG}
	)
done

# perform build
for i in $TARGETS
do
	BITS=64
	if [ $i = "build_pre_32" ]
	then
		BITS=32;
	fi

	(
	cd $i
	if [ $i = "build_pre_64a" ]
	then
		# /data2/llvm/current should be a symlink
		PATH="/data2/llvm/current/bin:$PATH"
		VERSION=$(readlink /data2/llvm/current)
	else
		GCCV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-gcc)
		CRTV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt)
		VERSION="$GCCV; $CRTV"
	fi
	SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \
		make -j $(nproc) EXTRAVERSION="-$(git describe --match=FRP | sed 's/FRP/PRE/')" MINGW_VER="$VERSION"
	)
done

# Check the expected binaries exist
echo
for i in $TARGETS
do
	ls -l $i/busybox.exe
done