net-misc/ntp: Sync with Gentoo

It's from Gentoo commit 8750a4090ea84eff7fe20b9ee6a4a30d82f2ffc7.
This commit is contained in:
Krzesimir Nowak 2023-11-13 19:47:13 +01:00
parent 9d93d56efa
commit 766d0b846b
22 changed files with 1087 additions and 99 deletions

View File

@ -1,2 +1,3 @@
DIST ntp-4.2.8p15-manpages.tar.xz 25700 BLAKE2B 6a225bc19dcebee31cb8e0d621963863d567a882655b57be8b65a16f9d3dd138787c7c6b9ff08853306f2e9b11d65cb76e3215cc5b2262a91c411d437974fc18 SHA512 21721550864b4e7e91bf20ca894109253439b737799dfc803e1496b3454199f34646f40e0156c08a39d5914e5a92f35908cec0245e1e2627c75c0e64939ba028 DIST ntp-4.2.8p15-manpages.tar.xz 25700 BLAKE2B 6a225bc19dcebee31cb8e0d621963863d567a882655b57be8b65a16f9d3dd138787c7c6b9ff08853306f2e9b11d65cb76e3215cc5b2262a91c411d437974fc18 SHA512 21721550864b4e7e91bf20ca894109253439b737799dfc803e1496b3454199f34646f40e0156c08a39d5914e5a92f35908cec0245e1e2627c75c0e64939ba028
DIST ntp-4.2.8p15.tar.gz 7015970 BLAKE2B 5697d6623d79686f9ca9ad907172bf942383067d1e9817117d20db042e9f7410644f236f1a0d77ab6bf6ec468476e12ea65b494a28f0dd8674bf08fc8875cfef SHA512 f5ad765e45fc302263dd40e94c287698fd235b94f3684e49f1d5d09d7d8bdd6b8c0fb96ecdabffea3d233e1e79b3c9687b76dc204ba76bad3f554682f4a97794 DIST ntp-4.2.8p15.tar.gz 7015970 BLAKE2B 5697d6623d79686f9ca9ad907172bf942383067d1e9817117d20db042e9f7410644f236f1a0d77ab6bf6ec468476e12ea65b494a28f0dd8674bf08fc8875cfef SHA512 f5ad765e45fc302263dd40e94c287698fd235b94f3684e49f1d5d09d7d8bdd6b8c0fb96ecdabffea3d233e1e79b3c9687b76dc204ba76bad3f554682f4a97794
DIST ntp-4.2.8p17.tar.gz 7120469 BLAKE2B 5c0e90a234cdeab76e7443b42dfd5a0c3c78693a11bdb0fa21c8def91adbdf9b9871498df9d211509632812a9107501da3470104122e9621577541ffd6cd1ab6 SHA512 e003bfe6f46065890663bc6791b02277f64318b692e49d8d678b76c23b245f357834eb483b0a44f1f47783166e5504686b36494af77f6eebe6f844cd3f2b6a8c

View File

