From 6daa792eab1488d013fefc5eb7e4d01f40f38687 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 7 Feb 2010 20:03:20 +0100 Subject: change defaults for CONFIG/BUILD/INSTALL styles All packages need an update, so here is a very huge commit. Most of the 460 source packages use automatic style for configuration, building and installing. Make these styles default to "auto". If you have a package, which does not conform to this, just use manual style and add a do-$task make target. I added a new style named AUTOTOOL style, which is needed for some broken packages, which needs to be updated via autoconf or automake. I renamed CONFIGURE_STYLE to CONFIG_STYLE. Updates for some packages, which have newer upstream versions. Renaming of all package/*/extra directories. Use the directory src/ to provide overwrites of source files or to add the code, when no upstream package is available or used. src directory will be automatically used. --- package/openntpd/Makefile | 4 +- package/openntpd/extra/openbsd-compat/port-linux.c | 107 --------------------- package/openntpd/src/openbsd-compat/port-linux.c | 107 +++++++++++++++++++++ 3 files changed, 109 insertions(+), 109 deletions(-) delete mode 100644 package/openntpd/extra/openbsd-compat/port-linux.c create mode 100644 package/openntpd/src/openbsd-compat/port-linux.c (limited to 'package/openntpd') diff --git a/package/openntpd/Makefile b/package/openntpd/Makefile index 5c8cf0fd5..328559f3a 100644 --- a/package/openntpd/Makefile +++ b/package/openntpd/Makefile @@ -19,10 +19,10 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,OPENNTPD,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -CONFIGURE_STYLE:= gnu +INSTALL_STYLE:= manual + CONFIGURE_ARGS+= --with-privsep-user=ntp \ --with-adjtimex -BUILD_STYLE:= auto do-install: ${INSTALL_DIR} ${IDIR_OPENNTPD}/etc diff --git a/package/openntpd/extra/openbsd-compat/port-linux.c b/package/openntpd/extra/openbsd-compat/port-linux.c deleted file mode 100644 index f210d4a6d..000000000 --- a/package/openntpd/extra/openbsd-compat/port-linux.c +++ /dev/null @@ -1,107 +0,0 @@ -/* $Id: port-linux.c 1793 2007-01-28 20:55:08Z tg $ */ - -/* part of the adjtime-linux patch */ - -/* - * Copyright (c) 2004 Darren Tucker - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "includes.h" - -#ifdef USE_ADJTIMEX -#include -#include -#ifdef adjtime -# undef adjtime -#endif - -#include "ntpd.h" - -/* scale factor used by adjtimex freq param. 1 ppm = 65536 */ -#define ADJTIMEX_FREQ_SCALE 65536 - -/* maximum change to skew per adjustment, in PPM */ -#define MAX_SKEW_DELTA 5.0 - -int -_compat_adjtime(const struct timeval *delta, struct timeval *olddelta) -{ - static struct timeval tlast = {0,0}; - static double tskew = 0; - static int synced = -1; - struct timeval tnow, tdelta; - double skew = 0, newskew, deltaskew, adjust, interval = 0; - struct timex tmx; - int result, saved_errno; - - gettimeofday(&tnow, NULL); - adjust = (double)delta->tv_sec; - adjust += (double)delta->tv_usec / 1000000; - - /* Even if the caller doesn't care about the olddelta, we do */ - if (olddelta == NULL) - olddelta = &tdelta; - - result = adjtime(delta, olddelta); - saved_errno = errno; - - if (olddelta->tv_sec == 0 && olddelta->tv_usec == 0 && - synced != INT_MAX) - synced++; - else - synced = 0; - - /* - * do skew calculations if we have synced - */ - if (synced == 0 ) { - tmx.modes = 0; - if (adjtimex(&tmx) == -1) - log_warn("adjtimex get failed"); - else - tskew = (double)tmx.freq / ADJTIMEX_FREQ_SCALE; - } else if (synced >= 1) { - interval = (double)(tnow.tv_sec - tlast.tv_sec); - interval += (double)(tnow.tv_usec - tlast.tv_usec) / 1000000; - - skew = (adjust * 1000000) / interval; - newskew = ((tskew * synced) + skew) / synced; - deltaskew = newskew - tskew; - - if (deltaskew > MAX_SKEW_DELTA) { - log_info("skew change %0.3lf exceeds limit", deltaskew); - tskew += MAX_SKEW_DELTA; - } else if (deltaskew < -MAX_SKEW_DELTA) { - log_info("skew change %0.3lf exceeds limit", deltaskew); - tskew -= MAX_SKEW_DELTA; - } else { - tskew = newskew; - } - - /* Adjust the kernel skew. */ - tmx.freq = (long)(tskew * ADJTIMEX_FREQ_SCALE); - tmx.modes = ADJ_FREQUENCY; - if (adjtimex(&tmx) == -1) - log_warn("adjtimex set freq failed"); - } - - log_debug("interval %0.3lf skew %0.3lf total skew %0.3lf", interval, - skew, tskew); - - tlast = tnow; - errno = saved_errno; - return result; -} -#endif diff --git a/package/openntpd/src/openbsd-compat/port-linux.c b/package/openntpd/src/openbsd-compat/port-linux.c new file mode 100644 index 000000000..f210d4a6d --- /dev/null +++ b/package/openntpd/src/openbsd-compat/port-linux.c @@ -0,0 +1,107 @@ +/* $Id: port-linux.c 1793 2007-01-28 20:55:08Z tg $ */ + +/* part of the adjtime-linux patch */ + +/* + * Copyright (c) 2004 Darren Tucker + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "includes.h" + +#ifdef USE_ADJTIMEX +#include +#include +#ifdef adjtime +# undef adjtime +#endif + +#include "ntpd.h" + +/* scale factor used by adjtimex freq param. 1 ppm = 65536 */ +#define ADJTIMEX_FREQ_SCALE 65536 + +/* maximum change to skew per adjustment, in PPM */ +#define MAX_SKEW_DELTA 5.0 + +int +_compat_adjtime(const struct timeval *delta, struct timeval *olddelta) +{ + static struct timeval tlast = {0,0}; + static double tskew = 0; + static int synced = -1; + struct timeval tnow, tdelta; + double skew = 0, newskew, deltaskew, adjust, interval = 0; + struct timex tmx; + int result, saved_errno; + + gettimeofday(&tnow, NULL); + adjust = (double)delta->tv_sec; + adjust += (double)delta->tv_usec / 1000000; + + /* Even if the caller doesn't care about the olddelta, we do */ + if (olddelta == NULL) + olddelta = &tdelta; + + result = adjtime(delta, olddelta); + saved_errno = errno; + + if (olddelta->tv_sec == 0 && olddelta->tv_usec == 0 && + synced != INT_MAX) + synced++; + else + synced = 0; + + /* + * do skew calculations if we have synced + */ + if (synced == 0 ) { + tmx.modes = 0; + if (adjtimex(&tmx) == -1) + log_warn("adjtimex get failed"); + else + tskew = (double)tmx.freq / ADJTIMEX_FREQ_SCALE; + } else if (synced >= 1) { + interval = (double)(tnow.tv_sec - tlast.tv_sec); + interval += (double)(tnow.tv_usec - tlast.tv_usec) / 1000000; + + skew = (adjust * 1000000) / interval; + newskew = ((tskew * synced) + skew) / synced; + deltaskew = newskew - tskew; + + if (deltaskew > MAX_SKEW_DELTA) { + log_info("skew change %0.3lf exceeds limit", deltaskew); + tskew += MAX_SKEW_DELTA; + } else if (deltaskew < -MAX_SKEW_DELTA) { + log_info("skew change %0.3lf exceeds limit", deltaskew); + tskew -= MAX_SKEW_DELTA; + } else { + tskew = newskew; + } + + /* Adjust the kernel skew. */ + tmx.freq = (long)(tskew * ADJTIMEX_FREQ_SCALE); + tmx.modes = ADJ_FREQUENCY; + if (adjtimex(&tmx) == -1) + log_warn("adjtimex set freq failed"); + } + + log_debug("interval %0.3lf skew %0.3lf total skew %0.3lf", interval, + skew, tskew); + + tlast = tnow; + errno = saved_errno; + return result; +} +#endif -- cgit v1.2.3