changeset 112:96b2eb7f25f5

move to autoconf/automake/docbook
author carl
date Sun, 18 Dec 2005 16:56:38 -0800
parents d0dad5610980
children a893afee4b80
files Makefile.am dnsbl.spec.in package src/Makefile.am
diffstat 4 files changed, 87 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Sun Dec 18 15:16:25 2005 -0800
+++ b/Makefile.am	Sun Dec 18 16:56:38 2005 -0800
@@ -1,10 +1,9 @@
 SUBDIRS = src man html info
-hackdir = $(sysconfdir)
+hackdir = $(sysconfdir)/dnsbl
 hack_SCRIPTS = dnsbl
-dconfdir = $(sysconfdir)/dnsbl
-dconf_DATA = dnsbl.conf hosts-ignore.conf html-tags.conf tld.conf
+hack_DATA = dnsbl.conf hosts-ignore.conf html-tags.conf tld.conf
 CLEANFILES = dnsbl xml/dnsbl xml/Makefile
-EXTRA_DIST = dnsbl.rc $(dconf_DATA) dnsbl.spec $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/d*)
+EXTRA_DIST = dnsbl.rc $(hack_DATA) dnsbl.spec $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/d*)
 
 dnsbl: $(srcdir)/dnsbl.rc
 	   rm -f dnsbl
@@ -14,7 +13,7 @@
 	       sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>dnsbl
 
 chkconfig: dnsbl
-	   mv -f $(sysconfdir)/dnsbl /etc/rc.d/init.d
+	   mv -f $(sysconfdir)/dnsbl/dnsbl /etc/rc.d/init.d
 	   /sbin/chkconfig --del dnsbl
 	   /sbin/chkconfig --add dnsbl
 
--- a/dnsbl.spec.in	Sun Dec 18 15:16:25 2005 -0800
+++ b/dnsbl.spec.in	Sun Dec 18 16:56:38 2005 -0800
@@ -1,11 +1,16 @@
-Summary: DNSBL Sendmail Milter
-Name: dnsbl
-Version: 5.10
-Release: 2
+%define localstatedir   /var/lib
+
+Summary:            @PACKAGE@ Sendmail Milter
+Name:               @PACKAGE@
+Version:            @VERSION@
+Release:            %{?custom_release}%{!?custom_release:1}
 Copyright: GPL
 Group: System Environment/Daemons
-Source: http://www.five-ten-sg.com/util/dnsbl.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}
+Source:             http://www.five-ten-sg.com/@PACKAGE@/packages/@PACKAGE@-@VERSION@.tar.gz
+BuildRoot:          %{_tmppath}/%{name}-%{version}-buildroot
+URL:                http://www.five-ten-sg.com/@PACKAGE@/
+Vendor:             510 Software Group
+Packager:           510 Software Group
 
 Requires(pre):  /usr/sbin/groupadd
 Requires(pre):  /usr/sbin/useradd
@@ -30,68 +35,53 @@
 %setup
 
 %build
-pwd
-g++ -c $CXXFLAGS -pthread dnsbl.cpp
-g++ -o dnsbl dnsbl.o /usr/lib/libresolv.a -lmilter -pthread
+./configure --prefix=%{_prefix} \
+    --bindir=%{_bindir} --mandir=%{_mandir} \
+    --localstatedir=%{localstatedir} --libdir=%{_libdir} \
+    --datadir=%{_datadir} --includedir=%{_includedir} \
+    --sysconfdir=%{_sysconfdir}
+make
+
 
 %install
-DST=%{buildroot}
-if [ "%{buildroot}" = "/" -o -z "%{buildroot}" ] ; then
-        echo sorry, you probably do not want me to delete the old buildroot at %{buildroot}
+if [ "$RPM_BUILD_ROOT" = "/" -o -z "$RPM_BUILD_ROOT" ] ; then
+        echo sorry, you probably do not want me to delete the old buildroot at $RPM_BUILD_ROOT
         exit 1
 fi
