Name:           m17n-lib
Version:        1.7.0
Release:        1%{?_dist_release}
Summary:        Multilingual text library
Summary(ja):    多言語テキストライブラリ

License:        LGPLv2+
Group:		System Environment/Libraries
URL:            http://www.nongnu.org/m17n/
Source0:        http://download.savannah.gnu.org/releases/m17n/%{name}-%{version}.tar.gz
Patch0:         %{name}-1.6.1-multilib.patch

BuildRoot: 	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	fontconfig-devel
BuildRequires:	fribidi-devel
BuildRequires:	gd-devel
BuildRequires:	libotf-devel
BuildRequires:	libthai-devel
BuildRequires:	libxml2-devel
BuildRequires:	libXt-devel
BuildRequires:	m17n-db-devel
BuildConflicts: anthy-devel
Requires:       m17n-db

Vendor: 	Project Vine
Distribution:	Vine Linux


%description
m17n-lib is a multilingual text library used primarily to allow
the input of many languages with the input table maps from m17n-db.

%package devel
Summary:	Development files for the %{name} package
Summary(ja):	%{name} の開発用ファイル
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires:	%{name}-tools = %{version}-%{release}
Requires:	pkgconfig

%description devel
Development files for the %{name} package.

%package  tools
Summary:	m17n GUI Library tools
Summary(ja):	m17n GUI ライブラリツール集
Group:		Applications/Text
Requires: 	m17n-db
Requires: 	%{name} = %{version}-%{release}

%description tools
Tools to test M17n GUI widget library.

%prep
%setup -q
%patch0 -p1

mkdir -p docs_to_include
cp -pr example docs_to_include

%build
autoreconf -ivf
%configure \
    --disable-rpath \
    --disable-static \
    --with-fontconfig \
    --with-gd

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

# parallel make usage with make command fails build on koji
make

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

# remove unused files
rm -f $RPM_BUILD_ROOT%{_libdir}/m17n/1.0/libmimx-anthy.so
rm -f $RPM_BUILD_ROOT%{_libdir}/m17n/1.0/libmimx-ispell.so


%clean
rm -rf $RPM_BUILD_ROOT

%check
make check

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%post tools -p /sbin/ldconfig
%postun tools -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS ChangeLog README
%dir %{_libdir}/m17n
%dir %{_libdir}/m17n/1.0
%{_bindir}/m17n-conv
%{_libdir}/libm17n.so.*
%{_libdir}/libm17n-core.so.*
%{_libdir}/libm17n-flt.so.*

%files devel
%defattr(-,root,root)
%doc docs_to_include/example
%{_bindir}/m17n-config
%{_includedir}/*
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*

%files tools
%defattr(-,root,root)
%{_bindir}/m17n-date
%{_bindir}/m17n-dump
%{_bindir}/m17n-edit
%{_bindir}/m17n-view
%{_libdir}/m17n/1.0/libm17n-X.so
%{_libdir}/m17n/1.0/libm17n-gd.so
%{_libdir}/libm17n-gui.so.*

%changelog
* Thu Apr  2 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.7.0-1
- update to 1.7.0
- fixed lib*.so.? location
- added BuildRequires: fribidi-devel, libthai-devel and m17-db-devel 
- added Japanese summary
- split tools into tools subpackage

* Sun Jul 20 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.4-1
- update to 1.6.4
- add BuildRequires: libXt-devel

* Mon Dec 30 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.5.5-5
- rebuild with VineSeed environment

* Wed Oct 02 2013 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.5-4
- rebuilt with gd-2.1.0.

* Sun May  8 2011 IWAI, Masaharu <iwai@alib.jp> 1.5.5-3
- add BuildRequires: libxml2-devel
- add BuildConflicts: anthy-devel

* Fri Oct 01 2010 Shu KONNO <owa@bg.wakwak.com> 1.5.5-2
- rebuilt with rpm-4.8.1 for pkg-config

* Sun Feb  7 2010 IWAI, Masaharu <iwai@alib.jp> 1.5.5-1
- new upstream release

* Tue Apr  7 2009 Shu KONNO <owa@bg.wakwak.com> 1.5.4-2
- dropt %%{?_smp_mflags}

* Wed Apr  1 2009 IWAI, Masaharu <iwai@alib.jp> 1.5.4-1
- initial release

