[mapguide-commits] r9963 - in sandbox/jng/vanilla_swig: . Oem/DWFTK/develop/global/src Oem/DWFTK/develop/global/src/dwfcore Oem/DWFTK/develop/global/src/dwfcore/x64 Oem/agg-2.4/include Oem/dbxml/db-4.8.26/dbinc Oem/dbxml/db-4.8.26/mutex cmake/modules

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Aug 26 13:50:48 PDT 2022


Author: jng
Date: 2022-08-26 13:50:46 -0700 (Fri, 26 Aug 2022)
New Revision: 9963

Added:
   sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/atomic.h
   sandbox/jng/vanilla_swig/cmake/modules/FindUUID.cmake
Modified:
   sandbox/jng/vanilla_swig/CMakeLists.txt
   sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/CMakeLists.txt
   sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt
   sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/Core.cpp
   sandbox/jng/vanilla_swig/Oem/agg-2.4/include/agg_renderer_outline_aa.h
   sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/dbinc/atomic.h
   sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/mutex/mut_tas.c
   sandbox/jng/vanilla_swig/cmake_bootstrap.sh
   sandbox/jng/vanilla_swig/cmake_linuxapt.sh
Log:
Start fixing up the Linux build:
 - Don't add_subdirectory the BuildTools directory. This caused a double-definition of the IMake target. The one in BuildTools is the older one which will be removed soon.
 - Add local atomic.h to DWFTK. This is a file we previously externally overlaid into /usr/include in our build VM images or docker build containers, so it was trusted to exist. When building on bare-metal Ubuntu this isn't the case.
 - Use cmake packages to find pthread and uuid for DWFTK instead of find_library
 - Fix berkeley db build. 
   - Rename "__atomic_compare_exchange" to "__atomic_compare_exchange_db" to prevent collision with a built-in of the same name
   - The previous fixes to get this compiling for MSVC 2019 on Windows was incomplete for Linux as there was still several cases of "atomic_init" that didn't get renamed to "bdb_atomic_init"
 - Fix up SWIG acquision code to not wget the master archive if it already exists in destination
 - Remove non-const profile() method from agg_renderer_outline_aa
 - Update various version numbers of LinuxApt tarballs in cmake_linuxapt.sh
 - Update php ./configure arguments for PHP 8.1

Modified: sandbox/jng/vanilla_swig/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/CMakeLists.txt	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
@@ -253,9 +253,6 @@
     set (NEED_LIBRT 1)
 endif (NOT HAVE_CLOCK_GETTIME)
 
-if (NOT MG_COMMON_SUBSET_ONLY)
-    add_subdirectory(BuildTools)
-endif (NOT MG_COMMON_SUBSET_ONLY)
 add_subdirectory(Oem)
 add_subdirectory(Common)
 if (NOT MG_COMMON_SUBSET_ONLY)

Modified: sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/CMakeLists.txt	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
@@ -2,8 +2,8 @@
 
 add_definitions(-DDWFCORE_BUILD_ZLIB -DDWFCORE_BUILD_EXPAT)
 
