From 6db9318392dd1308b9bf77fbb537261cc0f0b5ab Mon Sep 17 00:00:00 2001
From: Dinyar Rabady <dinyar.rabady@cern.ch>
Date: Tue, 7 Jun 2022 19:58:03 +0200
Subject: [PATCH] Build scdaq RPM in CI

---
 .gitlab-ci.yml | 28 ++++++++++++++++++++++++++++
 src/Makefile   |  2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..a674cdb2
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,28 @@
+image: gitlab-registry.cern.ch/scouting-demonstrator/scouting-docker-images/scdaq-builder:1.0.0
+
+build_rpm_tag:
+  stage: build
+  only:
+    - tags
+  script:
+    - bash scripts/scdaqrpm.sh
+    - mv /tmp/scdaq-build-tmp/RPMBUILD/RPMS/x86_64/scdaq* .
+  artifacts:
+    name: "scdaq-${CI_JOB_NAME}_${CI_COMMIT_TAG}"
+    paths:
+      - "*.rpm"
+    expire_in: 1 year
+
+build_rpm_dev:
+  stage: build
+  except: 
+    - tags
+  script:
+    - bash scripts/scdaqrpm.sh
+    - mv /tmp/scdaq-build-tmp/RPMBUILD/RPMS/x86_64/scdaq* .
+    - for f in *.rpm; do mv -- "$f" "${f%.rpm}-dev.rpm"; done # Add -dev extension to RPMs built from non-tags.
+  artifacts:
+    name: "scdaq-${CI_JOB_NAME}_`echo $CI_COMMIT_REF_NAME | sed 's|/|-|g'`"
+    paths:
+      - "*.rpm"
+    expire_in: 1 week
diff --git a/src/Makefile b/src/Makefile
index ef734ed5..09e0d465 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -27,7 +27,7 @@ CXXFLAGS = -std=c++11 -Wall -Wextra -O0 -g -rdynamic
 #CXXFLAGS = -std=c++11 -Wall -Wextra -g -rdynamic
 
 CFLAGS = $(CXXFLAGS)
-LDFLAGS = -ltbb -ltbbmalloc -lboost_thread -lcurl
+LDFLAGS = -ltbb -ltbbmalloc -lboost_thread -lcurl -pthread
 
 CPPFLAGS = -I. -Iwzdma
 
-- 
GitLab