]> git.pld-linux.org Git - packages/libdmtx.git/commitdiff
massive pldization; multi-php-version support
authorElan Ruusamäe <glen@delfi.ee>
Fri, 11 Jul 2014 05:25:13 +0000 (08:25 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Fri, 11 Jul 2014 05:25:13 +0000 (08:25 +0300)
libdmtx.spec

index 2a3b6f2b6823c526c3ea8933fc39cba0effb74f1..38f5d5988c0276819d588022f094eed90396b34b 100644 (file)
@@ -1,31 +1,42 @@
-%bcond_with    ruby
-%bcond_without test
+# TODO
+# - java bindings
+#
+# Conditional build:
+%bcond_with    ruby            # build Ruby bindings
+%bcond_without python  # build Python2 bindings
+%bcond_without php             # build PHP bindings
+%bcond_without tests           # build without tests
+
 Summary:       Library for working with Data Matrix 2D bar-codes
 Name:          libdmtx
 Version:       0.7.2
 Release:       4
 License:       LGPL v2+
 Group:         Libraries
-URL:           http://www.libdmtx.org/
 Source0:       http://downloads.sourceforge.net/libdmtx/%{name}-%{version}.tar.bz2
 # Source0-md5: 0684cf3857591e777b57248d652444ae
+URL:           http://www.libdmtx.org/
 BuildRequires: ImageMagick-devel
 BuildRequires: pkgconfig
 BuildRequires: python-modules
 BuildRequires: rpm-pythonprov
-BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-# required for tests
+BuildRequires: rpmbuild(macros) >= 1.219
+%if %{with tests}
 BuildRequires: OpenGL-GLU-devel
 BuildRequires: SDL_image-devel
 BuildRequires: libpng-devel
-# language bindings
-#BuildRequires:  java-1.6.0-devel
-BuildRequires: php-devel
+%endif
+%if %{with php}
+BuildRequires: %{php_name}-devel
+%endif
+%if %{with python}
 BuildRequires: python-devel
+%endif
 %if %{with ruby}
 BuildRequires: ruby
 BuildRequires: ruby-devel
 %endif
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
 libdmtx is open source software for reading and writing Data Matrix 2D
@@ -36,48 +47,47 @@ capabilities without restrictions or overhead.
 The included utility programs, dmtxread and dmtxwrite, provide the
 official interface to libdmtx from the command line, and also serve as
 a good reference for programmers who wish to write their own programs
-that interact with libdmtx. All of the software in the libdmtx package
-is distributed under the LGPLv2 and can be used freely under these
-terms.
+that interact with libdmtx.
 
-%package        devel
+%package devel
 Summary:       Development files for %{name}
 Group:         Development/Libraries
 Requires:      %{name} = %{version}-%{release}
 
-%description    devel
+%description devel
 The %{name}-devel package contains libraries and header files for
 developing applications that use %{name}.
 
-%package        utils
+%package utils
 Summary:       Utilities for %{name}
 Group:         Applications/System
 Requires:      %{name} = %{version}-%{release}
 
-%description    utils
+%description utils
 The %{name}-utils package contains utilities that use %{name}.
 
-# language bindings
-%package -n     php-libdmtx
+%package -n %{php_name}-dmtx
 Summary:       PHP bindings for %{name}
 License:       GPL v2+
-Group:         Libraries
+Group:         Development/Languages/PHP
 Requires:      %{name} = %{version}-%{release}
-Requires:      php(core)
+%{?requires_php_extension}
+Provides:      php(dmtx) = %{version}
+Obsoletes:     php-libdmtx < 0.7.2-4
 
-%description -n php-libdmtx
-The php-%{name} package contains bindings for using %{name} from PHP.
+%description -n %{php_name}-dmtx
+This package contains bindings for using %{name} from PHP.
 
-%package -n     python-libdmtx
+%package -n python-libdmtx
 Summary:       Python bindings for %{name}
-Group:         Libraries
+Group:         Libraries/Python
 Requires:      %{name} = %{version}-%{release}
 
 %description -n python-libdmtx
 The python-%{name} package contains bindings for using %{name} from
 Python.
 
-%package -n     ruby-libdmtx
+%package -n ruby-libdmtx
 Summary:       Ruby bindings for %{name}
 Group:         Libraries
 Requires:      %{name} = %{version}-%{release}
@@ -95,9 +105,9 @@ chmod a-x wrapper/{php,python}/README
 
 %build
 %configure \
-       --disable-static \
+       --disable-static
 
-%{__make} %{?_smp_mflags}
+%{__make}
 
 # temporary installation required by the language wrappers
 install -d tmp
@@ -105,26 +115,28 @@ install -d tmp
        DESTDIR=$(pwd)/tmp
 
 # language wrappers must be built separately
-cd wrapper/php
+cd wrapper
+
+%if %{with php}
+cd php
 phpize
 %configure \
        --disable-static \
 
-# Don't use rpath!
-sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
-sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
-
 %{__make} \
        EXTRA_CFLAGS="-I$(pwd)/../../tmp%{_includedir}" \
        DMTX_SHARED_LIBADD="-L$(pwd)/../../tmp%{_libdir} -ldmtx"
 cd ..
+%endif
 
+%if %{with python}
 cd python
 # fix paths
 sed -i.orig -e "s|%{_prefix}/local/include|$(pwd)/../../tmp%{_includedir}|" -e "s|%{_prefix}/local/lib|$(pwd)/../../tmp%{_libdir}|" setup.py
-python setup.py build
+%{__python} setup.py build
 chmod 0755 build/lib.*/*.so
 cd ..
+%endif
 
 %if %{with ruby}
 cd ruby
@@ -140,73 +152,92 @@ cd ..
 #cd ..
 cd ..
 
-%if %{with test}
+%if %{with tests}
 %{__make} check
 cd test
-for t in simple unit
-do
+for t in simple unit; do
        ./${t}_test/${t}_test
 done
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
-find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libdmtx.la
 
 cd wrapper
+%if %{with php}
 %{__make} -C php install \
        INSTALL_ROOT=$RPM_BUILD_ROOT
 
+install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
+cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/dmtx.ini
+; Enable dmtx extension module
+extension=dmtx.so
+EOF
+%endif
+
+%if %{with python}
 cd python
-python setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+%{__python} setup.py install \
+       --skip-build \
+       --optimize=2 \
+       --root=$RPM_BUILD_ROOT
 cd ..
+%py_postclean
+%endif
 
 %if %{with ruby}
 %{__make} -C ruby install \
        DESTDIR=$RPM_BUILD_ROOT
 %endif
 
-#pushd java
-#popd
-cd ..
-
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post -p /sbin/ldconfig
-%postun -p /sbin/ldconfig
-
+%post  -p /sbin/ldconfig
+%postun        -p /sbin/ldconfig
 
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS COPYING.LESSER ChangeLog KNOWNBUG NEWS README README.linux TODO
-%attr(755,root,root) %{_libdir}/%{name}.so.*
+%attr(755,root,root) %{_libdir}/libdmtx.so.*.*.*
+%ghost %{_libdir}/libdmtx.so.0
 
 %files devel
 %defattr(644,root,root,755)
-%{_includedir}/*
 %attr(755,root,root) %{_libdir}/%{name}.so
+%{_includedir}/dmtx.h
 %{_pkgconfigdir}/%{name}.pc
 %{_mandir}/man3/%{name}.3*
 
 %files utils
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/dmtx*
-%{_mandir}/man1/dmtx*.1*
-
-%files -n php-libdmtx
+%attr(755,root,root) %{_bindir}/dmtxquery
+%attr(755,root,root) %{_bindir}/dmtxread
+%attr(755,root,root) %{_bindir}/dmtxwrite
+%{_mandir}/man1/dmtxquery.1*
+%{_mandir}/man1/dmtxread.1*
+%{_mandir}/man1/dmtxwrite.1*
+
+%if %{with php}
+%files -n %{php_name}-dmtx
 %defattr(644,root,root,755)
 %doc COPYING wrapper/php/README
-%attr(755,root,root) %{_libdir}/php/*.so
+%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/dmtx.ini
+%attr(755,root,root) %{php_extensiondir}/dmtx.so
+%endif
 
+%if %{with python}
 %files -n python-libdmtx
 %defattr(644,root,root,755)
 %doc wrapper/python/README
-%{py_sitedir}/*
+%{py_sitedir}/pydmtx.py[co]
+%attr(755,root,root) %{py_sitedir}/_pydmtx.so
+%{py_sitedir}/pydmtx-*.egg-info
+%endif
 
 %if %{with ruby}
 %files -n ruby-libdmtx
This page took 0.093762 seconds and 4 git commands to generate.