This will let copr to generate srpm using the .copr/Makefile script

Signed-off-by: Snir Sheriber <ssher...@redhat.com>
---
 .copr/Makefile | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 .copr/Makefile

diff --git a/.copr/Makefile b/.copr/Makefile
new file mode 100644
index 0000000..db297fb
--- /dev/null
+++ b/.copr/Makefile
@@ -0,0 +1,29 @@
+# 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
+BUILD = meson gcc xz git rpm-build
+
+srpm:
+       dnf install -y $(BUILD)
+
+       # get upstream spice protocol
+       git clone $(PROTOCOL_GIT_REPO)
+       cd spice-protocol && meson -Dprefix=/usr/ build && ninja -C build 
install
+       rm -rf spice-protocol
+
+       # get other dependencies for project excluding spice-protocol
+       dnf install -y `sed '/^BuildRequires:/!d; s/.*://; 
s/\bspice-protocol\b//; s/>.*//' *.spec.in`
+
+       # do not use commit id for version
+       git fetch --tags
+       git describe --abbrev=0 | sed 's/v//' > .tarball-version
+       # create source rpm
+       meson --buildtype=release build
+       # Meson does not update submodules recursively
+       git submodule update --init --recursive
+       # this fix an issue with Meson dist
+       if ! test -r ../spice-common.git; then DIR=`basename "$$PWD"`; ln -s 
"$$DIR/.git/modules/spice-common" ../spice-common.git; fi
+       rm -rf meson-dist
+       ninja -C build dist
+       rpmbuild -bs ./build/*spec --define "_sourcedir 
$$PWD/build/meson-dist/" --define "_srcrpmdir $(outdir)"
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to