@ -1,39 +0,0 @@
Fix building with libressl or without SSL.
Origin: http://bugs.ntp.org/attachment.cgi?id=1481
LibreSSL fix from Joe Kappus (https://bugs.gentoo.org/show_bug.cgi?id=600668#c2)
--- a/include/libssl_compat.h
+++ b/include/libssl_compat.h
@@ -37,7 +37,7 @@
#endif
/* ----------------------------------------------------------------- */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
/* ----------------------------------------------------------------- */
# include <openssl/objects.h>
--- a/libntp/libssl_compat.c
+++ b/libntp/libssl_compat.c
@@ -26,7 +26,7 @@
/* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */
-#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10100000L
+#if defined(OPENSSL) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
/* ----------------------------------------------------------------- */
#include "libssl_compat.h"
--- a/libntp/ssl_init.c
+++ b/libntp/ssl_init.c
@@ -21,7 +21,7 @@
int ssl_init_done;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
static void
atexit_ssl_cleanup(void)

View File

@ -1,16 +0,0 @@
--- ntp-4.2.8p12.orig/include/libssl_compat.h 2018-12-08 01:14:58.434733497 +0000
+++ ntp-4.2.8p12/include/libssl_compat.h 2018-12-08 01:42:04.479474757 +0000
@@ -107,10 +107,13 @@
#define OpenSSL_version_num SSLeay
#define OpenSSL_version SSLeay_version
+
+# if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L
#define X509_get0_notBefore X509_get_notBefore
#define X509_getm_notBefore X509_get_notBefore
#define X509_get0_notAfter X509_get_notAfter
#define X509_getm_notAfter X509_get_notAfter
+#endif /* !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20800000L */
/* ----------------------------------------------------------------- */
#endif /* OPENSSL_VERSION_NUMBER < v1.1.0 */

View File

@ -0,0 +1,610 @@
Sync with OpenLDAP. Uses Arsen's patch from https://bugs.gentoo.org/871288.
https://bugs.gentoo.org/871372
--- a/sntp/m4/openldap-thread-check.m4
+++ b/sntp/m4/openldap-thread-check.m4
@@ -262,10 +262,8 @@ pthread_rwlock_t rwlock;
dnl save the flags
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
-#ifndef NULL
-#define NULL (void*)0
-#endif
-]], [[pthread_detach(NULL);]])],[ol_cv_func_pthread_detach=yes],[ol_cv_func_pthread_detach=no])
+pthread_t thread;
+]], [[pthread_detach(thread);]])],[ol_cv_func_pthread_detach=yes],[ol_cv_func_pthread_detach=no])
])
if test $ol_cv_func_pthread_detach = no ; then
--- a/sntp/m4/openldap.m4
+++ b/sntp/m4/openldap.m4
@@ -1,16 +1,16 @@
dnl OpenLDAP Autoconf Macros
-dnl $OpenLDAP: pkg/ldap/build/openldap.m4,v 1.157.2.10 2010/04/13 20:22:21 kurt Exp $
+dnl $OpenLDAP$
dnl This work is part of OpenLDAP Software <http://www.openldap.org/>.
dnl
-dnl Copyright 1998-2010 The OpenLDAP Foundation.
+dnl Copyright 1998-2022 The OpenLDAP Foundation.
dnl All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted only as authorized by the OpenLDAP
dnl Public License.
dnl
-dnl A copy of this license is available in the file LICENSE-OPENLDAP in
-dnl this directory of the distribution or, alternatively, at
+dnl A copy of this license is available in the file LICENSE in the
+dnl top-level directory of the distribution or, alternatively, at
dnl <http://www.OpenLDAP.org/license.html>.
dnl
dnl --------------------------------------------------------------------
@@ -154,6 +154,7 @@ fi
if test $ol_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <ctype.h>
+#include <stdlib.h>
#ifndef HAVE_EBCDIC
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -170,7 +171,7 @@ exit (0); }
]])],[],[ol_cv_header_stdc=no],[:])
fi])
if test $ol_cv_header_stdc = yes; then
- AC_DEFINE([STDC_HEADERS], [1], [is standard C provided?])
+ AC_DEFINE(STDC_HEADERS)
fi
ac_cv_header_stdc=disable
])
@@ -242,313 +243,40 @@ AC_DEFUN([OL_RESOLVER_LINK],
OL_RESOLVER_TRY(ol_cv_resolver_none)
OL_RESOLVER_TRY(ol_cv_resolver_resolv,[-lresolv])
OL_RESOLVER_TRY(ol_cv_resolver_bind,[-lbind])
-])
-dnl
-dnl ====================================================================
-dnl International Components for Unicode (ICU)
-AC_DEFUN([OL_ICU],
-[ol_icu=no
-AC_CHECK_HEADERS( unicode/utypes.h )
-if test $ac_cv_header_unicode_utypes_h = yes ; then
- dnl OL_ICULIBS="-licui18n -licuuc -licudata"
- OL_ICULIBS="-licuuc -licudata"
-
- AC_CACHE_CHECK([for ICU libraries], [ol_cv_lib_icu], [
- ol_LIBS="$LIBS"
- LIBS="$OL_ICULIBS $LIBS"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include <unicode/utypes.h>
-]], [[
-(void) u_errorName(0);
-]])],[ol_cv_lib_icu=yes],[ol_cv_lib_icu=no])
- LIBS="$ol_LIBS"
-])
-
- if test $ol_cv_lib_icu != no ; then
- ol_icu="$OL_ICULIBS"
- AC_DEFINE([HAVE_ICU], [1], [define if you actually have ICU])
- fi
-fi
-])
-dnl
-dnl ====================================================================
-dnl Berkeley DB macros
-dnl
-dnl --------------------------------------------------------------------
-dnl Try to link
-AC_DEFUN([OL_BERKELEY_DB_TRY],
-[if test $ol_cv_lib_db = no ; then
- AC_CACHE_CHECK([for Berkeley DB link (]ifelse($2,,default,$2)[)],[$1],
-[
- ol_DB_LIB=ifelse($2,,,$2)
- ol_LIBS=$LIBS
- LIBS="$ol_DB_LIB $LTHREAD_LIBS $LIBS"
-
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_DB_185_H
-# include <db_185.h>
-#else
-# include <db.h>
-#endif
-
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-]], [[
-#if DB_VERSION_MAJOR > 2
- db_env_create( NULL, 0 );
-#elif DB_VERSION_MAJOR > 1
- db_appexit( NULL );
-#else
- (void) dbopen( NULL, 0, 0, 0, NULL);
-#endif
-]])],[$1=yes],[$1=no])
-
- LIBS="$ol_LIBS"
-])
-
- if test $$1 = yes ; then
- ol_cv_lib_db=ifelse($2,,yes,$2)
- fi
-fi
-])
-dnl
-dnl --------------------------------------------------------------------
-dnl Get major and minor version from <db.h>
-AC_DEFUN([OL_BDB_HEADER_VERSION],
-[AC_CACHE_CHECK([for Berkeley DB major version in db.h], [ol_cv_bdb_major],[
- AC_LANG_CONFTEST([
-#include <db.h>
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-__db_version DB_VERSION_MAJOR
-])
- set X `eval "$ac_cpp conftest.$ac_ext" | $EGREP __db_version` none none
- ol_cv_bdb_major=${3}
-])
-case $ol_cv_bdb_major in [[1-9]]*) : ;; *)
- AC_MSG_ERROR([Unknown Berkeley DB major version in db.h]) ;;
-esac
-
-dnl Determine minor version
-AC_CACHE_CHECK([for Berkeley DB minor version in db.h], [ol_cv_bdb_minor],[
- AC_LANG_CONFTEST([
-#include <db.h>
-#ifndef DB_VERSION_MINOR
-# define DB_VERSION_MINOR 0
-#endif
-__db_version DB_VERSION_MINOR
-])
- set X `eval "$ac_cpp conftest.$ac_ext" | $EGREP __db_version` none none
- ol_cv_bdb_minor=${3}
-])
-case $ol_cv_bdb_minor in [[0-9]]*) : ;; *)
- AC_MSG_ERROR([Unknown Berkeley DB minor version in db.h]) ;;
-esac
-])
-dnl
-dnl --------------------------------------------------------------------
-dnl Try to locate appropriate library
-AC_DEFUN([OL_BERKELEY_DB_LINK],
-[ol_cv_lib_db=no
-
-if test $ol_cv_bdb_major = 4 ; then
- OL_BERKELEY_DB_TRY(ol_cv_db_db_4_dot_m,[-ldb-4.$ol_cv_bdb_minor])
- OL_BERKELEY_DB_TRY(ol_cv_db_db4m,[-ldb4$ol_cv_bdb_minor])
- OL_BERKELEY_DB_TRY(ol_cv_db_db_4m,[-ldb-4$ol_cv_bdb_minor])
- OL_BERKELEY_DB_TRY(ol_cv_db_db_4_m,[-ldb-4-$ol_cv_bdb_minor])
- OL_BERKELEY_DB_TRY(ol_cv_db_db_4,[-ldb-4])
- OL_BERKELEY_DB_TRY(ol_cv_db_db4,[-ldb4])
- OL_BERKELEY_DB_TRY(ol_cv_db_db,[-ldb])
-fi
-OL_BERKELEY_DB_TRY(ol_cv_db_none)
-])
-dnl
-dnl --------------------------------------------------------------------
-dnl Check if Berkeley DB version
-AC_DEFUN([OL_BERKELEY_DB_VERSION],
-[AC_CACHE_CHECK([for Berkeley DB library and header version match], [ol_cv_berkeley_db_version], [
- ol_LIBS="$LIBS"
- LIBS="$LTHREAD_LIBS $LIBS"
- if test $ol_cv_lib_db != yes ; then
- LIBS="$ol_cv_lib_db $LIBS"
- fi
-
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#ifdef HAVE_DB_185_H
- choke me;
-#else
-#include <db.h>
-#endif
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-main()
-{
-#if DB_VERSION_MAJOR > 1
- char *version;
- int major, minor, patch;
-
- version = db_version( &major, &minor, &patch );
-
- if( major != DB_VERSION_MAJOR ||
- minor != DB_VERSION_MINOR ||
- patch != DB_VERSION_PATCH )
- {
- printf("Berkeley DB version mismatch\n"
- "\theader: %s\n\tlibrary: %s\n",
- DB_VERSION_STRING, version);
- return 1;
- }
-#endif
-
- return 0;
-}]])],[ol_cv_berkeley_db_version=yes],[ol_cv_berkeley_db_version=no],[ol_cv_berkeley_db_version=cross])
-
- LIBS="$ol_LIBS"
])
- if test $ol_cv_berkeley_db_version = no ; then
- AC_MSG_ERROR([Berkeley DB version mismatch])
- fi
-])dnl
-dnl
dnl --------------------------------------------------------------------
-dnl Check if Berkeley DB supports DB_THREAD
-AC_DEFUN([OL_BERKELEY_DB_THREAD],
-[AC_CACHE_CHECK([for Berkeley DB thread support], [ol_cv_berkeley_db_thread], [
- ol_LIBS="$LIBS"
- LIBS="$LTHREAD_LIBS $LIBS"
- if test $ol_cv_lib_db != yes ; then
- LIBS="$ol_cv_lib_db $LIBS"
- fi
-
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#ifdef HAVE_DB_185_H
- choke me;
-#else
-#include <db.h>
-#endif
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-main()
-{
- int rc;
- u_int32_t flags = DB_CREATE |
-#ifdef DB_PRIVATE
- DB_PRIVATE |
-#endif
- DB_THREAD;
-
-#if DB_VERSION_MAJOR > 2
- DB_ENV *env = NULL;
-
- rc = db_env_create( &env, 0 );
+dnl Check for version compatility with back-mdb
+AC_DEFUN([OL_MDB_COMPAT],
+[AC_CACHE_CHECK([if LMDB version supported by MDB backends], [ol_cv_mdb_compat],[
+ AC_EGREP_CPP(__mdb_version_compat,[
+#include <lmdb.h>
- flags |= DB_INIT_MPOOL;
-#ifdef DB_MPOOL_PRIVATE
- flags |= DB_MPOOL_PRIVATE;
+/* require 0.9.18 or later */
+#if MDB_VERSION_FULL >= 0x000000090012
+ __mdb_version_compat
#endif
-
- if( rc ) {
- printf("BerkeleyDB: %s\n", db_strerror(rc) );
- return rc;
- }
-
-#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
- rc = (env->open)( env, NULL, flags, 0 );
-#else
- rc = (env->open)( env, NULL, NULL, flags, 0 );
-#endif
-
- if ( rc == 0 ) {
- rc = env->close( env, 0 );
- }
-
- if( rc ) {
- printf("BerkeleyDB: %s\n", db_strerror(rc) );
- return rc;
- }
-
-#else
- DB_ENV env;
- memset( &env, '\0', sizeof(env) );
-
- rc = db_appinit( NULL, NULL, &env, flags );
-
- if( rc == 0 ) {
- db_appexit( &env );
- }
-
- unlink("__db_mpool.share");
- unlink("__db_lock.share");
-#endif
-
- return rc;
-}]])],[ol_cv_berkeley_db_thread=yes],[ol_cv_berkeley_db_thread=no],[ol_cv_berkeley_db_thread=cross])
-
- LIBS="$ol_LIBS"
+ ], [ol_cv_mdb_compat=yes], [ol_cv_mdb_compat=no])])
])
- if test $ol_cv_berkeley_db_thread != no ; then
- AC_DEFINE([HAVE_BERKELEY_DB_THREAD], [1],
- [define if Berkeley DB has DB_THREAD support])
- fi
-])dnl
dnl
dnl --------------------------------------------------------------------
-dnl Find any DB
-AC_DEFUN([OL_BERKELEY_DB],
-[ol_cv_berkeley_db=no
-AC_CHECK_HEADERS(db.h)
-if test $ac_cv_header_db_h = yes; then
- OL_BDB_HEADER_VERSION
- OL_BDB_COMPAT
-
- if test $ol_cv_bdb_compat != yes ; then
- AC_MSG_ERROR([BerkeleyDB version incompatible with BDB/HDB backends])
+dnl Find any MDB
+AC_DEFUN([OL_MDB],
+[ol_cv_mdb=no
+AC_CHECK_HEADERS(lmdb.h)
+if test $ac_cv_header_lmdb_h = yes; then
+ OL_MDB_COMPAT
+
+ if test $ol_cv_mdb_compat != yes ; then
+ AC_MSG_ERROR([LMDB version incompatible with MDB backends])
fi
- OL_BERKELEY_DB_LINK
- if test "$ol_cv_lib_db" != no ; then
- ol_cv_berkeley_db=yes
- OL_BERKELEY_DB_VERSION
- OL_BERKELEY_DB_THREAD
- fi
+ ol_cv_lib_mdb=-llmdb
+ ol_cv_mdb=yes
fi
])
-dnl --------------------------------------------------------------------
-dnl Check for version compatility with back-bdb
-AC_DEFUN([OL_BDB_COMPAT],
-[AC_CACHE_CHECK([if Berkeley DB version supported by BDB/HDB backends], [ol_cv_bdb_compat],[
- AC_EGREP_CPP(__db_version_compat,[
-#include <db.h>
-
- /* this check could be improved */
-#ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-#endif
-#ifndef DB_VERSION_MINOR
-# define DB_VERSION_MINOR 0
-#endif
-
-#define DB_VERSION_MM ((DB_VERSION_MAJOR<<8)|DB_VERSION_MINOR)
-/* require 4.4 or later */
-#if DB_VERSION_MM >= 0x0404
- __db_version_compat
-#endif
- ], [ol_cv_bdb_compat=yes], [ol_cv_bdb_compat=no])])
-])
dnl
dnl ====================================================================
@@ -664,12 +392,10 @@ AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[[
return 0;
]])
-AC_DEFUN([OL_PTHREAD_TEST_PROGRAM], [
-AC_LANG_SOURCE([OL_PTHREAD_TEST_INCLUDES
+AC_DEFUN([OL_PTHREAD_TEST_PROGRAM],
+[AC_LANG_SOURCE([OL_PTHREAD_TEST_INCLUDES
-int main(argc, argv)
- int argc;
- char **argv;
+int main(int argc, char **argv)
{
OL_PTHREAD_TEST_FUNCTION
}
@@ -706,7 +432,7 @@ dnl Check GNU Pth pthread Header
dnl
dnl defines ol_cv_header linux_threads to 'yes' or 'no'
dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
-dnl doesn't exists. Existance of pthread.h should separately
+dnl doesn't exist. Existence of pthread.h should separately
dnl checked.
dnl
AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
@@ -728,7 +454,7 @@ AC_DEFUN([OL_NT_THREADS], [
AC_CHECK_FUNC(_beginthread)
if test $ac_cv_func__beginthread = yes ; then
- AC_DEFINE([HAVE_NT_THREADS], [1], [if you have NT Threads])
+ AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
ol_cv_nt_threads=yes
fi
])
@@ -737,7 +463,7 @@ dnl Check LinuxThreads Header
dnl
dnl defines ol_cv_header linux_threads to 'yes' or 'no'
dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
-dnl doesn't exists. Existance of pthread.h should separately
+dnl doesn't exist. Existence of pthread.h should separately
dnl checked.
dnl
AC_DEFUN([OL_HEADER_LINUX_THREADS], [
@@ -749,7 +475,7 @@ AC_DEFUN([OL_HEADER_LINUX_THREADS], [
[ol_cv_header_linux_threads=no])
])
if test $ol_cv_header_linux_threads = yes; then
- AC_DEFINE([HAVE_LINUX_THREADS], [1], [if you have LinuxThreads])
+ AC_DEFINE(HAVE_LINUX_THREADS,1,[if you have LinuxThreads])
fi
])dnl
dnl --------------------------------------------------------------------
@@ -791,7 +517,7 @@ AC_CACHE_CHECK([for compatible POSIX regex],ol_cv_c_posix_regex,[
#include <sys/types.h>
#include <regex.h>
static char *pattern, *string;
-main()
+int main(void)
{
int rc;
regex_t re;
@@ -818,7 +544,8 @@ AC_DEFUN([OL_C_UPPER_LOWER],
[AC_CACHE_CHECK([if toupper() requires islower()],ol_cv_c_upper_lower,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <ctype.h>
-main()
+#include <stdlib.h>
+int main(void)
{
if ('C' == toupper('C'))
exit(0);
@@ -826,7 +553,7 @@ main()
exit(1);
}]])],[ol_cv_c_upper_lower=no],[ol_cv_c_upper_lower=yes],[ol_cv_c_upper_lower=safe])])
if test $ol_cv_c_upper_lower != no ; then
- AC_DEFINE([C_UPPER_LOWER], [1], [define if toupper() requires islower()])
+ AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
fi
])
dnl
@@ -837,29 +564,32 @@ dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
dnl Reported by Keith Bostic.
AC_DEFUN([OL_SYS_ERRLIST],
-[AC_CACHE_CHECK([declaration of sys_errlist],ol_cv_dcl_sys_errlist,[
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+[AC_CACHE_CHECK([existence of sys_errlist],ol_cv_have_sys_errlist,[
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], [[char *c = (char *) *sys_errlist]])],[ol_cv_have_sys_errlist=yes],[ol_cv_have_sys_errlist=no])])
+if test $ol_cv_have_sys_errlist = yes ; then
+ AC_DEFINE(HAVE_SYS_ERRLIST,1,
+ [define if you actually have sys_errlist in your libs])
+ AC_CACHE_CHECK([declaration of sys_errlist],ol_cv_dcl_sys_errlist,[
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#ifdef _WIN32
#include <stdlib.h>
-#endif ]], [[char *c = (char *) *sys_errlist]])],[ol_cv_dcl_sys_errlist=yes
- ol_cv_have_sys_errlist=yes],[ol_cv_dcl_sys_errlist=no])])
+#endif ]], [[char *c = (char *) *sys_errlist]])],[ol_cv_dcl_sys_errlist=yes],
+ [ol_cv_dcl_sys_errlist=no])])
#
-# It's possible (for near-UNIX clones) that sys_errlist doesn't exist
-if test $ol_cv_dcl_sys_errlist = no ; then
- AC_DEFINE([DECL_SYS_ERRLIST], [1],
- [define if sys_errlist is not declared in stdio.h or errno.h])
-
- AC_CACHE_CHECK([existence of sys_errlist],ol_cv_have_sys_errlist,[
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], [[char *c = (char *) *sys_errlist]])],[ol_cv_have_sys_errlist=yes],[ol_cv_have_sys_errlist=no])])
-fi
-if test $ol_cv_have_sys_errlist = yes ; then
- AC_DEFINE([HAVE_SYS_ERRLIST], [1],
- [define if you actually have sys_errlist in your libs])
+ # It's possible (for near-UNIX clones) that sys_errlist doesn't exist
+ if test $ol_cv_dcl_sys_errlist = no ; then
+ AC_DEFINE(DECL_SYS_ERRLIST,1,
+ [define if sys_errlist is not declared in stdio.h or errno.h])
+ fi
fi
])dnl
+dnl
+dnl ====================================================================
+dnl glibc supplies a non-standard strerror_r if _GNU_SOURCE is defined.
+dnl It's actually preferable to the POSIX version, if available.
AC_DEFUN([OL_NONPOSIX_STRERROR_R],
[AC_CACHE_CHECK([non-posix strerror_r],ol_cv_nonposix_strerror_r,[
AC_EGREP_CPP(strerror_r,[#include <string.h>],
@@ -873,24 +603,23 @@ AC_DEFUN([OL_NONPOSIX_STRERROR_R],
]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror_r=no])
else
AC_RUN_IFELSE([AC_LANG_SOURCE([[
- main() {
+ int main(void) {
char buf[100];
buf[0] = 0;
strerror_r( 1, buf, sizeof buf );
exit( buf[0] == 0 );
}
- ]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror=no],[ol_cv_nonposix_strerror=no])
+ ]])],[ol_cv_nonposix_strerror_r=yes],[ol_cv_nonposix_strerror_r=no],[ol_cv_nonposix_strerror_r=no])
fi
])
if test $ol_cv_nonposix_strerror_r = yes ; then
- AC_DEFINE([HAVE_NONPOSIX_STRERROR_R], [1],
+ AC_DEFINE(HAVE_NONPOSIX_STRERROR_R,1,
[define if strerror_r returns char* instead of int])
fi
])dnl
dnl
AC_DEFUN([OL_STRERROR],
-[OL_SYS_ERRLIST dnl TEMPORARY
-AC_CHECK_FUNCS(strerror strerror_r)
+[AC_CHECK_FUNCS(strerror strerror_r)
ol_cv_func_strerror_r=no
if test "${ac_cv_func_strerror_r}" = yes ; then
OL_NONPOSIX_STRERROR_R
@@ -910,7 +639,7 @@ AC_DEFUN([OL_C_VOLATILE],
if test $ol_cv_c_volatile = yes; then
:
else
- AC_DEFINE([volatile], [], [define as empty if volatile is not supported])
+ AC_DEFINE(volatile,,[define as empty if volatile is not supported])
fi
])dnl
dnl
@@ -918,7 +647,7 @@ dnl ====================================================================
dnl Look for fetch(3)
AC_DEFUN([OL_LIB_FETCH],
[ol_LIBS=$LIBS
-LIBS="-lfetch -lcom_err $LIBS"
+LIBS="-lfetch $LIBS"
AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_PARAM_H
@@ -928,8 +657,8 @@ AC_CACHE_CHECK([fetch(3) library],ol_cv_lib_fetch,[
#include <fetch.h>]], [[struct url *u = fetchParseURL("file:///"); ]])],[ol_cv_lib_fetch=yes],[ol_cv_lib_fetch=no])])
LIBS=$ol_LIBS
if test $ol_cv_lib_fetch != no ; then
- ol_link_fetch="-lfetch -lcom_err"
- AC_DEFINE([HAVE_FETCH], [1],
+ ol_link_fetch="-lfetch"
+ AC_DEFINE(HAVE_FETCH,1,
[define if you actually have FreeBSD fetch(3)])
fi
])dnl
@@ -1094,7 +823,7 @@ AC_DEFUN([OL_FUNC_GETHOSTBYADDR_R_NARGS],
])dnl
dnl
dnl --------------------------------------------------------------------
-dnl Check for Cyrus SASL version compatility
+dnl Check for Cyrus SASL version compatibility
AC_DEFUN([OL_SASL_COMPAT],
[AC_CACHE_CHECK([Cyrus SASL library version], [ol_cv_sasl_compat],[
AC_EGREP_CPP(__sasl_compat,[
@@ -1113,19 +842,3 @@ AC_DEFUN([OL_SASL_COMPAT],
#endif
], [ol_cv_sasl_compat=yes], [ol_cv_sasl_compat=no])])
])
-dnl ====================================================================
-dnl check for SSL compatibility
-AC_DEFUN([OL_SSL_COMPAT],
-[AC_CACHE_CHECK([OpenSSL library version (CRL checking capability)],
- [ol_cv_ssl_crl_compat],[
- AC_EGREP_CPP(__ssl_compat,[
-#ifdef HAVE_OPENSSL_SSL_H
-#include <openssl/ssl.h>
-#endif
-
-/* Require 0.9.7d+ */
-#if OPENSSL_VERSION_NUMBER >= 0x0090704fL
- char *__ssl_compat = "0.9.7d";
-#endif
- ], [ol_cv_ssl_crl_compat=yes], [ol_cv_ssl_crl_compat=no])])
-])
--
2.38.1

View File

@ -0,0 +1,75 @@
Source:
https://bugs.ntp.org/show_bug.cgi?id=3688
Juergen Perlinger 2020-12-24 07:10:49 UTC
Created attachment 1760 [details]
ultimate patch, v00
--- a/sntp/log.c 2020-12-24 08:02:05.206004072 +0100
+++ a/sntp/log.c 2020-12-24 08:02:05.206004072 +0100
@@ -2,7 +2,7 @@
#include "log.h"
-const char *progname; /* for msyslog use too */
+extern const char *progname; /* for msyslog use too */
static int counter = 0;
--- a/sntp/main.c 2020-12-24 08:02:05.210003956 +0100
+++ a/sntp/main.c 2020-12-24 08:02:05.210003956 +0100
@@ -20,7 +20,6 @@
#include "log.h"
#include "libntp.h"
-
int shutting_down;
int time_derived;
int time_adjusted;
--- a/sntp/main.h 2020-12-24 08:02:05.210003956 +0100
+++ a/sntp/main.h 2020-12-24 08:02:05.210003956 +0100
@@ -16,6 +16,14 @@
#include "crypto.h"
+/* !Attention! 'progname' must de instantiated in any program that wants
+ * to use this library. Putting it into the library breaks a lot of
+ * things, since many programs define it itself and then the symbol
+ * might end up twice in the linker.
+ */
+extern const char * progname;
+
+
void set_li_vn_mode(struct pkt *spkt, char leap, char version, char mode);
extern int sntp_main(int argc, char **argv, const char *);
int generate_pkt(struct pkt *x_pkt, const struct timeval *tv_xmt,
--- a/sntp/sntp.c 2020-12-24 08:02:05.210003956 +0100
+++ a/sntp/sntp.c 2020-12-24 08:02:05.210003956 +0100
@@ -2,6 +2,8 @@
#include "main.h"
+const char * progname;
+
int
main (
int argc,
--- a/sntp/tests/t-log.c 2020-12-24 08:02:05.210003956 +0100
+++ a/sntp/tests/t-log.c 2020-12-24 08:02:05.210003956 +0100
@@ -3,7 +3,6 @@
#include "ntp_types.h"
-//#include "log.h"
#include "log.c"
void setUp(void);
--- a/tests/libntp/test-libntp.h 2020-12-24 08:02:05.210003956 +0100
+++ a/tests/libntp/test-libntp.h 2020-12-24 08:02:05.210003956 +0100
@@ -5,4 +5,4 @@
time_t timefunc(time_t *ptr);
void settime(int y, int m, int d, int H, int M, int S);
-time_t nowtime;
+extern time_t nowtime;

View File

@ -0,0 +1,28 @@
https://bugs.gentoo.org/806358
https://patchwork.openembedded.org/patch/180019/
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 31 Jul 2021 10:51:41 -0700
Subject: [PATCH] libntp: Do not use PTHREAD_STACK_MIN on glibc
In glibc 2.34+ PTHREAD_STACK_MIN is not a compile-time constant which
could mean different stack sizes at runtime on different architectures
and it also causes compile failure. Default glibc thread stack size
or 64Kb set by ntp should be good in glibc these days.
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/libntp/work_thread.c
+++ b/libntp/work_thread.c
@@ -41,7 +41,7 @@
#ifndef THREAD_MINSTACKSIZE
# define THREAD_MINSTACKSIZE (64U * 1024)
#endif
-#ifndef __sun
+#if !defined(__sun) && !defined(__GLIBC__)
#if defined(PTHREAD_STACK_MIN) && THREAD_MINSTACKSIZE < PTHREAD_STACK_MIN
# undef THREAD_MINSTACKSIZE
# define THREAD_MINSTACKSIZE PTHREAD_STACK_MIN
--
2.32.0

View File

@ -0,0 +1,21 @@
# /etc/conf.d/ntp-client
# Command to run to set the clock initially
# Most people should just leave this line alone ...
# however, if you know what you're doing, and you
# want to use ntpd to set the clock, change this to 'ntpd'
NTPCLIENT_CMD="ntpdate"
# Options to pass to the above command
# This default setting should work fine but you should
# change the default 'pool.ntp.org' to something closer
# to your machine. See http://www.pool.ntp.org/ or
# try running `netselect -s 3 pool.ntp.org`.
NTPCLIENT_OPTS="-s -b -u \
0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org \
2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"
# If you use hostnames above, then you should depend on dns
# being up & running before we try to run. Otherwise, you
# can disable this.
rc_use="dns"

View File

@ -0,0 +1,31 @@
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
before cron portmap
after net
use dns logger
}
checkconfig() {
if ! type "${NTPCLIENT_CMD}" >/dev/null 2>&1 ; then
eerror "Please edit /etc/conf.d/ntp-client"
eerror "Unable to locate the client command ${NTPCLIENT_CMD}!"
return 1
fi
if [ -z "${NTPCLIENT_OPTS}" ] ; then
eerror "Please edit /etc/conf.d/ntp-client"
eerror "I need to know what server/options to use!"
return 1
fi
return 0
}
start() {
checkconfig || return $?
ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'"
"${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS}
eend $? "Failed to set clock"
}

View File

@ -1,8 +1,34 @@
# Common pool # NOTES:
server 0.flatcar.pool.ntp.org # DHCP clients can append or replace NTP configuration files.
server 1.flatcar.pool.ntp.org # You should consult your DHCP client documentation about its
server 2.flatcar.pool.ntp.org # default behaviour and how to change it.
server 3.flatcar.pool.ntp.org
# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server ntp.example.tld iburst
# Common pool for random people
#server pool.ntp.org
# Pools for Gentoo users
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org
server 3.gentoo.pool.ntp.org
##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##
# you should not need to modify the following paths
driftfile /var/lib/ntp/ntp.drift
#server ntplocal.example.com prefer
#server timeserver.example.org
# Warning: Using default NTP settings will leave your NTP # Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet. # server accessible to all hosts on the Internet.
@ -11,9 +37,18 @@ server 3.flatcar.pool.ntp.org
# from accessing the NTP server, uncomment: # from accessing the NTP server, uncomment:
#restrict default ignore #restrict default ignore
# Default configuration: # Default configuration:
# - Allow only time queries, at a limited rate, sending KoD when in excess. # - Allow only time queries, at a limited rate, sending KoD when in excess.
# - Allow all local queries (IPv4, IPv6) # - Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery notrap limited kod restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1 restrict 127.0.0.1
restrict [::1] restrict [::1]
# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap

View File

@ -1,2 +1 @@
d /var/lib/ntp 0755 ntp ntp - - d /var/lib/ntp 0755 ntp ntp
L /etc/ntp.conf - - - - /usr/share/ntp/ntp.conf

View File

@ -0,0 +1,6 @@
# /etc/conf.d/ntpd
# Options to pass to the ntpd process
# Most people should leave this line alone ...
# however, if you know what you're doing, feel free to tweak
NTPD_OPTS="-g -u ntp:ntp"

View File

@ -0,0 +1,23 @@
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="ntpd - the network time protocol daemon"
pidfile="/var/run/ntpd.pid"
command="/usr/sbin/ntpd"
command_args="${NTPD_OPTS}"
command_args_background="-p ${pidfile}"
command_args_foreground="-n"
depend() {
use net dns logger
after ntp-client
}
start_pre() {
if [ ! -f /etc/ntp.conf ] ; then
eerror "Please create /etc/ntp.conf"
return 1
fi
return 0
}

View File

@ -4,9 +4,8 @@ After=ntpdate.service sntp.service
Conflicts=systemd-timesyncd.service Conflicts=systemd-timesyncd.service
[Service] [Service]
ExecStart=/usr/sbin/ntpd -g -n -f /var/lib/ntp/ntp.drift ExecStart=/usr/sbin/ntpd -g -n
PrivateTmp=true PrivateTmp=true
Restart=always
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -2,12 +2,11 @@
Description=Set time via NTP using ntpdate Description=Set time via NTP using ntpdate
After=network-online.target nss-lookup.target After=network-online.target nss-lookup.target
Before=time-sync.target Before=time-sync.target
Wants=time-sync.target Wants=network-online.target time-sync.target
Conflicts=systemd-timesyncd.service Conflicts=systemd-timesyncd.service
[Service] [Service]
Type=oneshot Type=oneshot
Environment="SERVER=0.flatcar.pool.ntp.org 1.flatcar.pool.ntp.org 2.flatcar.pool.ntp.org 3.flatcar.pool.ntp.org"
ExecStart=/usr/sbin/ntpdate -b -u $SERVER ExecStart=/usr/sbin/ntpdate -b -u $SERVER
RemainAfterExit=yes RemainAfterExit=yes

View File

@ -0,0 +1,2 @@
[Service]
Environment="SERVER=0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"

View File

@ -0,0 +1,4 @@
# /etc/conf.d/sntp
# Options to pass to sntp
SNTP_OPTS="-s 0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"

View File

@ -0,0 +1,26 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/sntp"
depend() {
before cron portmap
after net
use dns logger
}
start_pre() {
if [ -z "${SNTP_OPTS}" ] ; then
eerror "Please edit /etc/conf.d/sntp"
eerror "I need to know what server/options to use!"
return 1
fi
return 0
}
start() {
ebegin "Setting clock via SNTP"
${command} ${SNTP_OPTS}
eend $? "Failed to set clock"
}

View File

@ -1,13 +1,12 @@
[Unit] [Unit]
Description=Set time via SNTP Description=Set time via SNTP
After=network.target NetworkManager-wait-online.service nss-lookup.target After=network.target network-online.target nss-lookup.target
Before=time-sync.target Before=time-sync.target
Wants=time-sync.target Wants=network-online.target time-sync.target
Conflicts=systemd-timesyncd.service Conflicts=systemd-timesyncd.service
[Service] [Service]
Type=oneshot Type=oneshot
Environment="SERVER=0.flatcar.pool.ntp.org 1.flatcar.pool.ntp.org 2.flatcar.pool.ntp.org 3.flatcar.pool.ntp.org"
ExecStart=/usr/bin/sntp -s $SERVER ExecStart=/usr/bin/sntp -s $SERVER
RemainAfterExit=yes RemainAfterExit=yes

View File

@ -0,0 +1,2 @@
[Service]
Environment="SERVER=0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org 2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<maintainer type="project"> <maintainer type="project">
<email>base-system@gentoo.org</email> <email>base-system@gentoo.org</email>
<name>Gentoo Base System</name> <name>Gentoo Base System</name>
</maintainer> </maintainer>
<longdescription> <longdescription>
NTP is a protocol designed to synchronize the clocks of computers over a network. NTP NTP is a protocol designed to synchronize the clocks of computers over a network. NTP
version 3 is an internet draft standard, formalized in RFC 1305. NTP version 4 is a version 3 is an internet draft standard, formalized in RFC 1305. NTP version 4 is a
significant revision of the NTP standard, and is the current development version, but significant revision of the NTP standard, and is the current development version, but
has not been formalized in an RFC. Simple NTP (SNTP) version 4 is described in RFC has not been formalized in an RFC. Simple NTP (SNTP) version 4 is described in RFC
2030. 2030.
</longdescription> </longdescription>
<use> <use>
<flag name="openntpd">Allow ntp to be installed alongside openntpd</flag> <flag name="openntpd">Allow ntp to be installed alongside openntpd</flag>
<flag name="parse-clocks">Add support for PARSE clocks</flag> <flag name="parse-clocks">Add support for PARSE clocks</flag>

View File

@ -1,10 +1,9 @@
# Copyright 1999-2020 Gentoo Authors # Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=7
TMPFILES_OPTIONAL=1 inherit autotools flag-o-matic systemd tmpfiles
inherit autotools toolchain-funcs flag-o-matic systemd tmpfiles
MY_P=${P/_p/p} MY_P=${P/_p/p}
DESCRIPTION="Network Time Protocol suite/programs" DESCRIPTION="Network Time Protocol suite/programs"
@ -14,17 +13,16 @@ SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar
LICENSE="HPND BSD ISC" LICENSE="HPND BSD ISC"
SLOT="0" SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux ~m68k-mint" KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE="caps debug ipv6 libressl openntpd parse-clocks perl readline samba selinux snmp ssl threads vim-syntax zeroconf" IUSE="caps debug ipv6 openntpd parse-clocks readline samba selinux snmp ssl +threads vim-syntax zeroconf"
COMMON_DEPEND="readline? ( >=sys-libs/readline-4.1:0= ) COMMON_DEPEND="readline? ( >=sys-libs/readline-4.1:0= )
>=dev-libs/libevent-2.0.9:=[threads?] >=dev-libs/libevent-2.0.9:=[threads(+)?]
kernel_linux? ( caps? ( sys-libs/libcap ) ) kernel_linux? ( caps? ( sys-libs/libcap ) )
zeroconf? ( net-dns/avahi[mdnsresponder-compat] ) zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
snmp? ( net-analyzer/net-snmp ) snmp? ( net-analyzer/net-snmp )
ssl? ( ssl? (
!libressl? ( dev-libs/openssl:0= ) dev-libs/openssl:0=
libressl? ( dev-libs/libressl:0= )
) )
parse-clocks? ( net-misc/pps-tools )" parse-clocks? ( net-misc/pps-tools )"
BDEPEND="virtual/pkgconfig BDEPEND="virtual/pkgconfig
@ -46,14 +44,14 @@ S="${WORKDIR}/${MY_P}"
PATCHES=( PATCHES=(
"${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch #533966 "${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch #533966
"${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch #563922 "${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch #563922
"${FILESDIR}"/${PN}-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch
"${FILESDIR}"/${PN}-4.2.8_p12-libressl-2.8.patch
"${FILESDIR}"/${PN}-4.2.8_p14-add_cap_ipc_lock.patch #711530 "${FILESDIR}"/${PN}-4.2.8_p14-add_cap_ipc_lock.patch #711530
"${FILESDIR}"/${PN}-4.2.8_p15-gcc10.patch #759409
"${FILESDIR}"/${PN}-4.2.8_p15-glibc-2.34.patch
"${FILESDIR}"/${PN}-4.2.8_p15-configure-clang16.patch
) )
src_prepare() { src_prepare() {
default default
use perl || sed -i -e '/^SUBDIRS *=/,/[^\\]$/{/scripts/d;}' Makefile.am || die
append-cppflags -D_GNU_SOURCE #264109 append-cppflags -D_GNU_SOURCE #264109
# Make sure every build uses the same install layout. #539092 # Make sure every build uses the same install layout. #539092
find sntp/loc/ -type f '!' -name legacy -delete || die find sntp/loc/ -type f '!' -name legacy -delete || die
@ -69,11 +67,14 @@ src_configure() {
# blah, no real configure options #176333 # blah, no real configure options #176333
export ac_cv_header_dns_sd_h=$(usex zeroconf) export ac_cv_header_dns_sd_h=$(usex zeroconf)
export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h} export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h}
# Increase the default memlimit from 32MiB to 128MiB. #533232 # Unity builds, we don't really need support for it, bug #804109
export PATH_RUBY=/bin/false
local myeconfargs=( local myeconfargs=(
--with-lineeditlibs=readline,edit,editline --with-lineeditlibs=readline,edit,editline
--with-yielding-select --with-yielding-select
--disable-local-libevent --disable-local-libevent
# Increase the default memlimit from 32MiB to 128MiB. #533232
--with-memlock=256 --with-memlock=256
$(use_enable caps linuxcaps) $(use_enable caps linuxcaps)
$(use_enable parse-clocks) $(use_enable parse-clocks)
@ -97,21 +98,28 @@ src_install() {
dodoc INSTALL WHERE-TO-START dodoc INSTALL WHERE-TO-START
doman "${WORKDIR}"/man/*.[58] doman "${WORKDIR}"/man/*.[58]
insinto /usr/share/ntp insinto /etc
doins "${FILESDIR}"/ntp.conf doins "${FILESDIR}"/ntp.conf
use ipv6 || sed -i '/^restrict .*::1/d' "${ED%/}"/usr/share/ntp/ntp.conf #524726 use ipv6 || sed -i '/^restrict .*::1/d' "${ED}"/etc/ntp.conf #524726
newtmpfiles "${FILESDIR}"/ntp.tmpfiles ntp.conf newinitd "${FILESDIR}"/ntpd.rc-r2 ntpd
newconfd "${FILESDIR}"/ntpd.confd ntpd
keepdir /var/lib/ntp newinitd "${FILESDIR}"/ntp-client.rc ntp-client
use prefix || fowners ntp:ntp /var/lib/ntp newconfd "${FILESDIR}"/ntp-client.confd ntp-client
newinitd "${FILESDIR}"/sntp.rc sntp
newconfd "${FILESDIR}"/sntp.confd sntp
if ! use caps ; then
sed -i "s|-u ntp:ntp||" "${ED}"/etc/conf.d/ntpd || die
fi
sed -i "s:/usr/bin:/usr/sbin:" "${ED}"/etc/init.d/ntpd || die
if use openntpd ; then if use openntpd ; then
cd "${ED}" || die cd "${ED}" || die
rm usr/sbin/ntpd || die rm usr/sbin/ntpd || die
rm -r var/lib || die rm etc/{conf,init}.d/ntpd || die
rm usr/share/man/*/ntpd.8 || die rm usr/share/man/*/ntpd.8 || die
else else
systemd_dounit "${FILESDIR}"/ntpd.service newtmpfiles "${FILESDIR}"/ntp.tmpfiles ntp.conf
systemd_newunit "${FILESDIR}"/ntpd.service-r2 ntpd.service
if use caps ; then if use caps ; then
sed -i '/ExecStart/ s|$| -u ntp:ntp|' \ sed -i '/ExecStart/ s|$| -u ntp:ntp|' \
"${D}$(systemd_get_systemunitdir)"/ntpd.service \ "${D}$(systemd_get_systemunitdir)"/ntpd.service \
@ -120,6 +128,20 @@ src_install() {
systemd_enable_ntpunit 60-ntpd ntpd.service systemd_enable_ntpunit 60-ntpd ntpd.service
fi fi
systemd_dounit "${FILESDIR}"/ntpdate.service systemd_newunit "${FILESDIR}"/ntpdate.service-r2 ntpdate.service
systemd_dounit "${FILESDIR}"/sntp.service systemd_install_serviced "${FILESDIR}"/ntpdate.service.conf
systemd_newunit "${FILESDIR}"/sntp.service-r3 sntp.service
systemd_install_serviced "${FILESDIR}"/sntp.service.conf
}
pkg_postinst() {
if ! use openntpd; then
tmpfiles_process ntp.conf
fi
if grep -qs '^[^#].*notrust' "${EROOT}"/etc/ntp.conf ; then
eerror "The notrust option was found in your /etc/ntp.conf!"
ewarn "If your ntpd starts sending out weird responses,"
ewarn "then make sure you have keys properly setup and see"
ewarn "https://bugs.gentoo.org/41827"
fi
} }

View File

@ -0,0 +1,161 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools flag-o-matic systemd tmpfiles
MY_P=${P/_p/p}
DESCRIPTION="Network Time Protocol suite/programs"
HOMEPAGE="https://www.ntp.org/"
SRC_URI="https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="HPND BSD ISC"
SLOT="0"
KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
IUSE="caps debug ipv6 openntpd parse-clocks readline samba selinux snmp ssl +threads vim-syntax zeroconf"
DEPEND="
>=dev-libs/libevent-2.0.9:=[threads(+)?]
readline? ( >=sys-libs/readline-4.1:= )
kernel_linux? ( caps? ( sys-libs/libcap ) )
zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
snmp? ( net-analyzer/net-snmp )
ssl? ( dev-libs/openssl:= )
parse-clocks? ( net-misc/pps-tools )
"
RDEPEND="
${DEPEND}
acct-group/ntp
acct-user/ntp
selinux? ( sec-policy/selinux-ntp )
vim-syntax? ( app-vim/ntp-syntax )
!net-misc/ntpsec
!openntpd? ( !net-misc/openntpd )
"
BDEPEND="
acct-group/ntp
acct-user/ntp
virtual/pkgconfig
"
PDEPEND="openntpd? ( net-misc/openntpd )"
PATCHES=(
"${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch # bug #533966
"${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch # bug #563922
"${FILESDIR}"/${PN}-4.2.8_p14-add_cap_ipc_lock.patch # bug #711530
"${FILESDIR}"/${PN}-4.2.8_p15-configure-clang16.patch
)
src_prepare() {
default
# Make sure every build uses the same install layout, bug #539092
find sntp/loc/ -type f '!' -name legacy -delete || die
# bug #622754
eautoreconf
# Disable pointless checks.
touch .checkChangeLog .gcc-warning FRC.html html/.datecheck || die
}
src_configure() {
# bug #264109
append-cppflags -D_GNU_SOURCE
# avoid libmd5/libelf
export ac_cv_search_MD5Init=no ac_cv_header_md5_h=no
export ac_cv_lib_elf_nlist=no
# blah, no real configure options #176333
export ac_cv_header_dns_sd_h=$(usex zeroconf)
export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h}
# Unity builds, we don't really need support for it, bug #804109
export PATH_RUBY=/bin/false
local myeconfargs=(
--with-lineeditlibs=readline,edit,editline
--with-yielding-select
--disable-local-libevent
# Increase the default memlimit from 32MiB to 128MiB, bug #533232
--with-memlock=256
# Avoid overriding the user's toolchain settings, bug #895802
--with-hardenfile=/dev/null
$(use_enable caps linuxcaps)
$(use_enable parse-clocks)
$(use_enable ipv6)
$(use_enable debug debugging)
$(use_with readline lineeditlibs readline)
$(use_enable samba ntp-signd)
$(use_with snmp ntpsnmpd)
$(use_with ssl crypto)
$(use_enable threads thread-support)
)
econf "${myeconfargs[@]}"
}
src_install() {
default
# Move ntpd/ntpdate to sbin, bug #66671
dodir /usr/sbin
mv "${ED}"/usr/bin/{ntpd,ntpdate} "${ED}"/usr/sbin/ || die "move to sbin"
dodoc INSTALL WHERE-TO-START
insinto /etc
doins "${FILESDIR}"/ntp.conf
#bug #524726
use ipv6 || sed -i '/^restrict .*::1/d' "${ED}"/etc/ntp.conf
newinitd "${FILESDIR}"/ntpd.rc-r2 ntpd
newconfd "${FILESDIR}"/ntpd.confd ntpd
newinitd "${FILESDIR}"/ntp-client.rc ntp-client
newconfd "${FILESDIR}"/ntp-client.confd ntp-client
newinitd "${FILESDIR}"/sntp.rc sntp
newconfd "${FILESDIR}"/sntp.confd sntp
if ! use caps ; then
sed -i "s|-u ntp:ntp||" "${ED}"/etc/conf.d/ntpd || die
fi
sed -i "s:/usr/bin:/usr/sbin:" "${ED}"/etc/init.d/ntpd || die
if use openntpd ; then
cd "${ED}" || die
rm usr/sbin/ntpd || die
rm etc/{conf,init}.d/ntpd || die
rm usr/share/man/man1/ntpd.1 || die
else
newtmpfiles "${FILESDIR}"/ntp.tmpfiles ntp.conf
systemd_newunit "${FILESDIR}"/ntpd.service-r2 ntpd.service
if use caps ; then
sed -i '/ExecStart/ s|$| -u ntp:ntp|' \
"${D}$(systemd_get_systemunitdir)"/ntpd.service \
|| die
fi
systemd_enable_ntpunit 60-ntpd ntpd.service
fi
systemd_newunit "${FILESDIR}"/ntpdate.service-r2 ntpdate.service
systemd_install_serviced "${FILESDIR}"/ntpdate.service.conf
systemd_newunit "${FILESDIR}"/sntp.service-r3 sntp.service
systemd_install_serviced "${FILESDIR}"/sntp.service.conf
}
pkg_postinst() {
if ! use openntpd; then
tmpfiles_process ntp.conf
fi
if grep -qs '^[^#].*notrust' "${EROOT}"/etc/ntp.conf ; then
eerror "The notrust option was found in your /etc/ntp.conf!"
ewarn "If your ntpd starts sending out weird responses,"
ewarn "then make sure you have keys properly setup and see"
ewarn "https://bugs.gentoo.org/41827"
fi
}