%global rubyabi 1.8 %global ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']") %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %global repoid 50807 %global mainver 1.97.4 #%%global betaver a %global fedoraver 1 %global enable_python3 0 %if 0%{?fedora} >= 13 # Disable python3 support for now, how to handle NON-utf8 string # in python3 with skf... %global enable_python3 0 %endif Name: skf Version: %{mainver} Release: %{?betaver:0.}%{fedoraver}%{?betaver:.%betaver}%{?dist} Summary: Utility binary files in Simple Kanji Filter Group: Applications/Text License: BSD and MIT and UCD URL: http://sourceforge.jp/projects/skf/ Source0: http://dl.sourceforge.jp/skf/%{repoid}/skf_%{mainver}%{?betaver}.tar.gz Source1: skf-basic-test.sh # common BR BuildRequires: gettext # BR for extenstions BuildRequires: swig BuildRequires: ruby BuildRequires: ruby-devel BuildRequires: ruby(abi) = %{rubyabi} BuildRequires: perl(ExtUtils::Embed) BuildRequires: python2-devel %if %enable_python3 BuildRequires: python3-devel %endif Requires: %{name}-common = %{version}-%{release} %package common Summary: Common files for Simple Kanji Filter - i18n kanji converter Group: Applications/Text %package ruby Summary: Ruby extension module for %{name} Group: Development/Languages Requires: %{name}-common = %{version}-%{release} Requires: ruby(abi) = %{rubyabi} Provides: ruby(skf) = %{version}-%{release} %package python Summary: Python extension module for %{name} Group: Development/Languages Requires: %{name}-common = %{version}-%{release} %if %enable_python3 %package python3 Summary: Python3 extension module for %{name} Group: Development/Languages Requires: %{name}-common = %{version}-%{release} %endif %package perl Summary: Perl extension module for %{name} Group: Development/Languages Requires: %{name}-common = %{version}-%{release} Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %description This package contains utility binary files in skf. %description common skf is an i18n-capable kanji filter. skf is designed for reading documents in various languages and codes using kanji or unicode capable display devices. Like other kanji filters, skf provides basic Japanese kanji code conversion features, include to/from JIS, EUC, Shift-JIS, UCS2, KEIS83 and UTF-7/8, but also support various international codesets include Korian and Chinese standard codesets. Unlike nkf, skf does not provide additional fancy features like broken jis recovery, but it has support for ISO-8859's, European domestic sets, JIS X-0212/X-0213 code conversion, IBM gaiji support and can add other code supports easily. This package contains files commonly used by other skf related packages. %description ruby This package contains Ruby extension module for skf. %description python This package contains Python extension module for skf. %if %enable_python3 %description python3 This package contains Python3 extension module for skf. %endif %description perl This package contains Perl extension module for skf. %prep %setup -q -c -T -a 0 ln -sf %{name}-* main cp -p %SOURCE1 . pushd main ## Fixing build error # Fix pythonext build error on F-14+ sed -i -e '/python_version=.*substr/s|7,-3|7,3|' configure ## configure option, etc # change optflags, don't strip sed -i.flags -e 's|-Wno-format-security||' configure ## directory change # change the directory where tables are to be installed sed -i.table -e "s|^lskfdir=.*$|lskfdir='%{_libdir}/%{name}'|" configure ## documents # EUC-JP related sed -i.eucjp -e '/JOMANDIR/d' Makefile.in iconv -f EUC-JP -t UTF-8 -o CHANGES_ja.txt{.utf-8,} touch -r CHANGES_ja.txt{,.utf-8} mv CHANGES_ja.txt{.utf-8,} popd # from main # Okay, duplicate main directory for ext in \ %if %enable_python3 python3 \ %endif ruby perl python do mkdir -p $ext cp -pr main/* $ext done # change optflags # add -fno-strict-aliasing %global optflags_old %optflags %global optflags %optflags_old -fno-strict-aliasing %build # Parallel make all unsafe OPTS="" OPTS="$OPTS --enable-debug" OPTS="$OPTS --disable-strip" OPTS="$OPTS --with-ruby_sitearch_dir=%{ruby_sitearch}" PYTHONOPTS="$OPTS --with-python_sitearch_dir=%{python_sitearch}" %if %enable_python3 PYTHON3OPTS="$OPTS --enable-python3 --with-python_sitearch_dir=%{python3_sitearch}" %endif # A. main pushd main %configure $OPTS make -j1 popd # B. extensions for ext in \ ruby perl python do pushd $ext %configure $OPTS $PYTHONOPTS unset CFLAGS make -j1 ${ext}ext popd done # python3 %if %enable_python3 pushd python3 export PYTHON=python3 %configure $OPTS $PYTHON3OPTS unset CFLAGS # The following is pythonext, not python3ext make -j1 pythonext unset PYTHON popd %endif # tweak find-debuginfo.sh %global __debug_install_post_old %__debug_install_post %global __debug_install_post \ \ %__debug_install_post_old \ pushd %{buildroot}%{_prefix}/src/debug/%{?buildsubdir} \ for ext in \\\ python3 \\\ ruby python perl \ do \ test -d $ext || continue \ cd $ext \ for file in * \ do \ if test -f ../main/$file \ then \ status=$(cmp --quiet $file ../main/$file && echo $? || echo $?) \ if test $status = 0 ; then \ ln -sf ../main/$file $file \ fi \ fi \ done \ cd .. \ done \ popd \ %{nil} %install rm -rf %{buildroot} OPTS="" OPTS="${OPTS} DESTDIR=%{buildroot}" OPTS="${OPTS} INSTALL='install -p'" OPTS="${OPTS} INSTALL_DATA='install -p -m 0644'" OPTS="$OPTS JMANDIR=%{_mandir}/ja/man1" # A. main eval make -C main ${OPTS} install locale_install # Kill documents, will install with %%doc rm -rf %{buildroot}%{_defaultdocdir} # B. extentions for ext in ruby python do eval make -C $ext ${OPTS} ${ext}ext_install done ## python3 %if %enable_python3 ( eval make -C python3 ${OPTS} pythonext_install ) %endif ## perl pushd perl mkdir -p %{buildroot}%{perl_vendorarch}/auto/Skf install -cpm 0644 Skf.pm %{buildroot}%{perl_vendorarch} install -cpm 0755 skf.so %{buildroot}%{perl_vendorarch}/auto/Skf/Skf.so popd ## Cleanup chmod 0644 %{buildroot}%{python_sitearch}/skf.py %find_lang %{name} %check # Setting environ export PATH=%{buildroot}%{_bindir}:$PATH export PERL5LIB=%{buildroot}%{perl_vendorarch} export python2PATH=%{buildroot}%{python_sitearch} %if %enable_python3 export python3PATH=%{buildroot}%{python3_sitearch} %endif export RUBYLIB=%{buildroot}%{ruby_sitearch} # SOURCE1 sh skf-basic-test.sh %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{_bindir}/skf %{_mandir}/man1/skf.1* %lang(ja) %{_mandir}/ja/man1/skf.1* %files common -f %{name}.lang %defattr(-,root,root,-) %lang(ja) %doc main/CHANGES_ja.txt %doc main/README.txt %doc main/copyright %lang(ja) %doc main/doc/ %{_libdir}/%{name}/ %files ruby %defattr(-,root,root,-) %{ruby_sitearch}/skf.so %files python %defattr(-,root,root,-) %{python_sitearch}/_skf.so %{python_sitearch}/skf.py* %if %enable_python3 %files python3 %defattr(-,root,root,-) %{python3_sitearch}/_skf.so %{python3_sitearch}/skf.py* %endif %files perl %defattr(-,root,root,-) %{perl_vendorarch}/Skf.pm %{perl_vendorarch}/auto/Skf/ %changelog * Wed Feb 9 2011 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.97.4-1 - 1.97.4 * Thu Nov 4 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.97.3-1 - 1.97.3 * Thu Aug 12 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.97.2-1 - 1.97.2 - The method to build python3 binding is now written in the spec file, however for now not activate it * Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 1.97.1-2.2 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild * Wed Jun 02 2010 Marcela Maslanova <mmaslano@redhat.com> - 1.97.1-2.1 - Mass rebuild with perl-5.12.0 * Thu Apr 1 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.97.1-2 - 1.97.1 * Thu Mar 25 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.97.0-0.2.a - Remove useless sed line - Move man pages to "main" package * Sat Mar 20 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.97.0-0.1.a - 1.97.0a - Initial packaging