-
-rm -rf %{buildroot}
-mkdir -p %{buildroot}/etc/dnsbl
+rm -rf $RPM_BUILD_ROOT
+make prefix=$RPM_BUILD_ROOT%{_prefix} bindir=$RPM_BUILD_ROOT%{_bindir} \
+    mandir=$RPM_BUILD_ROOT%{_mandir} libdir=$RPM_BUILD_ROOT%{_libdir} \
+    localstatedir=$RPM_BUILD_ROOT%{localstatedir} \
+    datadir=$RPM_BUILD_ROOT%{_datadir} \
+    includedir=$RPM_BUILD_ROOT%{_includedir} \
+    sysconfdir=$RPM_BUILD_ROOT%{_sysconfdir} install
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/@PACKAGE@-@VERSION@
+mv -f $RPM_BUILD_ROOT%{_sysconfdir}/dnsbl/dnsbl      $RPM_BUILD_ROOT/etc/rc.d/init.d
+mv AUTHORS COPYING ChangeLog NEWS README             $RPM_BUILD_ROOT%{_datadir}/doc/@PACKAGE@-@VERSION@
+mkdir -p %{buildroot}/var/run/@PACKAGE@
 
-install -m 644 dnsbl.conf %{buildroot}/etc/dnsbl/dnsbl.conf
-install -m 644 hosts-ignore.conf %{buildroot}/etc/dnsbl/hosts-ignore.conf
-install -m 644 html-tags.conf %{buildroot}/etc/dnsbl/html-tags.conf
-install -m 644 tld.conf %{buildroot}/etc/dnsbl/tld.conf
-install -m 644 sample.conf %{buildroot}/etc/dnsbl/sample.conf
-
-mkdir -p %{buildroot}/usr/sbin
-install -m 755 dnsbl %{buildroot}/usr/sbin/dnsbl
-
-mkdir -p %{buildroot}/etc/rc.d/init.d
-install -m 755 dnsbl.rc %{buildroot}/etc/rc.d/init.d/dnsbl
-
-mkdir -p %{buildroot}/var/run/dnsbl
 
 %pre
 /usr/bin/getent passwd dnsbl ||
   useradd -r -d /etc/dnsbl -M -c "dnsbl pseudo-user" -s /sbin/nologin dnsbl
 
-#[JOG] Attempt to migrate an existing, non-rpm install.
-#      WARNING! This may cause blindness, loss of appetite, and a general
-#      feeling of ill will towards the author of this script. Please refer
-#      to the Licence file for warranty information...
-if [ -f "/var/dnsbl/dnsbl.conf" -a ! -f "/etc/dnsbl/dnsbl.conf" ] ; then
-        echo Existing installation found at /var/dnsbl/ Migrating configuation...
-        # create the conf directory so rpm can find it in a minute...
-        mkdir /etc/dnsbl/
-        # and try to copy all of the relavent config files that are below this directory
-        cd /var/dnsbl/
-        grep '^include ' /var/dnsbl/dnsbl.conf  | cut -d ' ' -f 2 | grep -v '^/' | xargs cp --target-directory=/etc/dnsbl/ /var/dnsbl/dnsbl.conf
-fi
-
 
 %post
-/sbin/chkconfig --add dnsbl
+/sbin/chkconfig --add @PACKAGE@
 /sbin/chkconfig dnsbl on
 /sbin/service dnsbl start
 
-echo Remember to edit /etc/dnsbl.conf and add the following line to your sendmail.mc:
+echo Remember to edit %{_sysconfdir}/@PACKAGE@/@PACKAGE@.conf and add the following line to your sendmail.mc:
 echo "INPUT_MAIL_FILTER(\`dnsbl\', \`S=local:/var/run/dnsbl/dnsbl.sock, F=T, T=C:30s;S:5m;R:5m;E:5m\')"
 echo
 
 
 %preun
-if [ $1 -eq 0 ]; then
-   /sbin/service dnsbl stop || :
-   /sbin/chkconfig --del dnsbl
-   userdel dnsbl || :
-fi
+/sbin/service @PACKAGE@ stop || :
+/sbin/chkconfig --del @PACKAGE@
+userdel @PACKAGE@ || :
+
 
 %postun
 
@@ -99,13 +89,20 @@
 
 %files
 %defattr(-,root,root)
