File cook.spec of Package cook

#
# spec file for package cook (Version 2.25)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           cook
BuildRequires:  bison ed sharutils
Summary:        A File Construction Tool (Think 'make')
Version:        2.25
Release:        188
License:        GPL v2 or later
Group:          Development/Tools/Building
Source:         http://www.canb.auug.org.au/~millerp/cook/cook-%{version}.tar.gz
Source1:        filelist
Patch0:         cook-2.24.diff
Url:            http://www.canb.auug.org.au/~millerp/cook/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Cook is a tool for constructing files. It is given a set of files to
create and recipes of how to create them. In any nontrivial program,
there are prerequisites to perform the actions necessary to create any
file, such as include files.  The cook program provides a mechanism to
define these.

When a program is being developed or maintained, the programmer
typically changes one file of several that comprise the program.  Cook
examines the last-modified times of the files to see when the
prerequisites of a file have changed, implying that the file needs to
be recreated as it is logically out of date.

Cook also provides a facility for implicit recipes, allowing users to
specify how to form a file with a given suffix from a file with a
different suffix.  For example, to create filename.o from filename.c.

* Cook is a replacement for the traditional make(1) tool.  However,
   it is necessary to convert make files into cookbooks using the
   make2cook utility included in the distribution.

* Cook has a simple but powerful string-based description language
   with many built-in functions.  This allows sophisticated filename
   specification and manipulation without loss of readability or
   performance.

* Cook is able to use fingerprints to supplement file modification
   times.  This allows build optimization without contorted rules.

* Cook is able to build your project with multiple parallel threads,
   with support for rules that must be single threaded.  It is
   possible to distribute parallel builds over your LAN, allowing
   you to turn your network into a virtual parallel build engine.

If you are putting together a source-code distribution and planning to
write a make file, consider writing a cookbook instead.  Although Cook
takes a day or two to learn, it is much more powerful and a bit more
intuitive than the traditional make(1) tool.



Authors:
--------
    Peter Miller <millerp@canb.auug.org.au>

%prep
%setup -q
%patch0
if test "$(id -u)" = "0" 
then
    # create a tester account who will do the build 
    useradd -m tester || :
    # when building in the SuSE autobuild environment, protect the
    # root account with some password
    test "$BUILD_BASENAME" && echo root:root | chpasswd
    # setup and build as user
    chown -R tester .
fi

%build
function cook_build
{
    id
    # The two TOKENTYPE definitions are a quick remedy for the
    # conflicts arising in lex.c by the new bison >= 1.75 feature to
    # generate enums for tokens in addition to #defines.
    CFLAGS="$RPM_OPT_FLAGS -Dparse_TOKENTYPE -Dhashline_TOKENTYPE" \
	./configure \
	--prefix=/usr \
	--mandir=%_mandir \
	--libdir=%_libdir
    make
    # selftest
    make sure
}
export -f cook_build
if test "$(id -u)" = "0" 
then
    su tester bash -c cook_build
else
    cook_build
fi

%install
test "$RPM_BUILD_ROOT" -a -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" &&
   rm -rf $RPM_BUILD_ROOT
# remove the ugly markers from previous make install runs
find -name '.*' -type f '!' -name '.bin' | xargs rm -f
make RPM_BUILD_ROOT=$RPM_BUILD_ROOT install
# Check the filelists after a pristine make install.  this is a hook
# for the package maintainer to see if the %files section needs
# modifications.
cd $RPM_BUILD_ROOT
find -ls |
tr -s "[:blank:]" " " |
sed "s,%_libdir,/LIBDIR,;s,^[[:blank:]]\\+,," |
cut -d" " -f 3,5,6,11-  |
sort -u -k4 > %{S:1}.new
#
diff -u  %{S:1} %{S:1}.new
# modify the installed system to FHS and SuSE standards
rm -rf ./%_datadir/cook/en/man*
mkdir -p usr/share/doc/packages/cook
mv ./%_datadir/cook/en usr/share/doc/packages/cook

%files
%defattr(-,root,root)
%doc /usr/share/doc/packages/cook
%doc %_mandir/man1/c_incl.1*
%doc %_mandir/man1/cook.1*
%doc %_mandir/man1/cook_bom.1*
%doc %_mandir/man1/cook_lic.1*
%doc %_mandir/man1/cook_rsh.1*
%doc %_mandir/man1/cookfp.1*
%doc %_mandir/man1/cooktime.1*
%doc %_mandir/man1/find_libs.1*
%doc %_mandir/man1/make2cook.1*
%doc %_mandir/man1/roffpp.1*
/usr/bin/c_incl
/usr/bin/cook
/usr/bin/cook_bom
/usr/bin/cook_rsh
/usr/bin/cookfp
/usr/bin/cooktime
/usr/bin/find_libs
/usr/bin/make2cook
/usr/bin/roffpp
%dir %_libdir/cook
%dir %_libdir/cook/en
%dir %_libdir/cook/en/LC_MESSAGES
%_libdir/cook/en/LC_MESSAGES/c_incl.mo
%_libdir/cook/en/LC_MESSAGES/cook.mo
%_libdir/cook/en/LC_MESSAGES/cook_bom.mo
%_libdir/cook/en/LC_MESSAGES/cookfp.mo
%_libdir/cook/en/LC_MESSAGES/cooktime.mo
%_libdir/cook/en/LC_MESSAGES/file_check.mo
%_libdir/cook/en/LC_MESSAGES/find_libs.mo
%_libdir/cook/en/LC_MESSAGES/make2cook.mo
%_libdir/cook/en/LC_MESSAGES/roffpp.mo
%dir /usr/share/cook
/usr/share/cook/as
/usr/share/cook/bison
/usr/share/cook/c
/usr/share/cook/c++
/usr/share/cook/f77
/usr/share/cook/functions
/usr/share/cook/g77
/usr/share/cook/gcc
/usr/share/cook/home
/usr/share/cook/host_lists.pl
/usr/share/cook/lex
/usr/share/cook/library
/usr/share/cook/print
/usr/share/cook/program
/usr/share/cook/rcs
/usr/share/cook/recursive
/usr/share/cook/sccs
/usr/share/cook/text
/usr/share/cook/usr
/usr/share/cook/usr.local
/usr/share/cook/yacc
/usr/share/cook/yacc_many

%clean
rm -rf $RPM_BUILD_ROOT

%changelog
* Thu Mar 29 2007 dmueller@suse.de
- update BuildRequires
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Mon May 09 2005 ro@suse.de
- update to 2.25
- build as normal user
* Fri Apr 08 2005 coolo@suse.de
- fix build with gcc4
* Thu Feb 19 2004 froh@suse.de
- upgrade to current cook version 2.24: bugfix and documentation
  improvement release
* Tue Jul 15 2003 froh@suse.de
- upgrade to current cook version 2.23
* Thu Jun 19 2003 mmj@suse.de
- Fix dir list
* Mon Jun 09 2003 mmj@suse.de
- Package all files
* Thu Jan 16 2003 froh@suse.de
- update to current cook version 2.21
* Wed Nov 13 2002 froh@suse.de
- handle enum generation of new bison 1.75 gracefully
- clean up filelist check in specfile
* Tue Aug 13 2002 froh@suse.de
- created package
openSUSE Build Service is sponsored by