detex for CentOS

So another little porting effort. This time it is detex
DeTeX is a filter program that removes the LaTeX (or TeX) control sequences from the input so that the real content can be passed to a spell or diction checker.
I am using this for my dissertation to count the words used
detex dissertation.tex | wc
Quite a useful little tool. When I get time I might rewrite it in perl to make it more portable.

Download the [RPM]

[SRPM] and spec file:

Summary: Strips Tex and LaTex commands from a file
Name: detex
Version: 2.8
Release: 1
License: BSD
Group: Applications/Text
URL: http://www.cs.purdue.edu/homes/trinkle/detex/

Source: http://www.cs.purdue.edu/homes/trinkle/detex/%{name}-%{version}.tar
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

Patch0: mallocandtroff.patch

BuildRequires: flex
BuildRequires: groff

%description
DeTeX is a filter program that removes the LaTeX (or TeX)
control sequences from the input so that the real content can be
passed to a spell or diction checker


%prep
%setup
%patch -p0

%build
%{__make} detex man-page prefix="%{_prefix}" CFLAGS="%{optflags} -DNO_MALLOC_DECL"

%install
%{__rm} -rf %{buildroot}
#%{__make} install DESTDIR="%{buildroot}"
%{__install} -Dp -m0755 detex %{buildroot}%{_bindir}/detex
%{__install} -Dp -m0644 detex.1 %{buildroot}%{_mandir}/man1/detex.1

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root, 0755)
%doc %{_mandir}/man1/detex.1*
%{_bindir}/detex

%changelog
* Tue Apr 21 2009 Hoffmann Geerd-Dietger - 2.8-1
- Initial package.


You will also need the little patch file
--- Makefile.orig 2009-04-21 01:50:44.735919044 +0100
+++ Makefile 2009-04-21 01:51:18.237692007 +0100
@@ -49,7 +49,7 @@
# Compile time flags, just uncomment the necessary lines
# Some say GNU make does not correctly handle += -- you may have to use :=
#
-DEFS =
+DEFS += -DNO_MALLOC_DECL
#
# Add -traditional for GNU cc on ISC 386/ix system and possibly others
# (reported by pinard@iro.umontreal.ca)
@@ -116,7 +116,7 @@
mv detex.c lexout.c

man-page:
- troff -man detex.1l
+ nroff -man detex.1l > detex.1

# If you want detex available as delatex, uncomment the last two lines of
# this target

No comments: