Last active
January 2, 2020 13:53
-
-
Save Kungergely/d5dd7b47bfae1b4e2fa8edbc9fd532c5 to your computer and use it in GitHub Desktop.
Bash script for creating a static subpackage of eccodes 2.15.0 and subsequent build of the RPM package for CentOS 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir docker-eccodes; cd docker-eccodes | |
wget https://dl.fedoraproject.org/pub/epel/8/Everything/SRPMS/Packages/e/eccodes-2.14.1-1.el8.src.rpm | |
wget https://confluence.ecmwf.int/download/attachments/45757960/eccodes-2.15.0-Source.tar.gz | |
rpm2cpio ./eccodes-*.src.rpm | cpio -dium | |
rm -rf eccodes-2.14.1-Source.tar.gz | |
cat > eccodes-spec.patch <<"EOF" | |
--- eccodes.spec.orig 2019-10-27 15:54:22.000000000 +0100 | |
+++ eccodes.spec 2020-01-02 12:56:58.000000000 +0100 | |
@@ -1,5 +1,5 @@ | |
Name: eccodes | |
-Version: 2.14.1 | |
+Version: 2.15.0 | |
Release: 1%{?dist} | |
Summary: WMO data format decoding and encoding | |
@@ -180,6 +180,17 @@ | |
in C, and Fortran 90. | |
##################################################### | |
+%package static | |
+Summary: Static version of the eccodes library and tools | |
+Requires: %{name}%{?_isa} = %{version}-%{release} | |
+Requires: %{name}-devel%{?_isa} = %{version}-%{release} | |
+ | |
+##################################################### | |
+%description static | |
+This package provides the libeccodes.a and libeccodes_f90.a | |
+for static linking the ecCode library to programs written in | |
+C and Fortran 90. | |
+ | |
%prep | |
%autosetup -n %{name}-%{version}-Source -p1 | |
@@ -244,6 +255,7 @@ | |
-DECCODES_SOVERSION=%{so_version} \ | |
-DECCODES_SOVERSION_F90=%{so_version_f90} \ | |
-DENABLE_PYTHON=OFF \ | |
+ -DBUILD_SHARED_LIBS=BOTH \ | |
.. | |
%make_build | |
@@ -346,7 +358,15 @@ | |
%files doc | |
%doc %{_datadir}/doc/%{name}/ | |
+%files static | |
+%{_libdir}/*.a | |
+ | |
+ | |
%changelog | |
+* Mon Dec 23 2019 Gergely Kun <[email protected]> - 2.15.0-1 | |
+- Added the -static subpackage providing static libraries | |
+- Upgraded to version 2.15.0 | |
+ | |
* Sun Oct 27 2019 Jos de Kloe <[email protected]> - 2.14.1-1 | |
- Upgrade to upstream version 2.14.1 | |
EOF | |
patch < eccodes-spec.patch | |
cat > Dockerfile <<EOF | |
FROM centos:8 | |
RUN mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && mkdir -p /eccodes/build | |
RUN dnf -y --nogpgcheck install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm wget curl zip unzip bzip2 gcc gcc-c++ rpm-build make gcc-gfortran git libjpeg-devel libpng-devel perl-Getopt-Long cmake perl-Test-Simple | |
RUN dnf -y --nogpgcheck --enablerepo=PowerTools install netcdf-devel jasper-devel openjpeg2-devel | |
COPY eccodes-2.15.0-Source.tar.gz /root/rpmbuild/SOURCES | |
COPY eccodes-32bit.patch /root/rpmbuild/SOURCES | |
COPY eccodes-soversion.patch /root/rpmbuild/SOURCES | |
COPY eccodes_test_data_20181010.tar.gz /root/rpmbuild/SOURCES | |
COPY eccodes.spec /eccodes/build | |
RUN cd /eccodes/build && \ | |
mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \ | |
rpmbuild -ba eccodes.spec | |
EOF | |
docker build -t eccodes-builder . | |
mkdir build; cd build | |
docker run --mount type=bind,dst=/eccodes/build,src=`pwd` -t eccodes-builder:latest cp -r --no-preserve=all /root/rpmbuild/{RPMS/x86_64,RPMS/noarch,SRPMS} /eccodes/build | |
cp x86_64/* .; cp SRPMS/* .;cp noarch/* . | |
# Resulting packages: | |
# eccodes-2.15.0-1.el8.src.rpm | |
# eccodes-2.15.0-1.el8.x86_64.rpm | |
# eccodes-devel-2.15.0-1.el8.x86_64.rpm | |
# eccodes-data-2.15.0-1.el8.noarch.rpm | |
# eccodes-doc-2.15.0-1.el8.noarch.rpm | |
# eccodes-static-2.15.0-1.el8.x86_64.rpm | |
# eccodes-debugsource-2.15.0-1.el8.x86_64.rpm | |
# eccodes-debuginfo-2.15.0-1.el8.x86_64.rpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment