Commit cda634f8 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Added .src.rpm generation

parent 47c7d720
SUBDIRS=compiler lib test examples
SUBDIRS=compiler lib test examples packaging
export LABCOMM_JAR=$(shell pwd)/compiler/labcomm_compiler.jar
export LABCOMM=java -jar $(LABCOMM_JAR)
.PHONY: all
all: $(SUBDIRS:%=make-%)
all: $(SUBDIRS:%=all-%)
.PHONY: make-%
make-%:
.PHONY: all-%
all-%:
LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $*
.PHONY: test
......@@ -29,3 +29,7 @@ distclean: clean $(SUBDIRS:%=distclean-%)
.PHONY: distclean-%
distclean-%:
$(MAKE) -C $* distclean
.PHONY: srpm
srpm:
make -C packaging $@
all:
.PHONY: all
all: ant-all
%:
.PHONY: test
test: ant-test
.PHONY: clean
clean: ant-clean
rm -f *~
.PHONY: distclean
distclean: clean
.PHONY: ant-%
ant-%:
ant $*
#!/bin/sh
java -jar /lib/labcomm_compiler.jar "$@"
#!/bin/sh
java -jar /lib/labcomm2006_compiler.jar "$@"
#!/bin/sh
java -jar /lib/labcomm2014_compiler.jar "$@"
labcomm-*.src.rpm
rpmbuild
.PHONY: all
all:
.PHONY: test
test:
.PHONY: clean
clean:
rm -rf rpmbuild
rm -f *~
.PHONY: distclean
distclean: clean
rm -f labcomm-*.src.rpm
.PHONY: srpm
srpm:
./make_srpm
#!/bin/sh
spec() {
cat << 'EOF'
Name: labcomm
Version: __VERSION__
Release: 1
Summary: LabComm communication protocol
License: GPLv3
# https://gitlab.control.lth.se/anders_blomdell/labcomm/repository/archive.tar.gz?__COMMIT__
Source0: labcomm.__DESCRIBE__.tar.gz
BuildRequires: gcc
BuildRequires: ant
BuildRequires: java
BuildRequires: mono-core
%description
LabComm communication protocol
%package devel
Summary: LabComm communication protocol
Requires: %{name} = %{version}-%{release}
%description devel
LabComm communication protocol
%
%prep
%setup -q -c -a 0
%build
pwd
make
%install
#
# C
#
install -d ${RPM_BUILD_ROOT}/%{_libdir}
install lib/c/liblabcomm2006.a ${RPM_BUILD_ROOT}/%{_libdir}/
install lib/c/liblabcomm2006.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2006.so.__VERSION__
ln -s liblabcomm2006.so.__VERSION__ ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2006.so
install lib/c/liblabcomm2014.a ${RPM_BUILD_ROOT}/%{_libdir}/
install lib/c/liblabcomm2014.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2014.so.__VERSION__
ln -s liblabcomm2014.so.__VERSION__ ${RPM_BUILD_ROOT}/%{_libdir}/liblabcomm2014.so
install -d ${RPM_BUILD_ROOT}/%{_includedir}/labcomm
install lib/c/2014/*h ${RPM_BUILD_ROOT}/%{_includedir}/labcomm
install -d ${RPM_BUILD_ROOT}/%{_includedir}/labcomm2006
install lib/c/2006/*h ${RPM_BUILD_ROOT}/%{_includedir}/labcomm2006
#
# java
#
install -d ${RPM_BUILD_ROOT}/usr/lib
install -m u=r,g=r,o=r compiler/labcomm2014_compiler.jar ${RPM_BUILD_ROOT}/usr/lib
install -m u=r,g=r,o=r compiler/labcomm2006_compiler.jar ${RPM_BUILD_ROOT}/usr/lib
install -m u=r,g=r,o=r lib/java/labcomm2014.jar ${RPM_BUILD_ROOT}/usr/lib
install -m u=r,g=r,o=r lib/java/labcomm2006.jar ${RPM_BUILD_ROOT}/usr/lib
install -d ${RPM_BUILD_ROOT}/%{_bindir}
install -m u=rx,g=rx,o=rx \
compiler/labcomm2014 ${RPM_BUILD_ROOT}/%{_bindir}/labcomm2014
install -m u=rx,g=rx,o=rx \
compiler/labcomm2006 ${RPM_BUILD_ROOT}/%{_bindir}/labcomm2006
ls -l ${RPM_BUILD_ROOT}/%{_bindir}
#
# C#
#
install -d ${RPM_BUILD_ROOT}/usr/lib
install -m u=r,g=r,o=r lib/csharp/labcomm.dll ${RPM_BUILD_ROOT}/usr/lib
#
# Python
#
install -d ${RPM_BUILD_ROOT}/%{python_sitelib}/labcomm
install lib/python/labcomm/* ${RPM_BUILD_ROOT}/%{python_sitelib}/labcomm
%files
%defattr (-, root, root)
%exclude /usr/lib/debug
%exclude /usr/lib/labcomm2014_compiler.jar
%exclude /usr/lib/labcomm2006_compiler.jar
/usr/lib/*
%{_libdir}/*
%files devel
%defattr (-, root, root)
/usr/lib/labcomm2014_compiler.jar
/usr/lib/labcomm2006_compiler.jar
%{_includedir}/*
%{_bindir}/*
EOF
}
# Create a suitable directory for rpmbuild
rm -rf rpmbuild
mkdir -p rpmbuild/BUILD
mkdir -p rpmbuild/SPECS
mkdir -p rpmbuild/RPMS
mkdir -p rpmbuild/SRPMS
mkdir -p rpmbuild/SOURCES
rm -rf rpmbuild/SOURCES/*
# Create spec and .tar.gz
DESCRIBE=$(git describe | sed -e 's/^v\(.*\)/\1/')
VERSION=$(echo ${DESCRIBE} | sed -e 's/-/./g')
COMMIT=$(git rev-parse HEAD)
(
spec | \
sed -e "s/__VERSION__/${VERSION}/g" | \
sed -e "s/__DESCRIBE__/${DESCRIBE}/g" | \
sed -e "s/__COMMIT__/${COMMIT}/g" \
) > rpmbuild/SPECS/labcomm.spec
(
cd $(git rev-parse --show-toplevel)
git archive --format tar HEAD
) > rpmbuild/SOURCES/labcomm.${DESCRIBE}.tar.gz
rpmbuild --define "_topdir $(pwd)/rpmbuild" \
-bs rpmbuild/SPECS/labcomm.spec
mv rpmbuild/SRPMS/* .
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment