%global gitsnapshot 20111204

%define tex_destdir	%{_datadir}
%define texmf           %{_prefix}/share/texmf
%define texlive_src	%{tex_destdir}/texlive-sources
%define build_tex_destdir	%{buildroot}%{tex_destdir}
%define build_texmf     %{buildroot}%{texmf}
%define build_texlive_src	%{buildroot}%{tex_destdir}-sources

%define exec_texhash  [ -x %{_bindir}/texhash ] && PATH=%{_bindir}:$PATH %{_bindir}/texhash

Summary: A macro package to typeset Japanese texts using Lua(La)TeX
Name: texmacro-luatexja
Version: 0.0.0
Release: 1%{?gitsnapshot:.git%{gitsnapshot}}%{?_dist_release}
License: distributable
Group: Applications/Publishing
URL: http://sourceforge.jp/projects/luatex-ja/
Source0: luatexja-%{version}%{?gitsnapshot:.git%{gitsnapshot}}.tar.xz
Source10: luatexja-snapshot.sh

Requires: texlive-common >= 2011
Requires: texlive-collection-luatex >= 2011

BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root

Vendor:       Project Vine
Distribution: Vine Linux
Packager:     munepi


%description
LuaTeX-ja is a macro package to typeset Japanese texts using Lua(La)TeX. 
A goal of this project is to provide an equal or superior typesetting 
system to pTeX, which is a traditional standard Japanese TeX engine.

%description -l ja
Lua(La)TeX を用いて pTeX 同様の日本語処理を行うマクロの作成を目的とした
プロジェクトです．

%prep
%setup -q -n luatexja-%{version}

%build

%install
%__rm -rf $RPM_BUILD_ROOT

## core components
%__mkdir_p %{build_texmf}/tex/luatex/luatexja
%__cp -ra src/* %{build_texmf}/tex/luatex/luatexja || exit 1

## class files
%__mkdir_p %{build_texmf}/tex/lualatex/luatexja
%__mv %{build_texmf}/tex/luatex/luatexja/ltj{,s}classes %{build_texmf}/tex/lualatex/luatexja/ || exit 1

## doc
%__mkdir_p %{build_texmf}/doc/luatexja
%__cp -a doc/* %{build_texmf}/doc/luatexja/ || exit 1
%__cp -ra test tool %{build_texmf}/doc/luatexja/ || exit 1


%clean
%__rm -rf $RPM_BUILD_ROOT

%post
%{exec_texhash}

%postun
if [ "$1" = 0 ]; then
    %{exec_texhash}
fi


%files
%defattr(-,root,root,-)
%doc
%{texmf}/tex/luatex/luatexja
%{texmf}/tex/lualatex/luatexja
%{texmf}/doc/luatexja


%changelog
* Sun Dec  4 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.0-1.git20111204
- initial build