-find_library(pthread REQUIRED)
-find_library(uuid REQUIRED)
+find_package(Threads REQUIRED)
+find_package(UUID REQUIRED)
 check_cxx_source_compiles(
     "#include <uuid/uuid.h>
     int main() {

Modified: sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt
===================================================================
--- sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/CMakeLists.txt	2022-08-26 20:50:46 UTC (rev 9963)
@@ -107,19 +107,19 @@
 
 add_library(dwfcore-${DWFCORE_VERSION} SHARED ${dwfcore_SRCS})
 
-if (HAS_UUID AND NOT uuid-NOTFOUND)
+if (UUID_FOUND)
     target_link_libraries(dwfcore-${DWFCORE_VERSION}
         -Wl,-Bsymbolic
         dl
-        pthread
-        uuid
+        ${CMAKE_THREAD_LIBS_INIT}
+        ${UUID_LIBRARY}
     )
-else (HAS_UUID AND NOT uuid-NOTFOUND)
+else (UUID_FOUND)
     target_link_libraries(dwfcore-${DWFCORE_VERSION}
         -Wl,-Bsymbolic
         dl
-        pthread
+        ${CMAKE_THREAD_LIBS_INIT}
     )
-endif (HAS_UUID AND NOT uuid-NOTFOUND)
+endif (UUID_FOUND)
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/Core.cpp
===================================================================
--- sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/Core.cpp	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/Core.cpp	2022-08-26 20:50:46 UTC (rev 9963)
@@ -66,7 +66,7 @@
 				#elif   defined( HAVE_ALSA_IATOMIC_H )
 				#include <alsa/iatomic.h>
 				#else
-				#error  Missing atomic header file containing definition of atomic_t - cannot continue
+				#include "atomic.h"
 				#endif
 
 

Added: sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/atomic.h
===================================================================
--- sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/atomic.h	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Oem/DWFTK/develop/global/src/dwfcore/x64/atomic.h	2022-08-26 20:50:46 UTC (rev 9963)
@@ -0,0 +1,127 @@
+#ifndef _ATOMIC_H
+#define _ATOMIC_H
+
+/**
+ * Atomic type.
+ */
+typedef struct {
+    volatile int counter;
+} atomic_t;
+
+#define ATOMIC_INIT(i)  { (i) }
+
+/**
+ * Read atomic variable
+ * @param v pointer of type atomic_t
+ *
+ * Atomically reads the value of @v.
+ */
+#define atomic_read(v) ((v)->counter)
+
+/**
+ * Set atomic variable
+ * @param v pointer of type atomic_t
+ * @param i required value
+ */
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+/**
+ * Add to the atomic variable
+ * @param i integer value to add
+ * @param v pointer of type atomic_t
+ */
+static inline void atomic_add( int i, atomic_t *v )
+{
+         (void)__sync_add_and_fetch(&v->counter, i);
+}
+
+/**
+ * Subtract the atomic variable
+ * @param i integer value to subtract
+ * @param v pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v.
+ */
+static inline void atomic_sub( int i, atomic_t *v )
+{
+        (void)__sync_sub_and_fetch(&v->counter, i);
+}
+
+/**
+ * Subtract value from variable and test result
+ * @param i integer value to subtract
+ * @param v pointer of type atomic_t
+ *
+ * Atomically subtracts @i from @v and returns
+ * true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic_sub_and_test( int i, atomic_t *v )
+{
+        return !(__sync_sub_and_fetch(&v->counter, i));
+}
+
+/**
+ * Increment atomic variable
+ * @param v pointer of type atomic_t
+ *
+ * Atomically increments @v by 1.
+ */
+static inline void atomic_inc( atomic_t *v )
+{
+       (void)__sync_fetch_and_add(&v->counter, 1);
+}
+
+/**
+ * @brief decrement atomic variable
+ * @param v: pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1.  Note that the guaranteed
+ * useful range of an atomic_t is only 24 bits.
+ */
+static inline void atomic_dec( atomic_t *v )
+{
+       (void)__sync_fetch_and_sub(&v->counter, 1);
+}
+
+/**
+ * @brief Decrement and test
+ * @param v pointer of type atomic_t
+ *
+ * Atomically decrements @v by 1 and
+ * returns true if the result is 0, or false for all other
+ * cases.
+ */
+static inline int atomic_dec_and_test( atomic_t *v )
+{
+       return !(__sync_sub_and_fetch(&v->counter, 1));
+}
+
+/**
+ * @brief Increment and test
+ * @param v pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+static inline int atomic_inc_and_test( atomic_t *v )
+{
+      return !(__sync_add_and_fetch(&v->counter, 1));
+}
+
+/**
+ * @brief add and test if negative
+ * @param v pointer of type atomic_t
+ * @param i integer value to add
+ *
+ * Atomically adds @i to @v and returns true
+ * if the result is negative, or false when
+ * result is greater than or equal to zero.
+ */
+static inline int atomic_add_negative( int i, atomic_t *v )
+{
+       return (__sync_add_and_fetch(&v->counter, i) < 0);
+}
+
+#endif

Modified: sandbox/jng/vanilla_swig/Oem/agg-2.4/include/agg_renderer_outline_aa.h
===================================================================
--- sandbox/jng/vanilla_swig/Oem/agg-2.4/include/agg_renderer_outline_aa.h	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/Oem/agg-2.4/include/agg_renderer_outline_aa.h	2022-08-26 20:50:46 UTC (rev 9963)
@@ -1365,7 +1365,6 @@
         //---------------------------------------------------------------------
         void profile(const line_profile_aa& prof) { m_profile = &prof; }
         const line_profile_aa& profile() const { return *m_profile; }
-        line_profile_aa& profile() { return *m_profile; }
 
         //---------------------------------------------------------------------
         int subpixel_width() const { return m_profile->subpixel_width(); }

Modified: sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/dbinc/atomic.h
===================================================================
--- sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/dbinc/atomic.h	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/dbinc/atomic.h	2022-08-26 20:50:46 UTC (rev 9963)
@@ -144,7 +144,7 @@
 #define	atomic_inc(env, p)	__atomic_inc(p)
 #define	atomic_dec(env, p)	__atomic_dec(p)
 #define	atomic_compare_exchange(env, p, o, n)	\
-	__atomic_compare_exchange((p), (o), (n))
+	__atomic_compare_exchange_db((p), (o), (n))
 static inline int __atomic_inc(db_atomic_t *p)
 {
 	int	temp;
@@ -176,7 +176,7 @@
  * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
  * which configure could be changed to use.
  */
-static inline int __atomic_compare_exchange(
+static inline int __atomic_compare_exchange_db(
 	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
 {
 	atomic_value_t was;
@@ -206,7 +206,7 @@
 #define	atomic_dec(env, p)	(--(p)->value)
 #define	atomic_compare_exchange(env, p, oldval, newval)		\
 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
-	atomic_init(p, (newval)), 1)
+	bdb_atomic_init(p, (newval)), 1)
 #else
 #define atomic_inc(env, p)	__atomic_inc(env, p)
 #define atomic_dec(env, p)	__atomic_dec(env, p)

Modified: sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/mutex/mut_tas.c
===================================================================
--- sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/mutex/mut_tas.c	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/Oem/dbxml/db-4.8.26/mutex/mut_tas.c	2022-08-26 20:50:46 UTC (rev 9963)
@@ -46,7 +46,7 @@
 
 #ifdef HAVE_SHARED_LATCHES
 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
-		atomic_init(&mutexp->sharecount, 0);
+		bdb_atomic_init(&mutexp->sharecount, 0);
 	else
 #endif
 	if (MUTEX_INIT(&mutexp->tas)) {
@@ -486,7 +486,7 @@
 			F_CLR(mutexp, DB_MUTEX_LOCKED);
 			/* Flush flag update before zeroing count */
 			MEMBAR_EXIT();
-			atomic_init(&mutexp->sharecount, 0);
+			bdb_atomic_init(&mutexp->sharecount, 0);
 		} else {
 			DB_ASSERT(env, sharecount > 0);
 			MEMBAR_EXIT();

Added: sandbox/jng/vanilla_swig/cmake/modules/FindUUID.cmake
===================================================================
--- sandbox/jng/vanilla_swig/cmake/modules/FindUUID.cmake	                        (rev 0)
+++ sandbox/jng/vanilla_swig/cmake/modules/FindUUID.cmake	2022-08-26 20:50:46 UTC (rev 9963)
@@ -0,0 +1,71 @@
+# - Find UUID
+# Find the native UUID includes and library
+# This module defines
+#  UUID_INCLUDE_DIR, where to find jpeglib.h, etc.
+#  UUID_LIBRARIES, the libraries needed to use UUID.
+#  UUID_FOUND, If false, do not try to use UUID.
+# also defined, but not for general use are
+#  UUID_LIBRARY, where to find the UUID library.
+#
+#  Copyright (c) 2006-2011 Mathieu Malaterre <mathieu.malaterre at gmail.com>
+#
+#  Redistribution and use is allowed according to the terms of the New
+#  BSD license.
+#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+# On MacOSX we have:
+# $ nm -g /usr/lib/libSystem.dylib | grep uuid_generate
+# 000b3aeb T _uuid_generate
+# 0003e67e T _uuid_generate_random
+# 000b37a1 T _uuid_generate_time
+if(APPLE)
+  set(UUID_LIBRARY_VAR System)
+else()
+  # Linux type:
+  set(UUID_LIBRARY_VAR uuid)
+endif()
+
+find_library(UUID_LIBRARY
+  NAMES ${UUID_LIBRARY_VAR}
+  PATHS /lib /usr/lib /usr/local/lib
+  )
+
+# Must be *after* the lib itself
+set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
+set(CMAKE_FIND_FRAMEWORK NEVER)
+
+find_path(UUID_INCLUDE_DIR uuid/uuid.h
+/usr/local/include
+/usr/include
+)
+
+if (UUID_LIBRARY AND UUID_INCLUDE_DIR)
+  set(UUID_LIBRARIES ${UUID_LIBRARY})
+  set(UUID_FOUND "YES")
+else ()
+  set(UUID_FOUND "NO")
+endif ()
+
+
+if (UUID_FOUND)
+   if (NOT UUID_FIND_QUIETLY)
+      message(STATUS "Found UUID: ${UUID_LIBRARIES}")
+   endif ()
+else ()
+   if (UUID_FIND_REQUIRED)
+      message( "library: ${UUID_LIBRARY}" )
+      message( "include: ${UUID_INCLUDE_DIR}" )
+      message(FATAL_ERROR "Could not find UUID library")
+   endif ()
+endif ()
+
+# Deprecated declarations.
+#set (NATIVE_UUID_INCLUDE_PATH ${UUID_INCLUDE_DIR} )
+#get_filename_component (NATIVE_UUID_LIB_PATH ${UUID_LIBRARY} PATH)
+
+mark_as_advanced(
+  UUID_LIBRARY
+  UUID_INCLUDE_DIR
+  )
+set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
\ No newline at end of file

Modified: sandbox/jng/vanilla_swig/cmake_bootstrap.sh
===================================================================
--- sandbox/jng/vanilla_swig/cmake_bootstrap.sh	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/cmake_bootstrap.sh	2022-08-26 20:50:46 UTC (rev 9963)
@@ -148,9 +148,11 @@
 if [ "$have_swig" != "0" ]; then
     echo "SWIG not found. Acquiring and building SWIG from source"
     cd /tmp/ || exit
-    # TODO: Until SWIG 4.1 is actually released, should fix the source archive to a particular commit (if it's possible)
-    wget https://github.com/swig/swig/archive/refs/heads/master.zip
-    unzip master.zip
+    if [ ! -f /tmp/master.zip ]; then
+        # TODO: Until SWIG 4.1 is actually released, should fix the source archive to a particular commit (if it's possible)
+        wget https://github.com/swig/swig/archive/refs/heads/master.zip
+    fi
+    unzip -o master.zip
     cd /tmp/swig-master/ || exit
     ./autogen.sh && ./configure && make && make install
 else
@@ -369,7 +371,7 @@
 echo "Has DBXML Library: $HAS_DBXML_LIB"
 echo "Has XQilla Library: $HAS_XQILLA_LIB"
 
-if [ "$COMMON_SUBSET_ONLY" == "1" ]; then
+if [ "$COMMON_SUBSET_ONLY" = "1" ]; then
     cp -Rf "${SOURCE_DIR}/Oem/dbxml" "${OEM_WORK_DIR}/dbxml"
     cd "${OEM_WORK_DIR}/dbxml" || exit
     # The buildall.sh script supports a --build-one flag so we can only build xerces and skip everything else

Modified: sandbox/jng/vanilla_swig/cmake_linuxapt.sh
===================================================================
--- sandbox/jng/vanilla_swig/cmake_linuxapt.sh	2022-08-23 23:53:18 UTC (rev 9962)
+++ sandbox/jng/vanilla_swig/cmake_linuxapt.sh	2022-08-26 20:50:46 UTC (rev 9963)
@@ -119,10 +119,10 @@
     echo "Created LinuxApt working dir at: $LINUXAPT_WORK_DIR"
 fi
 
-PHP_VER=5.6.40
-HTTPD_VER=2.4.37
+PHP_VER=8.1.9
+HTTPD_VER=2.4.52
 TC_VER=1.2.48
-APR_VER=1.6.5
+APR_VER=1.7.0
 APR_UTIL_VER=1.6.1
 
 HTTPD_PORT=8008
@@ -204,7 +204,7 @@
     cd "${PHP_WORKDIR}" || exit
     # TODO: Patch out the use of meta_ccld so ccache can work: https://bugs.php.net/bug.php?id=75940
     # if/when we finally move to PHP 7, this patch is already applied
-    ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" --with-apxs2="${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs" --with-openssl --with-curl --enable-xml --enable-wddx --enable-shared --with-zlib-dir="$PHP_ZLIB_DIR" --enable-zip --enable-mbstring=all --with-xsl=/usr/lib --with-gd --with-png-dir="$PHP_PNG_DIR" --with-jpeg-dir="$PHP_JPEG_DIR" --with-freetype-dir="$PHP_FREETYPE_DIR" 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
+    ./configure --prefix="${MG_INSTALL_WEB_PREFIX}/php" --with-apxs2="${MG_INSTALL_WEB_PREFIX}/apache2/bin/apxs" --with-openssl --enable-mbstring --enable-gd --with-jpeg --with-png --with-libxml 2>&1 | tee "$LINUXAPT_WORK_DIR/configure_php.log"
     check_build
     echo "Building PHP. Please wait"
     make 2>&1 | tee "$LINUXAPT_WORK_DIR/make_php.log"



More information about the mapguide-commits mailing list