Makefile 1.52 KB
Newer Older
Snir Sheriber's avatar
Snir Sheriber committed
1 2
# This Makefile script is invoked by copr to build source rpm
# See: https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm
Frediano Ziglio's avatar
Frediano Ziglio committed
3 4 5 6 7 8 9 10 11
#
# How to test/setup
# 1- login to Copr account
# 2- add a project setting the desired chroots (for testing copy the
#    one on official Copr project)
# 3- add a SCM build
#   a- URL: url of git repository
#   b- Committish: branch name to use, empty master
#   c- build with make_srpm
Snir Sheriber's avatar
Snir Sheriber committed
12 13

PROTOCOL_GIT_REPO = https://gitlab.freedesktop.org/spice/spice-protocol
14
BUILD = xz git rpm-build meson
Snir Sheriber's avatar
Snir Sheriber committed
15 16 17 18 19 20

srpm:
	dnf install -y $(BUILD)

	# get upstream spice protocol
	git clone $(PROTOCOL_GIT_REPO)
Frediano Ziglio's avatar
Frediano Ziglio committed
21 22
	meson --buildtype=release spice-protocol build-spice-protocol --prefix=/usr --werror
	ninja -C build-spice-protocol install
Snir Sheriber's avatar
Snir Sheriber committed
23 24 25 26

	# 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
27 28 29
	# 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
30 31
	git config --local user.email "dummy@dummy.com"
	git config --local user.name "dummy"
Frediano Ziglio's avatar
Frediano Ziglio committed
32 33
	git commit -m 'automatic version update'

Snir Sheriber's avatar
Snir Sheriber committed
34
	# create source rpm
Frediano Ziglio's avatar
Frediano Ziglio committed
35
	rm -rf build && mkdir build
36
	git submodule update --init --recursive
Frediano Ziglio's avatar
Frediano Ziglio committed
37 38 39 40
	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)"