added spec file for building RPM packages

This commit is contained in:
Steffen Vogel 2019-01-14 11:44:16 +01:00
parent db13a7d502
commit 92f794dbae
4 changed files with 143 additions and 0 deletions

View file

@ -0,0 +1,13 @@
--- /dev/null 2019-01-10 06:40:13.431642000 +0000
+++ libuldaq.pc.in 2019-01-10 08:07:38.000000000 +0000
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@bindir@
+includedir=@includedir@
+libdir=@libdir@
+
+Name: uldaq
+Description: MCC Universal Library for Linux
+Version: 1.1.0
+Cflags: -I${includedir}
+Libs: -L${libdir} -luldaq

45
packaging/fix-debug.patch Normal file
View file

@ -0,0 +1,45 @@
diff --git a/configure.ac b/configure.ac
index b117a10..c995099 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,17 +69,30 @@ AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin)
# Examples build
-AC_ARG_ENABLE([disable-examples-build], [AS_HELP_STRING([--disable-examples-build],
- [disable building example applications [default=no]])],
- [disable_build_examples=$enableval],
- [disable_build_examples=no])
-AM_CONDITIONAL(BUILD_EXAMPLES, test "x$disable_build_examples" != xyes)
+AC_ARG_ENABLE([examples],
+AS_HELP_STRING([--enable-examples],
+ [enable building example applications, default: yes]),
+ [case "${enableval}" in
+ yes) build_examples=true ;;
+ no) build_examples=false ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-examples]) ;;
+ esac],
+ [build_examples=true]
+)
+AM_CONDITIONAL(BUILD_EXAMPLES, test x"$build_examples" == x"true")
+
# Debug enable
-AC_ARG_ENABLE([debug], [AS_HELP_STRING([--debug],
- [turn on debugging [default=no]])],
- [debug=$enableval],
- [debug=no])
-AM_CONDITIONAL(DEBUG, test "x$debug" != xno)
+AC_ARG_ENABLE(debug,
+AS_HELP_STRING([--enable-debug],
+ [enable debugging, default: no]),
+ [case "${enableval}" in
+ yes) debug=true ;;
+ no) debug=false ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
+ esac],
+ [debug=false]
+)
+AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
AC_SUBST(LTLDFLAGS)

View file

@ -0,0 +1,17 @@
diff --git a/src/Makefile.am b/src/Makefile.am
index a0781a3..6f58a9a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,11 @@
AUTOMAKE_OPTIONS = subdir-objects
if DEBUG
-AM_CPPFLAGS = -DDEBUG
+ AM_CFLAGS = -g3 -O0 -DDEBUG
+ AM_CXXFLAGS = -g3 -O0 -DDEBUG
+else
+ AM_CFLAGS = -O2
+ AM_CXXFLAGS = -O2
endif
lib_LTLIBRARIES = libuldaq.la

68
packaging/uldaq.spec Normal file
View file

@ -0,0 +1,68 @@
Name: uldaq
Version: 1.1.0
Release: 1%{?dist}
Summary: MCC Universal Library for Linux
URL: http://www.mccdaq.com
License: MIT
Source0: https://github.com/mccdaq/uldaq/archive/v1.1.0.tar.gz
#Patch0: add-libuldaq.pc.in.patch
#Patch1: fix-debug.patch
#Patch2: fix-debug2.patch
BuildRequires: libusb-devel m4 autoconf automake libtool
Requires: libusb
%description
The uldaq package contains programming libraries and components for developing applications using C/C++ on Linux and macOS Operating Systems.
An API (Application Programming Interface) for interacting with the library in Python is available as an additional installation.
This package was created and is supported by MCC.
%package devel
Summary: Headers and libraries for building apps that use uldaq
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
This package contains headers and libraries required to build applications that
use the uldaq acquisition devices.
%prep
%setup -q
%patch0 -p0
%patch1 -p1
%patch2 -p1
autoreconf -i
%build
CFLAGS="-fPIC"; export CFLAGS
LDFLAGS="-fPIC"; export LDFLAGS
%configure --prefix=/usr --enable-shared --enable-debug
make %{_smp_mflags}
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
%files
%defattr(-,root,root,-)
%doc README.md
%{_defaultdocdir}/libuldaq/README.md
%{_libdir}/libuldaq.so.1.1.0
%{_libdir}/libuldaq.so.1
%{_libdir}/libuldaq.so
/etc/uldaq/fpga/*
/lib/udev/rules.d/50-uldaq.rules
%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/libuldaq.pc
%{_includedir}/uldaq.h
%{_libdir}/libuldaq.a
%{_libdir}/libuldaq.la
%changelog
* Thu Jan 10 2019 Steffen Vogel <post@steffenvogel.de> 1.1.0-1
- Created Initial Spec File.