Makefile 1.23 KB
Newer Older
Snir Sheriber's avatar
Snir Sheriber committed
1 2 3 4
# This Makefile script is invoked by copr to build source rpm
# See: https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm

PROTOCOL_GIT_REPO = https://gitlab.freedesktop.org/spice/spice-protocol
5
BUILD = xz git rpm-build meson
Snir Sheriber's avatar
Snir Sheriber committed
6 7 8 9 10 11

srpm:
	dnf install -y $(BUILD)

	# get upstream spice protocol
	git clone $(PROTOCOL_GIT_REPO)
Frediano Ziglio's avatar
Frediano Ziglio committed
12 13
	meson --buildtype=release spice-protocol build-spice-protocol --prefix=/usr --werror
	ninja -C build-spice-protocol install
Snir Sheriber's avatar
Snir Sheriber committed
14 15 16 17

	# get other dependencies for project excluding spice-protocol
	dnf install -y `sed '/^BuildRequires:/!d; s/.*://; s/\bspice-protocol\b//; s/>.*//' *.spec.in`

Frediano Ziglio's avatar
Frediano Ziglio committed
18 19 20
	# set project version
	sed -i -E "s/^( +version : )'[0-9\.]+'/\\1'$$(date +'%Y%m%d%H%M.spice.latest')'/" meson.build
	git add meson.build
21 22
	git config --local user.email "dummy@dummy.com"
	git config --local user.name "dummy"
Frediano Ziglio's avatar
Frediano Ziglio committed
23 24
	git commit -m 'automatic version update'

Snir Sheriber's avatar
Snir Sheriber committed
25
	# create source rpm
Frediano Ziglio's avatar
Frediano Ziglio committed
26
	rm -rf build && mkdir build
27
	git submodule update --init --recursive
Frediano Ziglio's avatar
Frediano Ziglio committed
28 29 30 31
	meson . build --prefix=/usr --werror
	if ! test -r ../spice-common.git; then DIR=`basename "$$PWD"`; ln -s "$$DIR/.git/modules/spice-common" ../spice-common.git; fi
	ninja -C build dist
	rpmbuild -ts build/meson-dist/spice-streaming-agent-*.tar.xz --define "_srcrpmdir $(outdir)"