| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- ##
- ## redis-libs.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/>
- ##
- ## Permission to use, copy, modify, and distribute this software for
- ## any purpose with or without fee is hereby granted, provided that
- ## the above copyright notice and this permission notice appear in all
- ## copies.
- ##
- ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- ## SUCH DAMAGE.
- ##
- # package version
- %define V_hiredis_tgz 0.14.1
- %define V_hiredis_dir 0.14.1
- %define V_perl_redis 1.981
- %define V_perl_redis_hiredis 0.11.0
- %define V_predis 1.1.1
- %define V_phpredis 5.3.2
- %define V_rubyredis 4.2.2
- # package information
- Name: redis-libs
- Summary: Redis Client Libraries
- URL: http://redis.io/clients
- Vendor: Salvatore Sanfilippo et al.
- Packager: OpenPKG Project
- Distribution: OpenPKG Community
- Class: EVAL
- Group: Database
- License: Open Source
- Version: 0
- Release: 20201025
- # package options
- %option with_perl no
- %option with_php no
- %option with_ruby no
- # list of sources
- Source0: https://github.com/redis/hiredis/archive/v%{V_hiredis_tgz}.tar.gz
- Source1: http://www.cpan.org/authors/id/D/DA/DAMS/Redis-%{V_perl_redis}.tar.gz
- Source2: http://www.cpan.org/authors/id/N/NE/NEOPHENIX/Redis-hiredis-%{V_perl_redis_hiredis}.tar.gz
- Source3: http://github.com/nrk/predis/archive/v%{V_predis}.tar.gz
- Source4: https://github.com/phpredis/phpredis/archive/%{V_phpredis}.tar.gz
- Source5: https://rubygems.org/downloads/redis-%{V_rubyredis}.gem
- Patch0: redis-libs.patch
- # build information
- BuildPreReq: OpenPKG, openpkg >= 20160101, make
- PreReq: OpenPKG, openpkg >= 20160101
- %if "%{with_perl}" == "yes"
- BuildPreReq: perl, perl-openpkg
- PreReq: perl
- %endif
- %if "%{with_php}" == "yes"
- BuildPreReq: php, php::with_session = yes
- PreReq: php, php::with_session = yes
- %endif
- %if "%{with_ruby}" == "yes"
- BuildPreReq: ruby, ruby-gems
- PreReq: ruby, ruby-gems
- %endif
- %description
- This is a set of Redis client libraries for the programming
- languages C, Java, Scala, Perl and PHP.
- %track
- prog redis-libs:hiredis = {
- version = %{V_hiredis_tgz}
- url = https://github.com/redis/hiredis/releases
- regex = v(__VER__)\.tar\.gz
- }
- prog redis-libs:perl-redis = {
- version = %{V_perl_redis}
- url = http://www.cpan.org/authors/id/M/ME/MELO/
- regex = Redis-(__VER__)\.tar\.gz
- }
- prog redis-libs:perl-redis-hiredis = {
- version = %{V_perl_redis_hiredis}
- url = http://www.cpan.org/authors/id/N/NE/NEOPHENIX/
- regex = Redis-hiredis-(__VER__)\.tar\.gz
- }
- prog redis-libs:predis = {
- version = %{V_predis}
- url = http://github.com/nrk/predis/releases
- regex = v(__VER__)\.tar\.gz
- }
- prog redis-libs:phpredis = {
- version = %{V_phpredis}
- url = https://github.com/phpredis/phpredis/releases
- regex = (\d+\.\d+\.\d+)\.tar\.gz
- }
- prog redis-libs:rubyredis = {
- version = %{V_rubyredis}
- url = https://github.com/redis/redis-rb/releases
- regex = v(\d+\.\d+\.\d+)\.tar\.gz
- }
- %prep
- %setup -q -c
- %if "%{with_perl}" == "yes"
- %setup -q -T -D -a 1
- %setup -q -T -D -a 2
- %endif
- %if "%{with_php}" == "yes"
- %setup -q -T -D -a 3
- %setup -q -T -D -a 4
- %endif
- %patch -p0
- %build
- ( cd hiredis-%{V_hiredis_dir}
- %{l_make} %{l_mflags} \
- CC="%{l_cc} %{l_cflags -O}" DEBUG="" \
- libhiredis.a
- ) || exit $?
- %if "%{with_perl}" == "yes"
- ( cd Redis-%{V_perl_redis}
- %{l_prefix}/bin/perl-openpkg prepare
- %{l_prefix}/bin/perl-openpkg configure build
- ) || exit $?
- ( cd Redis-hiredis-%{V_perl_redis_hiredis}
- %{l_prefix}/bin/perl-openpkg prepare
- %{l_prefix}/bin/perl-openpkg configure build
- ) || exit $?
- %endif
- %if "%{with_php}" == "yes"
- ( cd phpredis-%{V_phpredis}
- %{l_prefix}/bin/phpize
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- CPPFLAGS="%{l_cppflags}" \
- LDFLAGS="%{l_ldflags}" \
- LIBS="-lssl -lcrypto" \
- GREP="grep" \
- ./configure \
- --prefix=%{l_prefix} \
- --with-php-config=%{l_prefix}/bin/php-config \
- --enable-shared \
- --disable-static
- %{l_make} %{l_mflags -O}
- ) || exit $?
- %endif
- %install
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/include/redis/adapters \
- $RPM_BUILD_ROOT%{l_prefix}/lib
- %{l_shtool} install -c -m 755 \
- hiredis-%{V_hiredis_dir}/libhiredis.a \
- $RPM_BUILD_ROOT%{l_prefix}/lib/
- %{l_shtool} install -c -m 644 \
- hiredis-%{V_hiredis_dir}/*.h \
- $RPM_BUILD_ROOT%{l_prefix}/include/redis/
- %{l_shtool} install -c -m 644 \
- hiredis-%{V_hiredis_dir}/adapters/*.h \
- $RPM_BUILD_ROOT%{l_prefix}/include/redis/adapters/
- %if "%{with_perl}" == "yes"
- %{l_prefix}/bin/perl-openpkg -d Redis-%{V_perl_redis} install
- %{l_prefix}/bin/perl-openpkg -d Redis-hiredis-%{V_perl_redis_hiredis} install
- %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
- %else
- >perl-openpkg-files
- %endif
- %if "%{with_php}" == "yes"
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/lib/redis/Predis
- cp -r predis-%{V_predis}/src/* \
- $RPM_BUILD_ROOT%{l_prefix}/lib/redis/Predis/
- %{l_shtool} install -c -m 755 \
- phpredis-%{V_phpredis}/.libs/redis.so \
- $RPM_BUILD_ROOT%{l_prefix}/lib/redis/phpredis.so
- %endif
- %if "%{with_ruby}" == "yes"
- gem install --build-root $RPM_BUILD_ROOT %{SOURCE redis-%{V_rubyredis}.gem}
- %endif
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`
- %files -f files
- %clean
- %post
- %if "%{with_php}" == "yes"
- if [ ".$1" = .1 ]; then
- # add hook to PHP configuration
- phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
- if [ -f $phpini ]; then
- echo "extension = $RPM_INSTALL_PREFIX/lib/redis/phpredis.so" |\
- $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
- -a -i "$RPM_INSTALL_PREFIX:redis-libs" -p ";" $phpini
- fi
- # add hook to PHP-FPM configuration
- phpini="$RPM_INSTALL_PREFIX/etc/php-fpm/php-fpm.ini"
- if [ -f $phpini ]; then
- echo "extension = $RPM_INSTALL_PREFIX/lib/redis/phpredis.so" |\
- $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
- -a -i "$RPM_INSTALL_PREFIX:redis-libs" -p ";" $phpini
- fi
- # add hook to Apache/PHP configuration
- phpini="$RPM_INSTALL_PREFIX/etc/apache/apache-php.ini"
- if [ -f $phpini ]; then
- echo "extension = $RPM_INSTALL_PREFIX/lib/redis/phpredis.so" |\
- $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
- -a -i "$RPM_INSTALL_PREFIX:redis-libs" -p ";" $phpini
- fi
- fi
- %endif
- %postun
- %if "%{with_php}" == "yes"
- if [ ".$1" = .0 ]; then
- # remove hook from PHP configuration
- phpini="$RPM_INSTALL_PREFIX/etc/php/php.ini"
- if [ -f $phpini ]; then
- $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
- -r -i "$RPM_INSTALL_PREFIX:redis-libs" -p ";" $phpini
- fi
- # remove hook from PHP-FPM configuration
- phpini="$RPM_INSTALL_PREFIX/etc/php-fpm/php-fpm.ini"
- if [ -f $phpini ]; then
- $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
- -r -i "$RPM_INSTALL_PREFIX:redis-libs" -p ";" $phpini
- fi
- # remove hook from Apache/PHP configuration
- phpini="$RPM_INSTALL_PREFIX/etc/apache/apache-php.ini"
- if [ -f $phpini ]; then
- $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
- -r -i "$RPM_INSTALL_PREFIX:redis-libs" -p ";" $phpini
- fi
- fi
- %endif
|