diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fc17c5bec93e..97ad9d4898531 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -387,6 +387,7 @@ install(FILES ${CMAKE_BINARY_DIR}/etc/gitinfo.txt DESTINATION ${CMAKE_INSTALL_SY #---Recurse into the given subdirectories. This does not actually cause another cmake executable # to run. The same process will walk through the project's entire directory structure. +add_subdirectory (builtins/clib) # hard coded builtin for core add_subdirectory (core) add_subdirectory (builtins/zip) # hard coded builtin for core/zip add_subdirectory (math) diff --git a/builtins/clib/CMakeLists.txt b/builtins/clib/CMakeLists.txt new file mode 100644 index 0000000000000..ec2ab0b607841 --- /dev/null +++ b/builtins/clib/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. +# All rights reserved. +# +# For the licensing terms see $ROOTSYS/LICENSE. +# For the list of contributors see $ROOTSYS/README/CREDITS. + +############################################################################ +# CMakeLists.txt file for building ROOT core/clib package +############################################################################ + +add_library(ROOTclib STATIC) + +target_sources(ROOTclib PUBLIC + inc/strlcpy.h # custom ROOT file (https://github.com/root-project/root/blob/b48975de4dcbcd5f1ecf7f60c3f8e39c38a1f6e3/core/clib/inc/strlcpy.h) + inc/strtok.h # custom ROOT file (https://github.com/root-project/root/blob/d39c9211ba045c0b9aaa780ec76a32666e04cd1e/core/clib/inc/strtok.h) +) + +target_sources(ROOTclib PRIVATE + # All this code below is LGPL (GNU Lesser General Public License was called at that time GNU Library General Public License) + src/attach.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/attach.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/attach.c) + src/detach.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/detach.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/detach.c) + src/getpagesize.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/getpagesize.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mvalloc.c) + src/keys.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/keys.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/keys.c) + src/mcalloc.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/mcalloc.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mcalloc.c) + src/mfree.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/mfree.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mfree.c) + src/mmalloc.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/mmalloc.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mmalloc.c) + src/mmapsup.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/mmapsup.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mmap-sup.c) + src/mmcheck.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/mmcheck.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mmcheck.c) + src/mrealloc.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/mrealloc.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mrealloc.c) + src/sbrksup.c # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/src/sbrksup.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/sbrk-sup.c) + src/strlcat.c # forked in 2010 from OpenBSD (https://github.com/root-project/root/blob/b48975de4dcbcd5f1ecf7f60c3f8e39c38a1f6e3/core/clib/src/strlcat.c vs https://github.com/libressl/openbsd/blob/032d9a965adfb74e42b18dc939b34fcda2cf740e/src/lib/libc/string/strlcat.c) + src/strlcpy.c # forked in 2010 from OpenBSD (https://github.com/root-project/root/blob/b48975de4dcbcd5f1ecf7f60c3f8e39c38a1f6e3/core/clib/src/strlcpy.c vs https://github.com/libressl/openbsd/blob/032d9a965adfb74e42b18dc939b34fcda2cf740e/src/lib/libc/string/strlcpy.c) + # res/mmalloc.h (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/inc/mmalloc.h vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mmalloc.h) + # res/mmconfig.h # custom ROOT file (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/inc/mmconfig.h) + # res/mmprivate.h # forked in 1999 from gdb-4 (https://github.com/root-project/root/blob/852600061bcacd9b255d44f6312c96b6b1e00a2d/clib/inc/mmprivate.c vs https://github.com/gnutools/binutils-gdb/blob/c906108c21474dfb4ed285bcc0ac6fe02cd400cc/mmalloc/mmprivate.c) +) + +include(CheckSourceCompiles) +check_source_compiles(C + "#include + int main() { + char dst[10]; + strlcpy(dst, \"a\", 10); + return 0; + }" + HAS_STRLCPY +) + + +target_compile_definitions(ROOTclib PUBLIC $<$:HAS_STRLCPY>) +if (NOT WIN32) + target_compile_definitions(ROOTclib PRIVATE INVALID_HANDLE_VALUE=-1) +endif() +if (UNIX) +target_compile_definitions(ROOTclib PRIVATE R__HAVE_UNISTD_H) +endif() +target_compile_definitions(ROOTclib PRIVATE R__HAVE_MMAP) +target_compile_definitions(ROOTclib PRIVATE NO_SBRK_MALLOC) +target_compile_definitions(ROOTclib PRIVATE $<$:R__LYNXOS>) +target_compile_definitions(ROOTclib PRIVATE $<$:R__HURD>) + +target_include_directories(ROOTclib + PUBLIC + $ + $ # New requires those publicly +) +set_property(TARGET ROOTclib PROPERTY POSITION_INDEPENDENT_CODE ON) +target_link_options(ROOTclib PRIVATE -fvisibility=hidden) diff --git a/core/clib/inc/strlcpy.h b/builtins/clib/inc/strlcpy.h similarity index 82% rename from core/clib/inc/strlcpy.h rename to builtins/clib/inc/strlcpy.h index 460ac9e85992e..fcc532cb387e9 100644 --- a/core/clib/inc/strlcpy.h +++ b/builtins/clib/inc/strlcpy.h @@ -2,18 +2,16 @@ /* Author: Fons Rademakers 20/9/2010 */ /* - Inlcude file for strlcpy and strlcat. They are in string.h on systems + Include file for strlcpy and strlcat. They are in string.h on systems that have these function (BSD based systems). */ #ifndef ROOT_strlcpy #define ROOT_strlcpy -#include - #ifndef HAS_STRLCPY -#ifndef WIN32 +#ifndef _WIN32 # include #else # include diff --git a/core/clib/inc/strtok.h b/builtins/clib/inc/strtok.h similarity index 80% rename from core/clib/inc/strtok.h rename to builtins/clib/inc/strtok.h index 5d41cc98b60a9..e7502e4079e59 100644 --- a/core/clib/inc/strtok.h +++ b/builtins/clib/inc/strtok.h @@ -1,14 +1,12 @@ #ifndef ROOT_strtok #define ROOT_strtok -#include - -#include +#include // On Windows strtok_r does not exist: the function is called strtok_s. inline char *R__STRTOK_R(char *str, const char *delim, char **saveptr) { -#if defined(R__WIN32) +#if defined(_WIN32) return strtok_s(str, delim, saveptr); #else return strtok_r(str, delim, saveptr); diff --git a/core/clib/res/mmalloc.h b/builtins/clib/res/mmalloc.h similarity index 88% rename from core/clib/res/mmalloc.h rename to builtins/clib/res/mmalloc.h index 6e383608aa436..04166d45eae6c 100644 --- a/core/clib/res/mmalloc.h +++ b/builtins/clib/res/mmalloc.h @@ -12,25 +12,17 @@ #ifndef MMALLOC_H #define MMALLOC_H 1 -/* FIXME: If doesn't exist, you'll need to do something - to define size_t before including this file. Like upgrading - to a system with an ANSI C environment. */ - -#include "mmconfig.h" - -#ifdef WIN32 +#ifdef _WIN32 # include #endif -#ifdef R__HAVE_STDDEF_H # include -#endif #define PTR void * #define PARAMS(paramlist) paramlist -#ifdef WIN32 - extern struct mmstats_t mmstats PARAMS ((PTR)); +#ifdef _WIN32 +extern struct mmstats_t mmstats PARAMS((PTR)); #endif #ifdef __cplusplus @@ -80,8 +72,8 @@ include/mmalloc.h:73:25: warning: 'mmstats' has C-linkage specified, but returns */ // extern struct mmstats_t mmstats PARAMS ((PTR)); -#ifndef WIN32 - extern PTR mmalloc_attach PARAMS ((int, PTR, int)); +#ifndef _WIN32 +extern PTR mmalloc_attach PARAMS((int, PTR, int)); #else extern PTR mmalloc_attach PARAMS ((HANDLE, PTR, int)); #endif diff --git a/core/clib/res/mmprivate.h b/builtins/clib/res/mmprivate.h similarity index 97% rename from core/clib/res/mmprivate.h rename to builtins/clib/res/mmprivate.h index 2cac278f858c8..788b777fc2f6d 100644 --- a/core/clib/res/mmprivate.h +++ b/builtins/clib/res/mmprivate.h @@ -38,27 +38,12 @@ #include "mmalloc.h" -#ifdef R__HAVE_LIMITS_H -# include -#else -# ifndef CHAR_BIT -# define CHAR_BIT 8 -# endif -#endif - -#ifdef R__HAVE_STDDEF_H -# include -#else -# include /* hope for the best -- ANSI C is your friend */ -#endif - +#include +#include #ifdef R__HAVE_UNISTD_H -# include +#include #endif -#ifdef R__HAVE_STDLIB_H -# include -#endif - +#include #include #ifndef MIN @@ -303,7 +288,7 @@ struct mdesc by default if no open file is supplied by the client. Also note that it may change each time the region is mapped and unmapped. */ -#ifndef WIN32 +#ifndef _WIN32 int fd; #else HANDLE fd; diff --git a/core/clib/src/attach.c b/builtins/clib/src/attach.c similarity index 97% rename from core/clib/src/attach.c rename to builtins/clib/src/attach.c index 853fce91a441b..70f20ebc89484 100644 --- a/core/clib/src/attach.c +++ b/builtins/clib/src/attach.c @@ -23,7 +23,10 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - +#ifndef _WIN32 +#include +#include +#endif #include #include #include @@ -32,7 +35,7 @@ Boston, MA 02111-1307, USA. */ #include #include "mmprivate.h" -#ifndef WIN32 +#ifndef _WIN32 # include #else # include @@ -47,7 +50,7 @@ Boston, MA 02111-1307, USA. */ /* Forward declarations/prototypes for local functions */ -#ifndef WIN32 +#ifndef _WIN32 static struct mdesc *reuse PARAMS ((int)); #else static struct mdesc *reuse PARAMS ((HANDLE)); @@ -85,7 +88,7 @@ Boston, MA 02111-1307, USA. */ On failure returns NULL. */ PTR -#ifndef WIN32 +#ifndef _WIN32 mmalloc_attach (int fd, PTR baseaddr, int minsize) #else mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) @@ -95,7 +98,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) struct mdesc *mdp; PTR mbase; int coresize; -#ifndef WIN32 +#ifndef _WIN32 struct stat sbuf; #else BY_HANDLE_FILE_INFORMATION sbuf; @@ -108,7 +111,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) obsolete version, or any other reason, then we fail to attach to this file. */ -#ifndef WIN32 +#ifndef _WIN32 if (fd >= 0) { if (fstat (fd, &sbuf) < 0) @@ -132,7 +135,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) return ((PTR) reuse (fd)); } } -#endif /* WIN32 */ +#endif /* _WIN32 */ /* We start off with the malloc descriptor allocated on the stack, until we build it up enough to call _mmalloc_mmap_morecore() to allocate the @@ -151,7 +154,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) /* If we have not been passed a valid open file descriptor for the file to map to, then open /dev/zero and use that to map to. */ -#ifndef WIN32 +#ifndef _WIN32 if (mdp -> fd < 0) { if ((mdp -> fd = open ("/dev/zero", O_RDWR)) < 0) @@ -165,7 +168,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) } #else if (mdp -> fd == (HANDLE)0xffffffff) mdp -> flags |= MMALLOC_DEVZERO; -#endif /* WIN32 */ +#endif /* _WIN32 */ /* Now try to map in the first page, copy the malloc descriptor structure there, and arrange to return a pointer to this new copy. If the mapping @@ -181,7 +184,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) { mdp->breakval = mdp->base + sizeof(mtemp); memcpy (mbase, mdp, sizeof (mtemp)); -#ifndef WIN32 +#ifndef _WIN32 # ifndef VMS # ifndef R__LYNXOS # ifndef R__HURD @@ -197,7 +200,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) { if (mdp -> flags & MMALLOC_DEVZERO) { -#ifndef WIN32 +#ifndef _WIN32 close (mdp -> fd); #else CloseHandle (mdp -> fd); @@ -233,7 +236,7 @@ mmalloc_attach (HANDLE fd, PTR baseaddr, int minsize) unsuccessful for some reason. */ static struct mdesc * -#ifndef WIN32 +#ifndef _WIN32 reuse(int cfd) #else reuse(HANDLE cfd) @@ -242,7 +245,7 @@ reuse(HANDLE cfd) struct mdesc *mtemp = (struct mdesc*) malloc(sizeof(struct mdesc)); struct mdesc *mdp = NULL; -#ifdef WIN32 +#ifdef _WIN32 int rdonly = 0; BY_HANDLE_FILE_INFORMATION FileInformation; DWORD lbuf; @@ -289,7 +292,7 @@ reuse(HANDLE cfd) if (mtemp->offset != 0) goto end; mdp = (struct mdesc *) mtemp->base; mdp -> fd = cfd; -#ifndef WIN32 +#ifndef _WIN32 # ifndef VMS # ifndef R__LYNXOS # ifndef R__HURD @@ -328,7 +331,7 @@ reuse(HANDLE cfd) mmalloc_attach (fd, baseaddr) #endif -#ifndef WIN32 +#ifndef _WIN32 int fd; #else HANDLE fd; diff --git a/core/clib/src/detach.c b/builtins/clib/src/detach.c similarity index 97% rename from core/clib/src/detach.c rename to builtins/clib/src/detach.c index 13e17a8cf5946..6e405e0095bd9 100644 --- a/core/clib/src/detach.c +++ b/builtins/clib/src/detach.c @@ -23,6 +23,9 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef _WIN32 +#include +#endif #include #include /* After sys/types.h, at least for dpx/2. */ #include "mmprivate.h" @@ -63,7 +66,7 @@ PTR mmalloc_detach(PTR md) { if (mtemp.flags & MMALLOC_DEVZERO) { -#ifndef WIN32 +#ifndef _WIN32 close (mtemp.fd); #else CloseHandle(mtemp.fd); diff --git a/core/clib/src/getpagesize.c b/builtins/clib/src/getpagesize.c similarity index 96% rename from core/clib/src/getpagesize.c rename to builtins/clib/src/getpagesize.c index 950cf559bdb96..59b35ef70a225 100644 --- a/core/clib/src/getpagesize.c +++ b/builtins/clib/src/getpagesize.c @@ -1,6 +1,6 @@ /* @(#)root/clib:$Id$ */ /* Author: */ -#ifdef WIN32 +#ifdef _WIN32 #include #include "mmalloc.h" diff --git a/core/clib/src/keys.c b/builtins/clib/src/keys.c similarity index 97% rename from core/clib/src/keys.c rename to builtins/clib/src/keys.c index 46cda278579b8..9f407fd053c70 100644 --- a/core/clib/src/keys.c +++ b/builtins/clib/src/keys.c @@ -34,10 +34,10 @@ Boston, MA 02111-1307, USA. */ can be an unlimited number of keys, possibly using a multilevel access scheme of some sort. */ -#ifndef WIN32 +#ifndef _WIN32 # include # include -#endif /* WIN32 */ +#endif /* _WIN32 */ #include "mmprivate.h" @@ -49,7 +49,7 @@ int mmalloc_setkey(PTR md, int keynum, PTR key) if ((mdp != NULL) && (keynum >= 0) && (keynum < MMALLOC_KEYS)) { mdp -> keys [keynum] = key; -#ifndef WIN32 +#ifndef _WIN32 #ifndef VMS #ifndef R__LYNXOS #ifndef R__HURD diff --git a/core/clib/src/mcalloc.c b/builtins/clib/src/mcalloc.c similarity index 100% rename from core/clib/src/mcalloc.c rename to builtins/clib/src/mcalloc.c diff --git a/core/clib/src/mfree.c b/builtins/clib/src/mfree.c similarity index 100% rename from core/clib/src/mfree.c rename to builtins/clib/src/mfree.c diff --git a/core/clib/src/mmalloc.c b/builtins/clib/src/mmalloc.c similarity index 100% rename from core/clib/src/mmalloc.c rename to builtins/clib/src/mmalloc.c diff --git a/core/clib/src/mmapsup.c b/builtins/clib/src/mmapsup.c similarity index 98% rename from core/clib/src/mmapsup.c rename to builtins/clib/src/mmapsup.c index da46dc7ba5d97..a6baf74a17e7a 100644 --- a/core/clib/src/mmapsup.c +++ b/builtins/clib/src/mmapsup.c @@ -31,7 +31,7 @@ Boston, MA 02111-1307, USA. */ #include #include #include -#ifdef WIN32 +#ifdef _WIN32 typedef char* caddr_t; #else # include @@ -68,7 +68,7 @@ PTR __mmalloc_mmap_morecore(struct mdesc *mdp, int size) caddr_t moveto; /* Address where we wish to move "break value" to */ caddr_t mapto; /* Address we actually mapped to */ char buf = 0; /* Single byte to write to extend mapped file */ -#ifdef WIN32 +#ifdef _WIN32 HANDLE hMap; #endif @@ -108,7 +108,7 @@ PTR __mmalloc_mmap_morecore(struct mdesc *mdp, int size) if (mdp -> breakval == mdp -> base) { /* moveto = PAGE_ALIGN (mdp -> breakval); */ moveto = PAGE_ALIGN (mdp -> base); -#ifndef WIN32 +#ifndef _WIN32 munmap (moveto, (size_t) (mdp -> top - moveto)); #else UnmapViewOfFile(moveto); @@ -135,7 +135,7 @@ PTR __mmalloc_mmap_morecore(struct mdesc *mdp, int size) moveto = PAGE_ALIGN (mdp -> breakval + size); mapbytes = moveto - mdp -> top; foffset = mdp -> top - mdp -> base; -#ifndef WIN32 +#ifndef _WIN32 if (lseek (mdp -> fd, foffset + mapbytes - 1, SEEK_SET) == -1) { fprintf(stderr, "mmap_morecore: error in lseek (%d)\n", errno); return (result); @@ -170,7 +170,7 @@ PTR __mmalloc_mmap_morecore(struct mdesc *mdp, int size) } } else { /*fprintf(stderr, "mmap_morecore: try to extend mapping by %d bytes, use bigger TMapFile\n", mapbytes);*/ -#ifndef WIN32 +#ifndef _WIN32 if (mdp -> top != PAGE_ALIGN(mdp -> top)) { fprintf(stderr, "mmap_morecore error: base memory location (%p) is not aligned with %zu as required.\n", @@ -213,7 +213,7 @@ PTR __mmalloc_remap_core(struct mdesc *mdp) caddr_t base; int rdonly = 0; -#ifndef WIN32 +#ifndef _WIN32 int val; if ((val = fcntl(mdp->fd, F_GETFL, 0)) < 0) { fprintf(stderr, "__mmalloc_remap_core: error calling fcntl(%d)\n", errno); @@ -233,7 +233,7 @@ PTR __mmalloc_remap_core(struct mdesc *mdp) #endif if (rdonly) { -#ifndef WIN32 +#ifndef _WIN32 base = mmap (mdp -> base, mdp -> top - mdp -> base, PROT_READ, MAP_SHARED /* | MAP_FIXED */, mdp -> fd, 0); @@ -262,7 +262,7 @@ PTR __mmalloc_remap_core(struct mdesc *mdp) #endif if (base != mdp->base) mdp->offset = base - mdp->base; } else { -#ifndef WIN32 +#ifndef _WIN32 base = mmap (mdp -> base, mdp -> top - mdp -> base, PROT_READ | PROT_WRITE, MAP_SHARED /* | MAP_FIXED */, mdp -> fd, 0); @@ -301,7 +301,7 @@ int mmalloc_update_mapping(PTR md) size_t mapbytes; off_t foffset; int result; -#ifdef WIN32 +#ifdef _WIN32 HANDLE hMap; #endif @@ -312,7 +312,7 @@ int mmalloc_update_mapping(PTR md) if (top < oldtop) { -#ifndef WIN32 +#ifndef _WIN32 munmap (top, (size_t) (oldtop - top)); #else UnmapViewOfFile((LPCVOID)top); @@ -323,7 +323,7 @@ int mmalloc_update_mapping(PTR md) mapbytes = top - oldtop; foffset = oldtop - mdp->base; -#ifndef WIN32 +#ifndef _WIN32 mapto = mmap (oldtop, mapbytes, PROT_READ, MAP_SHARED /* | MAP_FIXED */, mdp -> fd, foffset); #else diff --git a/core/clib/src/mmcheck.c b/builtins/clib/src/mmcheck.c similarity index 100% rename from core/clib/src/mmcheck.c rename to builtins/clib/src/mmcheck.c diff --git a/core/clib/src/mrealloc.c b/builtins/clib/src/mrealloc.c similarity index 100% rename from core/clib/src/mrealloc.c rename to builtins/clib/src/mrealloc.c diff --git a/core/clib/src/sbrksup.c b/builtins/clib/src/sbrksup.c similarity index 100% rename from core/clib/src/sbrksup.c rename to builtins/clib/src/sbrksup.c diff --git a/core/clib/src/strlcat.c b/builtins/clib/src/strlcat.c similarity index 96% rename from core/clib/src/strlcat.c rename to builtins/clib/src/strlcat.c index d543461531cd8..d458f47c409fe 100644 --- a/core/clib/src/strlcat.c +++ b/builtins/clib/src/strlcat.c @@ -16,15 +16,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* for HAS_STRLCPY */ - #ifndef HAS_STRLCPY #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$OpenBSD: strlcat.c,v 1.11 2003/06/17 21:56:24 millert Exp $"; #endif /* LIBC_SCCS and not lint */ -#ifndef WIN32 +#ifndef _WIN32 # include #else # include diff --git a/core/clib/src/strlcpy.c b/builtins/clib/src/strlcpy.c similarity index 96% rename from core/clib/src/strlcpy.c rename to builtins/clib/src/strlcpy.c index 16001845bd1b8..040d1526f94a0 100644 --- a/core/clib/src/strlcpy.c +++ b/builtins/clib/src/strlcpy.c @@ -16,15 +16,13 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include /* for HAS_STRLCPY */ - #ifndef HAS_STRLCPY #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$OpenBSD: strlcpy.c,v 1.8 2003/06/17 21:56:24 millert Exp $"; #endif /* LIBC_SCCS and not lint */ -#ifndef WIN32 +#ifndef _WIN32 # include #else # include diff --git a/cmake/unix/module.modulemap b/cmake/unix/module.modulemap index 2c9cdf3abddd7..7d863ee7ffddb 100644 --- a/cmake/unix/module.modulemap +++ b/cmake/unix/module.modulemap @@ -2,7 +2,6 @@ // C and C++ context. module ROOT_Foundation_C { module "ThreadLocalStorage.h" { header "ThreadLocalStorage.h" export * } - module "strlcpy.h" { header "strlcpy.h" export * } export * } diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 3d2069d3d1d38..e15973c7010a3 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -61,7 +61,6 @@ add_subdirectory(sanitizer) add_subdirectory(rootcling_stage1) add_subdirectory(base) -add_subdirectory(clib) add_subdirectory(clingutils) add_subdirectory(cont) add_subdirectory(dictgen) diff --git a/core/base/CMakeLists.txt b/core/base/CMakeLists.txt index f6b8a0be390cd..77aa4d544ec7c 100644 --- a/core/base/CMakeLists.txt +++ b/core/base/CMakeLists.txt @@ -257,6 +257,8 @@ endif() target_compile_options(Core PRIVATE -DLIB_CORE_NAME=${full_core_filename} -DINSTALL_LIB_TO_INCLUDE="${install_lib_to_include}" ) +target_link_libraries(Core PRIVATE ROOTclib) + add_dependencies(Core ensure_build_tree_marker) if(PCRE2_FOUND) diff --git a/core/base/inc/Rtypes.h b/core/base/inc/Rtypes.h index f76760d381178..10864fa83539a 100644 --- a/core/base/inc/Rtypes.h +++ b/core/base/inc/Rtypes.h @@ -22,14 +22,6 @@ #include "RtypesCore.h" // #include "DllImport.h" // included via RtypesCore.h, not used here - -#ifndef R__LESS_INCLUDES -#include -#include "strtok.h" // provides R__STRTOK_R with include -#include "strlcpy.h" // part of string.h on systems that have it -#include -#endif - #include #include diff --git a/core/base/inc/TString.h b/core/base/inc/TString.h index ebb0d5c5d3c20..d6c6cb15ab856 100644 --- a/core/base/inc/TString.h +++ b/core/base/inc/TString.h @@ -27,7 +27,6 @@ #include #include "ROOT/TypeTraits.hxx" - #include #include #include diff --git a/core/base/src/TSystem.cxx b/core/base/src/TSystem.cxx index bf312d7011747..a559613235e69 100644 --- a/core/base/src/TSystem.cxx +++ b/core/base/src/TSystem.cxx @@ -23,7 +23,6 @@ allows a simple partial implementation for new OS'es. #include #include -#include "strlcpy.h" #include "TSystem.h" #include "TApplication.h" #include "TException.h" @@ -46,6 +45,7 @@ allows a simple partial implementation for new OS'es. #include "RConfigure.h" #include "THashList.h" #include "ThreadLocalStorage.h" +#include "strlcpy.h" #include #include diff --git a/core/base/src/TVirtualPS.cxx b/core/base/src/TVirtualPS.cxx index 9c832924fd752..8fd00d2aabe26 100644 --- a/core/base/src/TVirtualPS.cxx +++ b/core/base/src/TVirtualPS.cxx @@ -1,3 +1,4 @@ + // @(#)root/base:$Id$ // Author: Rene Brun 05/09/99 @@ -17,8 +18,8 @@ TVirtualPS is an abstract interface to Postscript, PDF, SVG. TeX etc... drivers */ #include -#include "strlcpy.h" #include "TVirtualPS.h" +#include "strlcpy.h" TVirtualPS *gVirtualPS = nullptr; diff --git a/core/clib/CMakeLists.txt b/core/clib/CMakeLists.txt deleted file mode 100644 index 47836cf32fe68..0000000000000 --- a/core/clib/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. -# All rights reserved. -# -# For the licensing terms see $ROOTSYS/LICENSE. -# For the list of contributors see $ROOTSYS/README/CREDITS. - -############################################################################ -# CMakeLists.txt file for building ROOT core/clib package -############################################################################ - -set_property(TARGET Core APPEND PROPERTY DICT_HEADERS - strlcpy.h - strtok.h -) - -ROOT_OBJECT_LIBRARY(Clib - src/attach.c - src/detach.c - src/getpagesize.c - src/keys.c - src/mcalloc.c - src/mfree.c - src/mmalloc.c - src/mmapsup.c - src/mmcheck.c - src/mrealloc.c - src/sbrksup.c - src/strlcat.c - src/strlcpy.c -) - -target_include_directories(Clib - PUBLIC - $ - PRIVATE - ${CMAKE_BINARY_DIR}/ginclude - ${CMAKE_CURRENT_SOURCE_DIR}/res - ${CMAKE_CURRENT_SOURCE_DIR}/../foundation/inc # for RConfig.hxx -) - -target_include_directories(Core - PUBLIC - $ -) - -target_sources(Core PRIVATE $) - -ROOT_INSTALL_HEADERS() diff --git a/core/clib/inc/snprintf.h b/core/clib/inc/snprintf.h deleted file mode 100644 index 7fbaada9f407e..0000000000000 --- a/core/clib/inc/snprintf.h +++ /dev/null @@ -1,21 +0,0 @@ -/* @(#)root/clib:$Id$ */ -/* Author: Fons Rademakers 10/12/2000 */ - -/* - Write formatted text to buffer 'string', using format string 'format'. - Returns number of characters written, or -1 if truncated. - Format string is understood as defined in ANSI C. -*/ - -#ifndef ROOT_snprintf -#define ROOT_snprintf - -#warning "This header is deprecated and will be removed in ROOT 6.44, use instead " - -#include -#include -#ifdef NEED_SNPRINTF -#error "ROOT no longer provides fallback implementation for snprintf. NEED_SNPRINTF should not be defined." -#endif /* NEED_SNPRINTF */ - -#endif /* ROOT_snprintf */ diff --git a/core/clib/res/mmconfig.h b/core/clib/res/mmconfig.h deleted file mode 100644 index 7adab9a527161..0000000000000 --- a/core/clib/res/mmconfig.h +++ /dev/null @@ -1,36 +0,0 @@ -/* @(#)root/clib:$Id$ */ - -/************************************************************************* - * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef MMCONFIG_H -#define MMCONFIG_H - -#include - -#ifndef WIN32 -# ifndef INVALID_HANDLE_VALUE -# define INVALID_HANDLE_VALUE -1 -# endif -#endif - -#if defined(R__UNIX) -# define R__HAVE_UNISTD_H -# define R__HAVE_STDLIB_H -# define R__HAVE_STDDEF_H -# define R__HAVE_LIMITS_H -# define R__HAVE_MMAP -# define NO_SBRK_MALLOC -#else -# define R__HAVE_STDDEF_H -# define R__HAVE_LIMITS_H -# define R__HAVE_MMAP -# define NO_SBRK_MALLOC -#endif - -#endif diff --git a/core/clingutils/CMakeLists.txt b/core/clingutils/CMakeLists.txt index 583983ba2121c..a96934f4146a0 100644 --- a/core/clingutils/CMakeLists.txt +++ b/core/clingutils/CMakeLists.txt @@ -36,10 +36,11 @@ target_include_directories(ClingUtils PRIVATE ${CMAKE_SOURCE_DIR}/core/foundation/res ${CMAKE_SOURCE_DIR}/core/foundation/inc ${CMAKE_SOURCE_DIR}/core/base/inc - ${CMAKE_SOURCE_DIR}/core/clib/inc ${CMAKE_SOURCE_DIR}/core/meta/inc ${CMAKE_BINARY_DIR}/ginclude) + target_link_libraries(ClingUtils PRIVATE ROOTclib) + # Register the llvm include directories after clangs. This instructs the compiler to resolve # headers from our builtin clang. That's an issue when we are building with bultin_llvm=Off # and we have installed clang headers, too. diff --git a/core/dictgen/CMakeLists.txt b/core/dictgen/CMakeLists.txt index dccbc9b297e38..16e78d8b5ae00 100644 --- a/core/dictgen/CMakeLists.txt +++ b/core/dictgen/CMakeLists.txt @@ -48,13 +48,14 @@ target_include_directories(Dictgen PRIVATE ${CMAKE_SOURCE_DIR}/core/foundation/res ${CMAKE_SOURCE_DIR}/core/clingutils/res ${CMAKE_SOURCE_DIR}/core/base/inc - ${CMAKE_SOURCE_DIR}/core/clib/inc ${CMAKE_SOURCE_DIR}/core/meta/inc ${CMAKE_SOURCE_DIR}/core/foundation/inc ${CMAKE_BINARY_DIR}/ginclude ${CLING_INCLUDE_DIRS} ) +target_link_libraries(Dictgen PRIVATE ROOTclib) + # Register the llvm include directories after clangs. This instructs the compiler to resolve # headers from our builtin clang. That's an issue when we are building with bultin_llvm=Off # and we have installed clang headers, too. diff --git a/core/foundation/inc/ROOT/RConfig.hxx b/core/foundation/inc/ROOT/RConfig.hxx index 52b38bcee1900..3e39525832dfc 100644 --- a/core/foundation/inc/ROOT/RConfig.hxx +++ b/core/foundation/inc/ROOT/RConfig.hxx @@ -131,9 +131,6 @@ # define R__USESTHROW # define R__SEEK64 # endif -# if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) -# define HAS_STRLCPY -# endif #endif #if defined(linux) && defined(__i386__) @@ -262,7 +259,6 @@ # if defined(__amd64__) # define R__B64 # endif -# define HAS_STRLCPY #endif #if defined(__OpenBSD__) @@ -277,7 +273,6 @@ # if defined(__amd64__) # define R__B64 # endif -# define HAS_STRLCPY #endif #if defined(__APPLE__) /* MacOS X support, initially following FreeBSD */ @@ -305,7 +300,6 @@ # define R__BYTESWAP # define R__B64 /* enable when 64 bit machine */ # endif -# define HAS_STRLCPY #endif #ifdef _HIUX_SOURCE diff --git a/core/macosx/CMakeLists.txt b/core/macosx/CMakeLists.txt index e3e38e959316f..dd8701c96c99d 100644 --- a/core/macosx/CMakeLists.txt +++ b/core/macosx/CMakeLists.txt @@ -32,6 +32,7 @@ if(cocoa) target_compile_options(Macosx PRIVATE -ObjC++) target_include_directories(Macosx PRIVATE ../unix/inc) + target_link_libraries(Macosx PRIVATE ROOTclib) # for strtok.h target_sources(Core PRIVATE $) diff --git a/core/metacling/src/CMakeLists.txt b/core/metacling/src/CMakeLists.txt index ce830802a9b21..d5400ed18ec6d 100644 --- a/core/metacling/src/CMakeLists.txt +++ b/core/metacling/src/CMakeLists.txt @@ -56,7 +56,6 @@ target_include_directories(MetaCling SYSTEM PRIVATE target_include_directories(MetaCling PRIVATE ${CLING_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/core/base/inc - ${CMAKE_SOURCE_DIR}/core/clib/inc ${CMAKE_SOURCE_DIR}/core/clingutils/res ${CMAKE_SOURCE_DIR}/core/cont/inc ${CMAKE_SOURCE_DIR}/core/foundation/inc @@ -68,6 +67,7 @@ target_include_directories(MetaCling PRIVATE ${CMAKE_SOURCE_DIR}/io/io/inc ${CMAKE_BINARY_DIR}/ginclude ) +target_link_libraries(MetaCling PRIVATE ROOTclib) set_target_properties(MetaCling PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}" diff --git a/core/newdelete/CMakeLists.txt b/core/newdelete/CMakeLists.txt index de0a180cdbe8b..9be2ae4e586d6 100644 --- a/core/newdelete/CMakeLists.txt +++ b/core/newdelete/CMakeLists.txt @@ -18,6 +18,6 @@ ROOT_LINKER_LIBRARY(New Core ) -target_include_directories(New PRIVATE ${CMAKE_SOURCE_DIR}/core/clib/res) +target_link_libraries(New PRIVATE ROOTclib) ROOT_INSTALL_HEADERS() diff --git a/core/rint/CMakeLists.txt b/core/rint/CMakeLists.txt index 80e9aea0e0fe6..df1c2c068c871 100644 --- a/core/rint/CMakeLists.txt +++ b/core/rint/CMakeLists.txt @@ -23,5 +23,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Rint ) target_include_directories(Core PRIVATE inc) +target_link_libraries(Rint PRIVATE ROOTclib) ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/core/rootcling_stage1/CMakeLists.txt b/core/rootcling_stage1/CMakeLists.txt index b333c14fe0893..fe572dc29e180 100644 --- a/core/rootcling_stage1/CMakeLists.txt +++ b/core/rootcling_stage1/CMakeLists.txt @@ -29,7 +29,7 @@ else() endif() ROOT_EXECUTABLE(rootcling_stage1 src/rootcling_stage1.cxx - $ + $ $ $ $ diff --git a/core/textinput/src/Getline.cxx b/core/textinput/src/Getline.cxx index 5ca39897fbfb0..99c24ea5b6e4b 100644 --- a/core/textinput/src/Getline.cxx +++ b/core/textinput/src/Getline.cxx @@ -11,7 +11,6 @@ #include "Getline.h" #include "strlcpy.h" - #include #include #include diff --git a/core/thread/src/TThread.cxx b/core/thread/src/TThread.cxx index a27b200d421b0..5ab8c7d4d5f2c 100644 --- a/core/thread/src/TThread.cxx +++ b/core/thread/src/TThread.cxx @@ -39,9 +39,8 @@ TPosixThread or TWin32Thread). #include "TThreadSlots.h" #include "TRWMutexImp.h" -#include - #include +#include TThreadImp *TThread::fgThreadImp = nullptr; Long_t TThread::fgMainId = 0; @@ -921,7 +920,7 @@ void **TThread::GetTls(Int_t k) { void TThread::Printf(const char *fmt, ...) { va_list ap; - va_start(ap, fmt); + va_start(ap,fmt); Int_t buf_size = 2048; char *buf; diff --git a/core/unix/CMakeLists.txt b/core/unix/CMakeLists.txt index f1bfed48174af..200d148eb29f0 100644 --- a/core/unix/CMakeLists.txt +++ b/core/unix/CMakeLists.txt @@ -14,7 +14,11 @@ endif() set_property(TARGET Core APPEND PROPERTY DICT_HEADERS TUnixSystem.h) target_sources(Core PRIVATE src/TUnixSystem.cxx) -target_include_directories(Core PRIVATE inc ../clib/res) +target_link_libraries(Core PRIVATE ROOTclib) +target_include_directories(Core + PUBLIC + $ +) if (CMAKE_SYSTEM_NAME MATCHES FreeBSD) target_link_libraries(Core PRIVATE execinfo util) diff --git a/documentation/doxygen/Doxyfile b/documentation/doxygen/Doxyfile index 363a5fc785118..e1d7f146f1252 100644 --- a/documentation/doxygen/Doxyfile +++ b/documentation/doxygen/Doxyfile @@ -1081,7 +1081,6 @@ EXCLUDE = ../../interpreter/ \ ../../cmake \ ../../etc \ ../../js \ - ../../core/clib/ \ ../../core/lzma/ \ ../../core/lz4/ \ ../../core/newdelete/ \ diff --git a/documentation/doxygen/makeinput.sh b/documentation/doxygen/makeinput.sh index a94b19940f085..e4b9577e72345 100755 --- a/documentation/doxygen/makeinput.sh +++ b/documentation/doxygen/makeinput.sh @@ -74,7 +74,6 @@ echo " ../../bindings/tpython/ \\" >> Doxyfile_INPUT echo " ../../bindings/pyroot/ \\" >> Doxyfile_INPUT echo " ../../bindings/pyroot/pythonizations/python/ROOT/_pythonization/ \\" >> Doxyfile_INPUT -# echo " ../../core/clib/ \\" >> Doxyfile_INPUT # echo " ../../core/lzma/ \\" >> Doxyfile_INPUT # echo " ../../core/newdelete/ \\" >> Doxyfile_INPUT # echo " ../../core/textinput/ \\" >> Doxyfile_INPUT diff --git a/graf2d/asimage/CMakeLists.txt b/graf2d/asimage/CMakeLists.txt index 48a3143979bee..063ad854d04fd 100644 --- a/graf2d/asimage/CMakeLists.txt +++ b/graf2d/asimage/CMakeLists.txt @@ -46,6 +46,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(ASImageGui -writeEmptyRootPCM LIBRARIES libAfterImage + ROOTclib # strlcpy.h DEPENDENCIES Gui ASImage diff --git a/graf2d/fitsio/CMakeLists.txt b/graf2d/fitsio/CMakeLists.txt index f6cc474ae1902..3b6ca96c8a1af 100644 --- a/graf2d/fitsio/CMakeLists.txt +++ b/graf2d/fitsio/CMakeLists.txt @@ -18,6 +18,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(FITSIO -writeEmptyRootPCM LIBRARIES CFITSIO::CFITSIO + ROOTclib # strlcpy.h DEPENDENCIES Gpad Graf diff --git a/graf2d/gpad/CMakeLists.txt b/graf2d/gpad/CMakeLists.txt index a67b5e0f2af50..13c9b332fe2c2 100644 --- a/graf2d/gpad/CMakeLists.txt +++ b/graf2d/gpad/CMakeLists.txt @@ -61,6 +61,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Gpad DEPENDENCIES Graf Hist + LIBRARIES + ROOTclib # strlcpy.h ) ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/graf2d/graf/CMakeLists.txt b/graf2d/graf/CMakeLists.txt index 38a956aeaea20..70a5c0ae00b2f 100644 --- a/graf2d/graf/CMakeLists.txt +++ b/graf2d/graf/CMakeLists.txt @@ -93,6 +93,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Graf Freetype::Freetype ZLIB::ZLIB mathtext::mathtext + ROOTclib # strlcpy.h DEPENDENCIES Hist Matrix diff --git a/graf2d/postscript/CMakeLists.txt b/graf2d/postscript/CMakeLists.txt index 07689de5bea84..aff2d35b5fa57 100644 --- a/graf2d/postscript/CMakeLists.txt +++ b/graf2d/postscript/CMakeLists.txt @@ -27,6 +27,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Postscript LIBRARIES ZLIB::ZLIB mathtext::mathtext + ROOTclib # strlcpy.h DEPENDENCIES Graf ) diff --git a/graf2d/x11/CMakeLists.txt b/graf2d/x11/CMakeLists.txt index 70838e1fa3ba2..3dfd73357e39d 100644 --- a/graf2d/x11/CMakeLists.txt +++ b/graf2d/x11/CMakeLists.txt @@ -24,6 +24,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(GX11 ${X11_Xpm_LIB} ${CMAKE_THREAD_LIBS_INIT} xvertext + ROOTclib # strlcpy.h DEPENDENCIES Core MathCore diff --git a/graf3d/g3d/CMakeLists.txt b/graf3d/g3d/CMakeLists.txt index 6a9802b5f7734..4c3640f1d3734 100644 --- a/graf3d/g3d/CMakeLists.txt +++ b/graf3d/g3d/CMakeLists.txt @@ -33,4 +33,5 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Graf3d MathCore LIBRARIES ROOTX3dViewer + ROOTclib # strlcpy.h ) diff --git a/gui/fitpanel/CMakeLists.txt b/gui/fitpanel/CMakeLists.txt index 9000277978071..897302661e30d 100644 --- a/gui/fitpanel/CMakeLists.txt +++ b/gui/fitpanel/CMakeLists.txt @@ -29,6 +29,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(FitPanel MathCore Tree TreePlayer + LIBRARIES + ROOTclib # strlcpy.h ) ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/gui/gui/CMakeLists.txt b/gui/gui/CMakeLists.txt index b25f7c0ddbf8a..30b75d1246ec3 100644 --- a/gui/gui/CMakeLists.txt +++ b/gui/gui/CMakeLists.txt @@ -205,6 +205,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Gui Graf MathCore ROOTNTupleBrowse + LIBRARIES + ROOTclib # strlcpy.h ) target_include_directories(Gui PRIVATE ${CMAKE_SOURCE_DIR}/gui/ged/inc) diff --git a/gui/guibuilder/CMakeLists.txt b/gui/guibuilder/CMakeLists.txt index d468d540881bc..222dfbaea792d 100644 --- a/gui/guibuilder/CMakeLists.txt +++ b/gui/guibuilder/CMakeLists.txt @@ -29,4 +29,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(GuiBld Gui Graf MathCore + LIBRARIES + ROOTclib # strlcpy.h ) diff --git a/gui/guihtml/CMakeLists.txt b/gui/guihtml/CMakeLists.txt index b010bb6d8f668..206bdf560d7d2 100644 --- a/gui/guihtml/CMakeLists.txt +++ b/gui/guihtml/CMakeLists.txt @@ -29,4 +29,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(GuiHtml DEPENDENCIES Gui Graf + LIBRARIES + ROOTclib # strlcpy.h ) diff --git a/hist/hbook/CMakeLists.txt b/hist/hbook/CMakeLists.txt index c276a441018d1..15adaf2a079e8 100644 --- a/hist/hbook/CMakeLists.txt +++ b/hist/hbook/CMakeLists.txt @@ -23,6 +23,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Hbook -writeEmptyRootPCM LIBRARIES minicern + ROOTclib # strlcpy.h DEPENDENCIES Hist Tree diff --git a/hist/hist/CMakeLists.txt b/hist/hist/CMakeLists.txt index d3b4610c72342..ebeccbd5938ee 100644 --- a/hist/hist/CMakeLists.txt +++ b/hist/hist/CMakeLists.txt @@ -171,6 +171,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Hist MathCore Matrix RIO + LIBRARIES + ROOTclib # strlcpy.h ) ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/hist/histpainter/CMakeLists.txt b/hist/histpainter/CMakeLists.txt index 30a6718bc2acc..0a5bcd350e6cf 100644 --- a/hist/histpainter/CMakeLists.txt +++ b/hist/histpainter/CMakeLists.txt @@ -31,4 +31,5 @@ ROOT_STANDARD_LIBRARY_PACKAGE(HistPainter MathCore LIBRARIES Matrix + ROOTclib # strlcpy.h ) diff --git a/hist/spectrumpainter/CMakeLists.txt b/hist/spectrumpainter/CMakeLists.txt index 6d08e1b4be0d0..3016300cc6c57 100644 --- a/hist/spectrumpainter/CMakeLists.txt +++ b/hist/spectrumpainter/CMakeLists.txt @@ -19,4 +19,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(SpectrumPainter Graf Hist Gpad + LIBRARIES + ROOTclib # strlcpy.h ) diff --git a/io/io/CMakeLists.txt b/io/io/CMakeLists.txt index d14937b2e6284..a6435ef80a551 100644 --- a/io/io/CMakeLists.txt +++ b/io/io/CMakeLists.txt @@ -62,11 +62,12 @@ ROOT_LINKER_LIBRARY(RIO LIBRARIES ${CMAKE_DL_LIBS} Thread + ROOTclib # strlcpy.h DEPENDENCIES Core ) -target_include_directories(RIO PRIVATE ${CMAKE_SOURCE_DIR}/core/clib/res) +target_link_libraries(RIO PRIVATE ROOTclib) # PUBLIC so that dependent libraries e.g. ROOTDataFrame may find the internal header too target_include_directories(RIO PUBLIC $) target_link_libraries(RIO PUBLIC ${ROOT_ATOMIC_LIBS}) diff --git a/io/rootpcm/CMakeLists.txt b/io/rootpcm/CMakeLists.txt index c5f6a4351dd33..621d5eb7f8b08 100644 --- a/io/rootpcm/CMakeLists.txt +++ b/io/rootpcm/CMakeLists.txt @@ -14,3 +14,4 @@ target_include_directories(RootPcmObjs PRIVATE ${CMAKE_SOURCE_DIR}/io/io/inc ${CMAKE_SOURCE_DIR}/core/zip/inc ) +target_link_libraries(RootPcmObjs PRIVATE ROOTclib) # strtok.h diff --git a/io/sql/CMakeLists.txt b/io/sql/CMakeLists.txt index 298cfc9ae2b7f..ed25031ada29e 100644 --- a/io/sql/CMakeLists.txt +++ b/io/sql/CMakeLists.txt @@ -23,4 +23,4 @@ ROOT_STANDARD_LIBRARY_PACKAGE(SQLIO src/TSQLFile.cxx src/TSQLObjectData.cxx src/TSQLStructure.cxx - DEPENDENCIES Net RIO) + DEPENDENCIES Net RIO LIBRARIES ROOTclib) diff --git a/io/xml/CMakeLists.txt b/io/xml/CMakeLists.txt index d6eb5619f5ca1..6eb89b76d587e 100644 --- a/io/xml/CMakeLists.txt +++ b/io/xml/CMakeLists.txt @@ -23,4 +23,5 @@ ROOT_STANDARD_LIBRARY_PACKAGE(XMLIO src/TXMLFile.cxx src/TXMLPlayer.cxx src/TXMLSetup.cxx - DEPENDENCIES RIO) + DEPENDENCIES RIO + LIBRARIES ROOTclib) diff --git a/io/xmlparser/CMakeLists.txt b/io/xmlparser/CMakeLists.txt index ad7893da95768..8f44bcd40ae98 100644 --- a/io/xmlparser/CMakeLists.txt +++ b/io/xmlparser/CMakeLists.txt @@ -38,4 +38,5 @@ target_link_libraries(XMLParser PRIVATE ${LIBXML2_LIBRARIES} $<$:ws2_32.lib> + ROOTclib ) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 8df316efca455..1e39eb0c9946c 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -54,7 +54,7 @@ generateHeader(hadd if(fortran AND CMAKE_Fortran_COMPILER) ROOT_EXECUTABLE(g2root g2root.f LIBRARIES minicern CMAKENOEXPORT) set_target_properties(g2root PROPERTIES COMPILE_FLAGS "-w") - ROOT_EXECUTABLE(h2root h2root.cxx LIBRARIES Core RIO Net Hist Graf Graf3d Gpad Tree Matrix MathCore Thread minicern CMAKENOEXPORT) + ROOT_EXECUTABLE(h2root h2root.cxx LIBRARIES Core RIO Net Hist Graf Graf3d Gpad Tree Matrix MathCore Thread minicern ROOTclib CMAKENOEXPORT) # This is needed in particular for macOS, where the path of the GNU Fortran # library might not be in the default DYLD_LIBRARY_PATH, but it gets picked diff --git a/main/src/rmain.cxx b/main/src/rmain.cxx index 3e0e0fe5c2dea..9f2698995fe77 100644 --- a/main/src/rmain.cxx +++ b/main/src/rmain.cxx @@ -19,8 +19,6 @@ #include "TRint.h" #include "RConfigure.h" - -#include #ifdef _MSC_VER #include #define execv _execv diff --git a/math/matrix/src/TMatrixTBase.cxx b/math/matrix/src/TMatrixTBase.cxx index b3cd7b59b0651..9a4b67c311e33 100644 --- a/math/matrix/src/TMatrixTBase.cxx +++ b/math/matrix/src/TMatrixTBase.cxx @@ -27,8 +27,6 @@ of the derived classes #include "TBuffer.h" #include "TROOT.h" #include "TMath.h" - -#include #include Int_t gMatrixCheck = 1; diff --git a/math/minuit/CMakeLists.txt b/math/minuit/CMakeLists.txt index a4ec58f6c1390..a71d9d9c247c3 100644 --- a/math/minuit/CMakeLists.txt +++ b/math/minuit/CMakeLists.txt @@ -26,6 +26,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Minuit Hist Matrix MathCore + LIBRARIES + ROOTclib # strlcpy.h DICTIONARY_OPTIONS -writeEmptyRootPCM ) diff --git a/montecarlo/eg/CMakeLists.txt b/montecarlo/eg/CMakeLists.txt index f7854638d40e5..1aea8865782e1 100644 --- a/montecarlo/eg/CMakeLists.txt +++ b/montecarlo/eg/CMakeLists.txt @@ -39,6 +39,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(EG Physics LIBRARIES ROOTX3dViewer + ROOTclib # strlcpy.h ) ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/net/net/CMakeLists.txt b/net/net/CMakeLists.txt index 697a18ce59686..b9d7a9e9f877a 100644 --- a/net/net/CMakeLists.txt +++ b/net/net/CMakeLists.txt @@ -69,5 +69,6 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Net RIO LIBRARIES ${ROOT_ATOMIC_LIBS} + ROOTclib ) ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/roofit/roofit/CMakeLists.txt b/roofit/roofit/CMakeLists.txt index 9df36a28f25aa..04556c5f12e6c 100644 --- a/roofit/roofit/CMakeLists.txt +++ b/roofit/roofit/CMakeLists.txt @@ -163,6 +163,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFit RIO Matrix MathCore + LIBRARIES + ROOTclib # strlcpy.h ${EXTRA_DICT_OPTS} ) diff --git a/roofit/roofitcore/CMakeLists.txt b/roofit/roofitcore/CMakeLists.txt index 4e2fe10fcd4b5..9a2935a4bd6d9 100644 --- a/roofit/roofitcore/CMakeLists.txt +++ b/roofit/roofitcore/CMakeLists.txt @@ -470,6 +470,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore "-writeEmptyRootPCM" LIBRARIES ${EXTRA_LIBRARIES} + ROOTclib # strlcpy.h DEPENDENCIES Core Hist diff --git a/rootx/CMakeLists.txt b/rootx/CMakeLists.txt index 5e28edf0d5903..8068051c011fd 100644 --- a/rootx/CMakeLists.txt +++ b/rootx/CMakeLists.txt @@ -19,7 +19,7 @@ target_include_directories(root PRIVATE ${CMAKE_SOURCE_DIR}/core/foundation/inc ${CMAKE_SOURCE_DIR}/core/base/inc ${CMAKE_SOURCE_DIR}/core/base/res - ${CMAKE_SOURCE_DIR}/core/clib/inc # for strtok.h ${CMAKE_SOURCE_DIR}/core/meta/inc # for TGenericClassInfo.h ${CMAKE_BINARY_DIR}/ginclude # for RConfigure.h and rootCommandLineOptionsHelp.h ) +target_link_libraries(root PRIVATE ROOTclib) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2eebde410858f..03fd6c90438c8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -313,7 +313,7 @@ ROOT_EXECUTABLE(testbits testbits.cxx LIBRARIES Core) ROOT_ADD_TEST(test-testbits COMMAND testbits) #--ctorture---------------------------------------------------------------------------------- -ROOT_EXECUTABLE(ctorture ctorture.cxx LIBRARIES MathCore) +ROOT_EXECUTABLE(ctorture ctorture.cxx LIBRARIES MathCore ROOTclib) ROOT_ADD_TEST(test-ctorture COMMAND ctorture) #--qprandom---------------------------------------------------------------------------------- diff --git a/tmva/tmva/CMakeLists.txt b/tmva/tmva/CMakeLists.txt index d36b33341a15e..45754afce9768 100644 --- a/tmva/tmva/CMakeLists.txt +++ b/tmva/tmva/CMakeLists.txt @@ -393,6 +393,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(TMVA RIO XMLIO ${TMVA_EXTRA_DEPENDENCIES} + LIBRARIES + ROOTclib # strlcpy.h DICTIONARY_OPTIONS -writeEmptyRootPCM INSTALL_OPTIONS diff --git a/tree/tree/CMakeLists.txt b/tree/tree/CMakeLists.txt index 9efa075d0a137..c2527a196045f 100644 --- a/tree/tree/CMakeLists.txt +++ b/tree/tree/CMakeLists.txt @@ -131,6 +131,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Tree ${TREE_EXTRA_LIBRARIES} Thread MathCore + ROOTclib # strlcpy.h ) ROOT_ADD_TEST_SUBDIRECTORY(test) diff --git a/tree/tree/src/TEventList.cxx b/tree/tree/src/TEventList.cxx index 1fcffdab9c712..ff7f53fdfe26f 100644 --- a/tree/tree/src/TEventList.cxx +++ b/tree/tree/src/TEventList.cxx @@ -46,7 +46,6 @@ the TEventList object created in the above commands: - A TEventList object can be saved on a file via the Write function. */ -#include "strlcpy.h" #include "TEventList.h" #include "TBuffer.h" #include "TCut.h" @@ -54,7 +53,7 @@ the TEventList object created in the above commands: #include "TCollection.h" #include "TMathBase.h" #include "TROOT.h" - +#include "strlcpy.h" #include //////////////////////////////////////////////////////////////////////////////// diff --git a/tree/treeplayer/CMakeLists.txt b/tree/treeplayer/CMakeLists.txt index 60934eae1f91c..1d7993e2d53dc 100644 --- a/tree/treeplayer/CMakeLists.txt +++ b/tree/treeplayer/CMakeLists.txt @@ -103,6 +103,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(TreePlayer MathCore RIO Tree + LIBRARIES + ROOTclib # strlcpy.h ${EXTRA_DICT_OPTS} ) diff --git a/tree/treeviewer/CMakeLists.txt b/tree/treeviewer/CMakeLists.txt index 1c5cc6585dded..2b22a99f3801a 100644 --- a/tree/treeviewer/CMakeLists.txt +++ b/tree/treeviewer/CMakeLists.txt @@ -40,6 +40,8 @@ ROOT_STANDARD_LIBRARY_PACKAGE(TreeViewer Ged Gui TreePlayer + LIBRARIES + ROOTclib # strlcpy.h ) if(ROOT_NEED_STDCXXFS) target_link_libraries(TreeViewer PUBLIC stdc++fs)