%global py_cchardet_version 1.0.2 %global __provides_exclude_from ^(%{python_sitearch}/.*\\.so)$ Name: libuchardet Version: 1.0.3 Release: 1%{?dist} Summary: Universal Character Set Detector C Library # ALL files are under MPL (v1.1) GPL license # build.xml and c/* under MPL 1.1/GPL 2.0/LGPL 2.1 license License: MPLv1.1 or GPLv2+ or LGPLv2+ URL: http://code.google.com/p/juniversalchardet/ Source0: http://juniversalchardet.googlecode.com/files/juniversalchardet-%{version}.tar.gz Source1: http://repo1.maven.org/maven2/com/googlecode/juniversalchardet/juniversalchardet/%{version}/juniversalchardet-%{version}.pom # added javadoc task # fix example build Patch0: juniversalchardet-1.0.3-build.patch Patch1: juniversalchardet-1.0.3-cstring.patch BuildRequires: ant BuildRequires: dos2unix BuildRequires: java-devel BuildRequires: javapackages-tools BuildRequires: libtool BuildRequires: python2-devel BuildRequires: swig %description A port to C of "universalchardet", that is the encoding detector library of Mozilla. The original code of universalchardet is available at http://lxr.mozilla.org/seamonkey/source/extensions/universalchardet/ %package devel Summary: Development files for libuchardet Requires: %{name}%{?_isa} = %{version}-%{release} Requires: pkgconfig %description devel This package contains the development libraries required for writing C applications. %package -n juniversalchardet Summary: A Java port of Mozilla's universalchardet BuildArch: noarch Requires: java Requires: javapackages-tools %description -n juniversalchardet juniversalchardet is a Java port of 'universalchardet', that is the encoding detector library of Mozilla. %package -n juniversalchardet-javadoc Summary: Javadoc for juniversalchardet BuildArch: noarch %description -n juniversalchardet-javadoc This package contains javadoc for juniversalchardet. %package -n python-cchardet Summary: A Python binding of universalchardet Requires: %{name}%{?_isa} = %{version}-%{release} Requires: python2 #Requires: swig %description -n python-cchardet This package provides a Python binding of universalchardet. %prep %setup -q -n juniversalchardet find . -name "*.class" -delete find . -name "*.jar" -delete %patch0 -p0 %patch1 -p0 # avoid spurious executable permissions in debuginfo package find . -name \*.cpp -or -name \*.c -or -name \*.h | xargs chmod 644 dos2unix c/readme.txt sed -i 's/\r//' readme.txt c/readme-en.txt c/readme.txt %build ( cd c make %{?_smp_mflags} ) ( cd swig/python cp -p ../cchardet.i . swig -Wall -python cchardet.i CFLAGS="%{optflags} -I../../c/include -L../../c/.libs" %{__python} setup.py build ) %ant dist javadoc example %install ( cd c mkdir -p %{buildroot}%{_libdir} %{buildroot}%{_includedir} make DESTDIR=%{buildroot}%{_prefix} install ) ( cd swig/python %{__python} setup.py install -O1 --skip-build --root %{buildroot} ) find %{buildroot} -name '*.a' -delete find %{buildroot} -name '*.la' -delete find %{buildroot} -name '*.so*' | xargs chmod 755 mkdir -p %{buildroot}%{_javadir} install -pm 644 dist/juniversalchardet-%{version}.jar %{buildroot}%{_javadir}/juniversalchardet.jar install -pm 644 dist/juniversalchardet-example-%{version}.jar %{buildroot}%{_javadir}/juniversalchardet-example.jar mkdir -p %{buildroot}%{_mavenpomdir} install -pm 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP-juniversalchardet.pom %add_maven_depmap JPP-juniversalchardet.pom juniversalchardet.jar mv %{buildroot}%{_mavendepmapfragdir}/%{name} %{buildroot}%{_mavendepmapfragdir}/juniversalchardet mkdir -p %{buildroot}%{_javadocdir}/juniversalchardet cp -pr dist/docs/* %{buildroot}%{_javadocdir}/juniversalchardet %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %{_libdir}/libuchardet.so.* %doc c/MPL-1.1.txt c/readme-en.txt c/readme.txt %files devel %{_includedir}/universalchardet.h %{_libdir}/libuchardet.so %doc MPL-1.1.txt %files -n juniversalchardet %{_javadir}/juniversalchardet.jar %{_javadir}/juniversalchardet-example.jar %{_mavenpomdir}/JPP-juniversalchardet.pom %{_mavendepmapfragdir}/juniversalchardet %doc MPL-1.1.txt readme.txt %files -n juniversalchardet-javadoc %{_javadocdir}/juniversalchardet %doc MPL-1.1.txt %files -n python-cchardet %{python_sitearch}/cchardet-%{py_cchardet_version}-py%{python_version}.egg-info %{python_sitearch}/_cchardet.so %{python_sitearch}/cchardet.py* %doc MPL-1.1.txt %changelog * Mon Jan 21 2013 gil cattaneo 1.0.3-1 - initial rpm