%define dotests 1 # spec file for package snappy # # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # norootforbuild Name: snappy Version: 1.1.7 Release: 1 License: MIT Group: Development/Libraries/C and C++ BuildRoot: %{_tmppath}/%{name}-%{version}-build Url: http://code.google.com/p/snappy/ Source0: snappy-%{version}.tar.gz Source1: libsnappy.so.1.3.0-aix32 Source2: libsnappy.so.1.3.0-aix64 BuildRequires: cmake >= 3.14.3 BuildRequires: gcc-c++ #BuildRequires: gtest-devel BuildRequires: gcc-c++ zlib-devel lzo-devel Requires: libgcc >= 6.3.0 Requires: libstdc++ >= 6.3.0 Patch0: snappy-%{version}-static-fct.patch %ifos aix6.1 %define buildhost powerpc-ibm-aix6.1.0.0 %define osplat aix6 %define _libdir64 %{_prefix}/lib64 %endif # Summary: A fast compressor/decompressor library %description Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy compresses at about 250 MB/sec or more and decompresses at about 500 MB/sec or more. This package holds the shared library of snappy. %package devel License: MIT Group: Development/Libraries/C and C++ Requires: %{name} = %{version} # Summary: Development files for snappy %description devel Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy compresses at about 250 MB/sec or more and decompresses at about 500 MB/sec or more. This package holds the development files for snappy. %prep export PATH=/opt/freeware/bin:/usr/bin:/bin %setup %patch0 -p1 -b .static rm -rf /tmp/%{name}-%{version}-32bit mkdir /tmp/%{name}-%{version}-32bit mv * /tmp/%{name}-%{version}-32bit mkdir 32bit mv /tmp/%{name}-%{version}-32bit/* 32bit rm -rf /tmp/%{name}-%{version}-32bit mkdir 64bit cp -rp 32bit/* 64bit/ %build export CONFIG_SHELL=/usr/bin/ksh export CONFIG_ENV_ARGS=/usr/bin/ksh export RM="/usr/bin/rm -f" export AR="ar -X32_64" export NM="nm -X32_64" cd 64bit # 64 bit export CC="gcc -maix64" export CXX="g++ -maix64 -O2" $CC --version export OBJECT_MODE=64 export CFLAGS="-I`pwd`/include -I/opt/freeware/include -I/usr/include" export CXXFLAGS="-I`pwd`/include -I/opt/freeware/include -I/usr/include" export CPPFLAGS="-I`pwd`/include -I/opt/freeware/include -I/usr/include" export LDFLAGS="-L`pwd` -L`pwd`/.libs -L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib -Wl,-brtl" cmake -DCMAKE_INSTALL_PREFIX=/opt/freeware . gmake cat << EOF >snappy.pc prefix=%{_prefix} exec_prefix=%{_exec_prefix} includedir=%{_includedir} libdir=%{_libdir64} Name: %{name} Description: A fast compression/decompression library Version: %{version} Cflags: -I\${includedir} Libs: -L\${libdir} -lsnappy EOF gmake test if [ "%{dotests}" == 1 ] then ( gmake -k test ) fi `echo /usr/bin/nm -X32_64 | /usr/bin/sed -e 's/B\([^B]*\)$/P\1/'` -PCpgl libsnappy.a | \ /usr/bin/awk '{ if ((($ 2 == "T") || ($ 2 == "D") || ($ 2 == "B") || ($ 2 == "W") || ($ 2 == "V") || ($ 2 == "Z")) \ && (substr($ 1,1,1) != ".")) { if (($ 2 == "W") || ($ 2 == "V") || ($ 2 == "Z")) { print $ 1 " weak" } \ else { print $ 1 } } }' | /usr/bin/sort -u > snappy.exp export LDFLAGS="-lm -lpthread -Wl,-bE:snappy.exp -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib " g++ -maix64 -shared libsnappy.a -o libsnappy.so.1.7.0 $LDFLAGS /usr/bin/rm libsnappy.a /usr/bin/ar -X64 -q libsnappy.a libsnappy.so.1.7.0 cd ../32bit export CC="gcc -maix32 -D_LARGE_FILES -O2" export CXX="g++ -maix32 -D_LARGE_FILES" export OBJECT_MODE=32 export CFLAGS="-I`pwd`/include -I/opt/freeware/include -I/usr/include" export CPPFLAGS="-I`pwd`/include -I/opt/freeware/include -I/usr/include" export LDFLAGS="-L`pwd` -L`pwd`/.libs -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000 -Wl,-brtl" cmake -DCMAKE_INSTALL_PREFIX=/opt/freeware . gmake cat << EOF >snappy.pc prefix=%{_prefix} exec_prefix=%{_exec_prefix} includedir=%{_includedir} libdir=%{_libdir} Name: %{name} Description: A fast compression/decompression library Version: %{version} Cflags: -I\${includedir} Libs: -L\${libdir} -lsnappy EOF gmake test if [ "%{dotests}" == 1 ] then ( gmake -k test ) fi `echo /usr/bin/nm -X32_64 | /usr/bin/sed -e 's/B\([^B]*\)$/P\1/'` -PCpgl libsnappy.a | \ /usr/bin/awk '{ if ((($ 2 == "T") || ($ 2 == "D") || ($ 2 == "B") || ($ 2 == "W") || ($ 2 == "V") || ($ 2 == "Z")) \ && (substr($ 1,1,1) != ".")) { if (($ 2 == "W") || ($ 2 == "V") || ($ 2 == "Z")) { print $ 1 " weak" } \ else { print $ 1 } } }' | /usr/bin/sort -u > snappy.exp pwd export LDFLAGS="-lm -lpthread -Wl,-bE:snappy.exp -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib " g++ -maix32 -shared libsnappy.a -o libsnappy.so.1.7.0 $LDFLAGS /usr/bin/rm libsnappy.a /usr/bin/ar -X32 -q libsnappy.a libsnappy.so.1.7.0 cp %{SOURCE1} libsnappy.so.1.3.0 /usr/bin/strip -X32 -e libsnappy.so.1.3.0 /usr/bin/ar -X32 -q libsnappy.a libsnappy.so.1.3.0 cp %{SOURCE2} libsnappy.so.1.3.0 /usr/bin/strip -X64 -e libsnappy.so.1.3.0 /usr/bin/ar -X64 -q libsnappy.a libsnappy.so.1.3.0 /usr/bin/ar -X64 -q ../64bit/libsnappy.a libsnappy.so.1.3.0 /usr/bin/ar -X64 -q libsnappy.a ../64bit/libsnappy.so.1.7.0 %install rm -rf %{buildroot} export CONFIG_SHELL=/usr/bin/ksh export CONFIG_ENV_ARGS=/usr/bin/ksh cd 64bit export AR="/usr/bin/ar -X64" export OBJECT_MODE=64 %make_install prefix=$RPM_BUILD_ROOT/%{_prefix} /opt/freeware/bin/find %{buildroot} -name \*.la -delete -print mkdir -p $RPM_BUILD_ROOT/%{_prefix}/lib64 cp '%{_builddir}'/%{name}-%{version}/64bit/*.a $RPM_BUILD_ROOT%{_prefix}/lib64 cp '%{_builddir}'/%{name}-%{version}/64bit/*.so.1.7.0 $RPM_BUILD_ROOT%{_prefix}/lib64 cd ../32bit export AR="/usr/bin/ar -X32" export OBJECT_MODE=32 %make_install prefix=$RPM_BUILD_ROOT/%{_prefix} /opt/freeware/bin/find %{buildroot} -name \*.la -delete -print cp '%{_builddir}'/%{name}-%{version}/32bit/*.a $RPM_BUILD_ROOT%{_prefix}/lib mkdir -p $RPM_BUILD_ROOT/%{_prefix}/lib cp '%{_builddir}'/%{name}-%{version}/32bit/*.a $RPM_BUILD_ROOT%{_prefix}/lib cp '%{_builddir}'/%{name}-%{version}/32bit/*.so.1.7.0 $RPM_BUILD_ROOT%{_prefix}/lib mkdir -p $RPM_BUILD_ROOT/usr/lib cd $RPM_BUILD_ROOT/usr/lib %{__ln_s} ../../opt/freeware/lib/libsnappy* . cd - mkdir -p $RPM_BUILD_ROOT/usr/lib64 cd $RPM_BUILD_ROOT/usr/lib64 %{__ln_s} ../../opt/freeware/lib64/libsnappy* . %clean rm -rf %{buildroot} %files %define _libdir64 /opt/freeware/lib64 %defattr(-,root,system,-) %{_libdir}/libsnappy.a %{_libdir64}/libsnappy.a /usr/lib/libsnappy.a /usr/lib64/libsnappy.a %doc 32bit/AUTHORS 32bit/COPYING 32bit/NEWS 32bit/README.md %files devel %defattr(-,root,system,-) %{_includedir}/snappy-c.h %{_includedir}/snappy-sinksource.h %{_includedir}/snappy-stubs-public.h %{_includedir}/snappy.h %changelog * Thu Sep 05 2019 Harshita Jain - 1.1.7-1 - Update to latest version - 1.1.7-1 * Tue Aug 14 2018 Ravi Hirekurabar - 1.1.3-2 - Rebuilt adding Requires: libgcc >= 6.3.0 - Added Requires: libstdc++ >= 6.3.0 * Wed May 09 2018 Ravi Hirekurabar - 1.1.3-1 - Initial Port to AIX - Built with gcc and added -blibpath