##################### GENERAL ##################### 
GARNAME = ntp
GARVERSION = 4.2.8p15
GARELEASE = 4
HOME_URL = http://www.ntp.org/
CATEGORIES = net
MASTER_SITES += https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/
DISTFILES = ntp-$(GARVERSION).tar.gz
PATCHFILES = 
MAINTAINER = Felipe Sanchez <izto@asic-linux.com.mx>
LICENSE = NTP


DESCRIPTION = Network Time Protocol daemon
define BLURB
A client and server to keep the time synchronized
between various computers over a network.

This package is the official reference implementation of the NTP protocol.
endef

##################### PACKAGING #####################


#IZTACI_PACKAGE_PATH =

# Users and groups the binary package will create
# WHEN INSTALLED ON THE DESTINATION SYSTEM
CREATE_GROUPS = ntp:68 
CREATE_USERS = ntp:68:68:/var/lib/ntp:/bin/false

# This is to be appended to the package's installation script
# Use it to set file owners, permissions, DB initialization, etc.
# Remember any shell variables (Such as $ROOT) have to be escaped
# like this: \$$ROOT

define DOINST_APPEND
chown -v ntp:ntp \$$ROOT/var/lib/ntp
echo ------------------------------------------------------------------
echo s6-rc services installed:
echo
echo \"    ntp-server\"
echo \"    ntp-log\"
echo \"    ntp\"
echo
echo Run \'rc update\' to add them to the live services database.
echo
echo ------------------------------------------------------------------
endef

# Required dependencies
define SLACK_REQUIRED
openssl
libcap
ncurses
readline
endef

# Suggested dependencies
define SLACK_SUGGESTS
endef

# Package conflicts (lprng vs cups for example)
define SLACK_CONFLICTS
endef



##################### BUILDING #####################

# Directories to be created as part of the install process.
# Can be inside the final package or just transient dirs we need
# while building it.
INSTALL_DIRS += $(DESTDIR)/etc/sysconfig
INSTALL_DIRS += $(DESTDIR)/etc/s6-rc/source
INSTALL_DIRS += $(DESTDIR)/var/lib/ntp

CONFIGURE_SCRIPTS = $(WORKSRC)/configure
BUILD_SCRIPTS = $(WORKSRC)/Makefile
INSTALL_SCRIPTS = $(WORKSRC)/Makefile

CONFIGURE_ARGS = $(DIRPATHS)
NODIRPATHS = 

# If some dirs are trying to install into /, list their names
# here, such as: prefix bindir mandir
INSTALL_OVERRIDE_DIRS = 


# Dependencies are of the form categorydir/packagedir
# LIBDEPS are for libraries, and DEPENDS are for everything else
DEPENDS =
LIBDEPS =
DEPENDS =
# Builddeps are installed in the build DESTIMG
BUILDDEPS =

##################### GAR #####################

# This should go before any hand-made rules.
include config.mk
include ../level.mk

##################### CUSTOMIZING #####################

pre-configure:
	cd $(WORKSRC); sed -e 's/"(\\S+)"/"?([^\\s"]+)"?/' -i scripts/update-leap/update-leap.in
	$(MAKECOOKIE)

test:
	cd $(WORKSRC); make check
	$(MAKECOOKIE)

post-install:
	$(MAKE) test
	$(MAKE) s6rc
	$(MAKE) sysconfig
	$(MAKE) strip
	$(MAKE) gzip-man
	$(MAKECOOKIE)