-%config(noreplace) /etc/dnsbl/
-%doc RELEASE_NOTES LICENSE sample.conf test.cpp
-/etc/rc.d/init.d/dnsbl
-/usr/sbin/dnsbl
-%dir %attr(0750,dnsbl,root) /var/run/dnsbl
+%{_sbindir}/*
+%doc %{_mandir}/*
+%docdir %{_datadir}/doc/@PACKAGE@-@VERSION@
+%{_datadir}/doc/@PACKAGE@-@VERSION@
+%config(noreplace) %{_sysconfdir}/@PACKAGE@
+%config(noreplace) %{_sysconfdir}/@PACKAGE@/*.conf
+/etc/rc.d/init.d/@PACKAGE@
+%dir %attr(0750,@PACKAGE@,root) /var/run/@PACKAGE@
+
 
 %changelog
+* Sun Dec 18 2005 Carl Byington 1.0
+- use autoconf and http://www.fedora.us/docs/rpm-packaging-guidelines.html
+
 * Tue Jan 03 2005 Carl Byington 1.4
 - added hosts-ignore conf file
 - see RELEASE_NOTES
--- a/package	Sun Dec 18 15:16:25 2005 -0800
+++ b/package	Sun Dec 18 16:56:38 2005 -0800
@@ -14,41 +14,38 @@
 # cp -a html/*html $web
 make distcheck >$distlog 2>&1
 if [ $? -eq 0 ]; then
-    ls -al xml
-    exit
-
     if [ -f $BALL ]; then
         # expand locally to see the tarball
         rm -rf junk
-        mkdir junk
-        cd junk
-            tar xfz ../$BALL
-            cd $NAME-$VER
-                ./configure >/dev/null
-                make >/dev/null
-                make install >/dev/null
-                if [ -f /etc/rc.d/init.d/$NAME ]; then
-                    /etc/rc.d/init.d/$NAME stop
-                fi
-                make chkconfig
-                if [ -f /etc/rc.d/init.d/$NAME ]; then
-                    chkconfig $NAME on
-                    /etc/rc.d/init.d/$NAME start
-                fi
-            cd ..
-        cd ..
+     ## mkdir junk
+     ## cd junk
+     ##     tar xfz ../$BALL
+     ##     cd $NAME-$VER
+     ##         ./configure >/dev/null
+     ##         make >/dev/null
+     ##         make install >/dev/null
+     ##         if [ -f /etc/rc.d/init.d/$NAME ]; then
+     ##             /etc/rc.d/init.d/$NAME stop
+     ##         fi
+     ##         make chkconfig
+     ##         if [ -f /etc/rc.d/init.d/$NAME ]; then
+     ##             chkconfig $NAME on
+     ##             /etc/rc.d/init.d/$NAME start
+     ##         fi
+     ##     cd ..
+     ## cd ..
 
         # build rpm on target
         target=host62
         scp $BALL $target:/tmp
-        ssh $target "cd /tmp; rpmbuild -ta $BALL >/dev/null 2>&1"
+        ssh $target "cd /tmp; rpmbuild -ta $BALL"
 
         # add packages to the web site
         wp=$web/packages
         wp4=$wp/centos4
         rp=/usr/src/redhat
-        cp -a $BALL $wp
-        scp $target:$rp/SRPMS/$NAME-$VER*rpm $wp4
+        mv -f $BALL $wp
+        scp $target:$rp/SRPMS/$NAME-$VER*rpm $wp
         scp $target:$rp/RPMS/i386/$NAME-$VER*rpm $wp4
         (cd $web; chown --recursive web:web *; ls -alR)
         rpm -ql -p $wp4/$NAME-$VER*6.rpm
--- a/src/Makefile.am	Sun Dec 18 15:16:25 2005 -0800
+++ b/src/Makefile.am	Sun Dec 18 16:56:38 2005 -0800
@@ -5,7 +5,7 @@
 INCLUDES= $(all_includes)
 
 # the library search path.
-dnsbl_LDFLAGS = $(all_libraries) -pthread
+dnsbl_LDFLAGS = $(all_libraries) /usr/lib/libresolv.a -lmilter -pthread
 
 # default compile flags
 dnsbl_CXXFLAGS = -pthread