Add autotools and build system by Oron Peled.
[icmp-dn.git] / admin / icmpdn.spec.in
diff --git a/admin/icmpdn.spec.in b/admin/icmpdn.spec.in
new file mode 100644 (file)
index 0000000..051d48a
--- /dev/null
@@ -0,0 +1,66 @@
+Name:          icmpdn
+Version:       @VERSION@
+Release:       1
+Vendor:                Fredrik Tolf <fredrik@dolda2000.com>
+License:       LGPL for library, GPL for utilities
+Group:         System Environment/Libraries
+Summary:       ICMP host name utilities
+Source:                %name-%version.tar.gz
+URL:           http://www.dolda2000.com/~fredrik/icmp-dn/
+BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+%description
+Since the Linux kernel does not support the ICMP host name facilities as
+described in RFC 1788, I wrote a simple implementation in user-space.
+It comprises three parts:
+
+    * icmpdnd – The ICMP Domain Name daemon, which listens to ICMP
+      domain name requests and replies to them.
+
+    * idnlookup – A user utility to query a host for its host name over
+      ICMP. Like ping and all other utilities that use ICMP, it needs to
+      be installed SUID root.
+
+    * libnss_icmp.so.2 – A glibc NSS module, which uses idnlookup to
+      perform queries for the gethostbyaddr function.
+
+%prep
+%setup
+
+%build
+CXXFLAGS="$RPM_OPT_FLAGS" CFLAGS="$RPM_OPT_FLAGS"      \
+       ./configure                     \
+       --prefix=%_prefix               \
+       --sysconfdir=%_sysconfdir       \
+       --libdir=/lib
+make
+
+%install
+[ "$RPM_BUILD_ROOT" != "/" ] && [ -d "$RPM_BUILD_ROOT" ] && rm -rf "$RPM_BUILD_ROOT"
+mkdir $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+
+%post
+# $1 = 0 is remove; $1 = 1 is update
+
+%postun
+# $1 = 0 is remove; $1 = 1 is update
+
+%files
+%defattr(-,root,root)
+/lib/libnss_icmp.so
+/lib/libnss_icmp.la
+/lib/libnss_icmp.so.2.0.0
+/lib/libnss_icmp.so.2
+%config %{_sysconfdir}/nss-icmp.conf
+
+%attr(4755,root,root) %{_bindir}/idnlookup
+
+%{_sysconfdir}/init.d/icmpdnd
+%{_sbindir}/icmpdnd
+
+%doc AUTHORS ChangeLog COPYING INSTALL NEWS README
+
+%clean
+[ "$RPM_BUILD_ROOT" != "/" ] && [ -d "$RPM_BUILD_ROOT" ] && rm -rf "$RPM_BUILD_ROOT"
+