diff --git a/.gitignore b/.gitignore index e69de29..57185c1 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/qclib-1.2.0.tgz diff --git a/qclib-1.2.0-cflags.patch b/qclib-1.2.0-cflags.patch new file mode 100644 index 0000000..b6bbf99 --- /dev/null +++ b/qclib-1.2.0-cflags.patch @@ -0,0 +1,11 @@ +--- qclib-1.2.0/Makefile 2016-11-30 09:23:28.946521117 -0500 ++++ qclib-1.2.0/Makefile.old 2016-11-30 09:36:59.556521117 -0500 +@@ -6,7 +6,7 @@ + # bugfix: Bugfixes only + VERM = 1 + VERSION = $(VERM).2.0 +-CFLAGS = -g -Wall -O2 ++CFLAGS ?= -g -Wall -O2 + CFILES = query_capacity.c query_capacity_data.c query_capacity_sysinfo.c query_capacity_ocf.c \ + query_capacity_hypfs.c query_capacity_sthyi.c + OBJECTS = $(patsubst %.c,%.o,$(CFILES)) diff --git a/qclib-1.2.0-docdir.patch b/qclib-1.2.0-docdir.patch new file mode 100644 index 0000000..854c4ce --- /dev/null +++ b/qclib-1.2.0-docdir.patch @@ -0,0 +1,34 @@ +--- qclib-1.2.0/Makefile.old 2016-12-01 08:09:00.446521117 -0500 ++++ qclib-1.2.0/Makefile 2016-12-15 04:47:43.746521117 -0500 +@@ -6,6 +6,7 @@ + # bugfix: Bugfixes only + VERM = 1 + VERSION = $(VERM).2.0 ++DOCDIR ?= /usr/share/doc/packages/ + CFLAGS ?= -g -Wall -O2 + CFILES = query_capacity.c query_capacity_data.c query_capacity_sysinfo.c query_capacity_ocf.c \ + query_capacity_hypfs.c query_capacity_sthyi.c +@@ -68,16 +69,16 @@ + ln -sr $(DESTDIR)/usr/lib64/libqc.so.$(VERSION) $(DESTDIR)/usr/lib64/libqc.so.$(VERM) + ln -sr $(DESTDIR)/usr/lib64/libqc.so.$(VERSION) $(DESTDIR)/usr/lib64/libqc.so + install -Dm 644 query_capacity.h $(DESTDIR)/usr/include/query_capacity.h +- install -Dm 644 README $(DESTDIR)/usr/share/doc/packages/qclib/README +- install -Dm 644 LICENSE $(DESTDIR)/usr/share/doc/packages/qclib/LICENSE ++ install -Dm 644 README $(DESTDIR)/$(DOCDIR)/qclib/README ++ install -Dm 644 LICENSE $(DESTDIR)/$(DOCDIR)/qclib/LICENSE + + installdoc: doc + echo " INSTALLDOC" +- install -dm 755 $(DESTDIR)/usr/share/doc/packages/qclib/html +- cp -r html/* $(DESTDIR)/usr/share/doc/packages/qclib/html +- chmod 644 $(DESTDIR)/usr/share/doc/packages/qclib/html/search/* +- chmod 644 $(DESTDIR)/usr/share/doc/packages/qclib/html/* +- chmod 755 $(DESTDIR)/usr/share/doc/packages/qclib/html/search ++ install -dm 755 $(DESTDIR)/$(DOCDIR)/qclib/html ++ cp -r html/* $(DESTDIR)/$(DOCDIR)/qclib/html ++ chmod 644 $(DESTDIR)/$(DOCDIR)/qclib/html/search/* ++ chmod 644 $(DESTDIR)/$(DOCDIR)/qclib/html/* ++ chmod 755 $(DESTDIR)/$(DOCDIR)/qclib/html/search + + clean: + echo " CLEAN" diff --git a/qclib-1.2.0-soname.patch b/qclib-1.2.0-soname.patch new file mode 100644 index 0000000..66145b4 --- /dev/null +++ b/qclib-1.2.0-soname.patch @@ -0,0 +1,19 @@ +--- qclib-1.2.0.old/Makefile 2016-06-03 03:14:01.000000000 -0400 ++++ qclib-1.2.0/Makefile 2016-11-08 08:38:37.926521117 -0500 +@@ -37,7 +37,7 @@ + $(AR) rcs $@ $^ + + libqc.so.$(VERSION): $(OBJECTS) +- $(LINK) -shared $^ -o $@ ++ $(LINK) -Wl,-soname,libqc.so.$(VERM) -shared $^ -o $@ + + qc_test: qc_test.c libqc.a + $(CC) $(CFLAGS) -static $< -L. -lqc -o $@ +@@ -49,6 +49,7 @@ + ./$< + + test-sh: qc_test-sh ++ ln -srf libqc.so.$(VERSION) libqc.so.$(VERM) + LD_LIBRARY_PATH=. ./$< + + doc: html diff --git a/qclib.spec b/qclib.spec new file mode 100644 index 0000000..18e3227 --- /dev/null +++ b/qclib.spec @@ -0,0 +1,86 @@ +Name: qclib +Version: 1.2.0 +Release: 1%{?dist} +Summary: Library for extraction of system information for Linux on z Systems +License: BSD +URL: http://www.ibm.com/developerworks/linux/linux390/qclib.html +Source0: http://public.dhe.ibm.com/software/dw/linux390/ht_src/%{name}-%{version}.tgz +# Soname will be set upstream in later release +# https://bugzilla.redhat.com/show_bug.cgi?id=1306280 +Patch0: %{name}-1.2.0-soname.patch +Patch1: %{name}-1.2.0-cflags.patch +Patch2: %{name}-1.2.0-docdir.patch +ExclusiveArch: s390 s390x +BuildRequires: glibc-static +BuildRequires: doxygen + +%description +%{summary}. + +%package devel +Summary: Development library and headers for qclib +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +qclib provides a C API for extraction of system information for Linux on z +Systems. +For instance, it will provide the number of CPUs + * on the machine (CEC, Central Electronic Complex) layer + * on the PR/SM (Processor Resource/Systems Manager) layer, i.e. visible to + LPARs, including LPAR groups in z/VM hosts, guests and CPU pools + * in KVM hosts and guests + +This allows calculating the upper limit of CPU resources a highest level guest +can use. For example: If an LPAR on a z13 provides 4 CPUs to a z/VM hyper-visor, +and the hyper-visor provides 8 virtual CPUs to a guest, qclib can be used to +retrieve all of these numbers, and it can be concluded that not more capacity +than 4 CPUs can be used by the software running in the guest. + +This package provides the development libraries and headers for qclib. + +%package static +Summary: Static library for qclib +Requires: %{name}-devel = %{version}-%{release} +Provides: %{name}-static = %{version}-%{release} + +%description static +%{summary}. This package provides static libraries for qclib. + + +%prep +%autosetup + + +%build +make V=1 CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags} all doc + + +%install +%make_install DOCDIR=%{_docdir} +make DESTDIR=%{buildroot} DOCDIR=%{_docdir} installdoc + +%check +make test-sh test + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%dir %{_docdir}/%{name} +%license %{_docdir}/%{name}/LICENSE +%doc %{_docdir}/%{name}/README +%{_libdir}/libqc.so.* + +%files devel +%doc %{_docdir}/%{name}/html/ +%{_libdir}/libqc*.so +%{_includedir}/query_capacity.h + +%files static +%{_libdir}/libqc*.a + +%changelog +* Mon Oct 31 2016 Rafael dos Santos 1.2.0-1 +- Initial packaging diff --git a/sources b/sources index e69de29..4da1e45 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (qclib-1.2.0.tgz) = 5879379d0c0db542a44170b8aebfa12266dd9fc3f38800580efe786a149fb167859a1f8ebe8b23c11a0069697bc43a31c702eefcfb6edf5f99faba002a38e582