# Makefile for the cstrings tool by Eric S. Raymond
-# Note: When the version changes, you also have to change the RPM spec file.
-VERS=2.2
+VERS=$(shell sed <cstrings.spec -n -e '/Version: \(.*\)/s//\1/p')
CFLAGS=-O
LDFLAGS=-s
@(cd ..; rm cstrings-$(VERS))
dist: cstrings-$(VERS).tar.gz
-
-RPMROOT=/usr/src/redhat
-RPM = rpm
-RPMFLAGS = -ba
-rpm: dist
- cp cstrings-$(VERS).tar.gz $(RPMROOT)/SOURCES;
- cp cstrings.spec $(RPMROOT)/SPECS
- cd $(RPMROOT)/SPECS; $(RPM) $(RPMFLAGS) cstrings.spec
- cp $(RPMROOT)/RPMS/`arch|sed 's/i[4-9]86/i386/'`/cstrings-$(VERS)*.rpm .
- cp $(RPMROOT)/SRPMS/cstrings-$(VERS)*.src.rpm .
* by Eric S. Raymond <esr@snark.thyrsus.com>, July 10 1990
*
* version 2.0, November 15 1993 -- strict ANSI/POSIX conformance.
+ * version 2.3, December 29 2003 -- remplace tempnam(3) with mkstemp(3)
*/
#include <unistd.h>
#include <stdio.h>
(void) strcat(buf, argv[optind]);
if (cp = strrchr(buf, '/'))
*cp = '\0';
- if ((tf = tempnam(buf, "cstr")) == (char *)NULL)
+ strcpy(buf, "cstrXXXXXX");
+ if (mkstemp(buf))
{
perror("cstrings, making tempfile");
exit(1);
Name: cstrings
-Version: 2.2
+Version: 2.3
Release: 1
-URL: http://www.tuxedo.org/~esr/
+URL: http://www.catb.org/~esr/cstrings/
Source0: %{name}-%{version}.tar.gz
License: GPL
Group: Development/Tools
Summary: quick-and-dirty C code internationalization tool
+BuildRoot: %{_tmppath}/%{name}-root
%description
-A quick-and-dirty internationalization tool for C code. Extracts
-strings from a program and turns them into #defines in a pre-pended
-code section. Has good features for incremental use.
+A lightweight internationalization tool for C code, for those who find
+gettext too bulky and intrusive. Extracts strings from a program and
+turns them into #defines in a pre-pended code section. Has good
+features for building up your message base incrementally.
%prep
-%setup
+%setup -q
%build
make
+make cstrings.1
%install
-make install
+[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
+mkdir -p "$RPM_BUILD_ROOT"/usr/bin
+mkdir -p "$RPM_BUILD_ROOT"/usr/share/man/man1/
+cp cstrings "$RPM_BUILD_ROOT"/usr/bin
+cp cstrings.1 "$RPM_BUILD_ROOT"/usr/share/man/man1/
+
+%clean
+[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
%files
-/usr/share/man/man1/cstrings.1
-/usr/bin/cstrings
%doc READ.ME COPYING
+%{_bindir}/cstrings
+%{_mandir}/man1/cstrings.1*
+
+%changelog
+* Mon Dec 29 2003 Eric S. Raymond <esr@snark.thyrsus.com> 2.3-1
+- Use mkstemp(3) rather than tempnam(3) for security's sake.
+- Source RPMs no longer depend on --define myversion.
+
+* Wed Dec 24 2003 Eric S. Raymond <esr@snark.thyrsus.com> 2.2
+- Fixed RPM packaging.
+
+