[mapguide-commits] r9473 - in trunk/MgDev: . Common Common/Renderers Server/src/Core

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Feb 3 09:04:47 PST 2019


Author: jng
Date: 2019-02-03 09:04:47 -0800 (Sun, 03 Feb 2019)
New Revision: 9473

Modified:
   trunk/MgDev/CMakeLists.txt
   trunk/MgDev/Common/CMakeLists.txt
   trunk/MgDev/Common/Renderers/CMakeLists.txt
   trunk/MgDev/Server/src/Core/CMakeLists.txt
   trunk/MgDev/cmake_bootstrap.sh
Log:
#2795: Get CMake build working with a fully built Oem tree
 - Add check for librt as on distros with an older libc (eg. CentOS 6.x) define clock_gettime() here instead of in libc. If librt is indeed required, set NEED_LIBRT=1 which is a hint to affected projects to link in librt
 - Rework cmake_bootstrap.sh to make install cppunit/libjpeg/libpng/freetype/zlib in the standard location (/usr/local) instead of trying to be smart and installing it to a local directory under the OEM build area.
   - This requires an additional potential freetype include path to be specified for Renderers and ServerCore

Modified: trunk/MgDev/CMakeLists.txt
===================================================================
--- trunk/MgDev/CMakeLists.txt	2019-02-03 10:27:04 UTC (rev 9472)
+++ trunk/MgDev/CMakeLists.txt	2019-02-03 17:04:47 UTC (rev 9473)
@@ -57,6 +57,7 @@
 include(CheckIncludeFile)
 include(CheckCXXSourceCompiles)
 include(CheckLibraryExists)
+include(CheckSymbolExists)
 include(ExternalProject)
 
 set(MG_VERSION_MAJOR 3)
@@ -217,6 +218,17 @@
     message(STATUS "Xerces does not appear to typedef XMLCh to char16_t")
 endif (XERCES_USES_CHAR16_T)
 
+set (NEED_LIBRT 0)
+CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
+if (NOT HAVE_CLOCK_GETTIME)
+    set(CMAKE_EXTRA_INCLUDE_FILES time.h)
+    CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
+    SET(CMAKE_EXTRA_INCLUDE_FILES)
+else (NOT HAVE_CLOCK_GETTIME)
+    message(STATUS "Found clock_gettime in librt")
+    set (NEED_LIBRT 1)
+endif (NOT HAVE_CLOCK_GETTIME)
+
 add_subdirectory(BuildTools)
 add_subdirectory(Oem)
 add_subdirectory(Common)

Modified: trunk/MgDev/Common/CMakeLists.txt
===================================================================
--- trunk/MgDev/Common/CMakeLists.txt	2019-02-03 10:27:04 UTC (rev 9472)
+++ trunk/MgDev/Common/CMakeLists.txt	2019-02-03 17:04:47 UTC (rev 9473)
@@ -1,6 +1,10 @@
 # NOTE: Not applied for server tier projects except for mgserver main executable
 if( CMAKE_COMPILER_IS_GNUCXX )
-    set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}")
+    if (NEED_LIBRT)
+        set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed -Wl,--no-undefined -lc -lrt ${CMAKE_SHARED_LINKER_FLAGS}")
+    else (NEED_LIBRT)
+        set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}")
+    endif (NEED_LIBRT)
 endif( CMAKE_COMPILER_IS_GNUCXX )
 
 # On ubuntu at least, the system installed ACE does not define this (required by us)

Modified: trunk/MgDev/Common/Renderers/CMakeLists.txt
===================================================================
--- trunk/MgDev/Common/Renderers/CMakeLists.txt	2019-02-03 10:27:04 UTC (rev 9472)
+++ trunk/MgDev/Common/Renderers/CMakeLists.txt	2019-02-03 17:04:47 UTC (rev 9473)
@@ -2,6 +2,7 @@
 
 include_directories(${GD_INCLUDE_DIR}
     ${FREETYPE_INCLUDE_DIRS}
+    ${FREETYPE_INCLUDE_DIRS}/freetype2
     ${PNG_INCLUDE_DIRS}
     ${FDO_INCLUDE_DIR}
     ${FDO_INCLUDE_DIR}/ExpressionEngine

Modified: trunk/MgDev/Server/src/Core/CMakeLists.txt
===================================================================
--- trunk/MgDev/Server/src/Core/CMakeLists.txt	2019-02-03 10:27:04 UTC (rev 9472)
+++ trunk/MgDev/Server/src/Core/CMakeLists.txt	2019-02-03 17:04:47 UTC (rev 9473)
@@ -6,6 +6,7 @@
     ${ACE_INCLUDE_DIR}
     ${XERCESC_INCLUDE_DIR}
     ${FREETYPE_INCLUDE_DIRS}
+    ${FREETYPE_INCLUDE_DIRS}/freetype2
     ${DBXML_INCLUDE_DIR}
     ${FDO_INCLUDE_DIR}
     ${FDO_INCLUDE_DIR}/ExpressionEngine
@@ -80,6 +81,10 @@
     MgRenderers${MG_VERSION_SUFFIX}
 )
 
+if (NEED_LIBRT)
+    target_link_libraries(mgserver rt)
+endif (NEED_LIBRT)
+
 ########### BEGIN Development/Testing environment setup #############
 file(GLOB_RECURSE UNIT_TEST_FILES "${MG_UNIT_TEST_DATA_DIR}/*.*")
 file(COPY ${UNIT_TEST_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../UnitTestFiles)

Modified: trunk/MgDev/cmake_bootstrap.sh
===================================================================
--- trunk/MgDev/cmake_bootstrap.sh	2019-02-03 10:27:04 UTC (rev 9472)
+++ trunk/MgDev/cmake_bootstrap.sh	2019-02-03 17:04:47 UTC (rev 9473)
@@ -148,9 +148,6 @@
     echo "Created OEM working dir at: $OEM_WORK_DIR"
 fi
 
-OEM_INSTALL_STAGE="${OEM_WORK_DIR}/install"
-mkdir -p "$OEM_INSTALL_STAGE"
-
 if [ "$INTERNAL_ACE" = "1" ]; then
     echo "Building ACE (internal)"
     cp -Rf "${SOURCE_DIR}/Oem/ACE" "${OEM_WORK_DIR}/ACE"
@@ -181,7 +178,7 @@
     autoconf
     automake --add-missing --copy --force-missing
     # -ldl is to prevent undefined reference to dlsym/dlopen/dlclose
-    sh ./configure --enable-silent-rules --prefix="${OEM_INSTALL_STAGE}/cppunit" LDFLAGS="-ldl"
+    sh ./configure --enable-silent-rules LDFLAGS="-ldl"
     make && make install
     check_build
 fi
@@ -193,9 +190,9 @@
     if [ "$USE_CCACHE" = "1" ]; then
         # Aliasing CC=ccache gcc breaks the gcc check in this configure script that
         # would've inserted the required -fPIC flag. So specify manually
-        CFLAGS="-O3 -fPIC" sh ./configure --prefix="${OEM_INSTALL_STAGE}/zlib"
+        CFLAGS="-O3 -fPIC" sh ./configure
     else
-        sh ./configure --prefix="${OEM_INSTALL_STAGE}/zlib"
+        sh ./configure
     fi
     make && make install
     check_build
@@ -204,18 +201,15 @@
     echo "Building libpng (internal)"
     cp -Rf "${SOURCE_DIR}/Oem/gd/lpng" "${OEM_WORK_DIR}/gd/lpng"
     cd "${OEM_WORK_DIR}/gd/lpng" || exit
-    # Need to ensure these directories exist first for our custom prefix to work
-    mkdir -p "${OEM_INSTALL_STAGE}/libpng"
-    mkdir -p "${OEM_INSTALL_STAGE}/libpng/usr/local"
     cp scripts/makefile.std makefile
     if [ $BUILD_CPU -eq 64 ]; then
         #Inject -fPIC to CFLAGS for 64-bit
         sed 's/^CFLAGS=/CFLAGS= -fPIC -m64 /g' makefile > makefile64
-        make -fmakefile64 DESTDIR="${OEM_INSTALL_STAGE}/libpng"
-        make -fmakefile64 DESTDIR="${OEM_INSTALL_STAGE}/libpng" install
+        make -fmakefile64
+        make -fmakefile64 install
         check_build
     else
-        make && make DESTDIR="${OEM_INSTALL_STAGE}/libpng" install
+        make && make install
         check_build
     fi
 fi
@@ -223,30 +217,26 @@
     echo "Building libjpeg (internal)"
     cp -Rf "${SOURCE_DIR}/Oem/gd/jpeg" "${OEM_WORK_DIR}/gd/jpeg"
     cd "${OEM_WORK_DIR}/gd/jpeg" || exit
-    # Need to ensure these directories exist first for our custom prefix to work
-    mkdir -p "${OEM_INSTALL_STAGE}/libjpeg/bin"
-    mkdir -p "${OEM_INSTALL_STAGE}/libjpeg/man/man1"
+    # This directory must exist in order for make install to work
+    mkdir -p /usr/local/man/man1
     # A jconfig.h that is not modifed by ./configure will trip up make, so nuke it first
     rm -f jconfig.h
     if [ $BUILD_CPU -eq 64 ]; then
-        sh ./configure --enable-static --disable-shared --prefix="${OEM_INSTALL_STAGE}/libjpeg"
+        sh ./configure --enable-static --disable-shared
         #--with-pic does nothing (probably ancient configure script), so do some sed trickery
         #to inject this flag. Know a better way? Enlighten us :)
         sed 's/^CFLAGS=/CFLAGS= -fPIC -m64 /g' Makefile > Makefile64
         make -fMakefile64
         check_build
-        make -fMakefile64 install
+        make -fMakefile64 install-lib
         check_build
     else
-        sh ./configure --enable-static --disable-shared --prefix="${OEM_INSTALL_STAGE}/libjpeg"
+        sh ./configure --enable-static --disable-shared
         make
         check_build
         make install
         check_build
     fi
-    # Make some symlinks so that PHP can work with this
-    ln -s "${OEM_WORK_DIR}/gd/jpeg" "${OEM_INSTALL_STAGE}/libjpeg/include"
-    ln -s "${OEM_WORK_DIR}/gd/jpeg/.libs" "${OEM_INSTALL_STAGE}/libjpeg/lib"
 fi
 if [ "$INTERNAL_FREETYPE" = "1" ]; then
     echo "Building freetype (internal)"
@@ -253,9 +243,9 @@
     cp -Rf "${SOURCE_DIR}/Oem/gd/freetype" "${OEM_WORK_DIR}/gd/freetype"
     cd "${OEM_WORK_DIR}/gd/freetype" || exit
     if [ $BUILD_CPU -eq 64 ]; then
-        sh ./configure --enable-static --disable-shared --with-pic --prefix="${OEM_INSTALL_STAGE}/freetype"
+        sh ./configure --enable-static --disable-shared --with-pic
     else
-    	sh ./configure --enable-static --disable-shared --prefix="${OEM_INSTALL_STAGE}/freetype"
+    	sh ./configure --enable-static --disable-shared
     fi
     make && make install
     check_build
@@ -284,15 +274,10 @@
     cp -Rf "${SOURCE_DIR}/Oem/gd/gd" "${OEM_WORK_DIR}/gd/gd"
     cd "${OEM_WORK_DIR}/gd/gd" || exit
     if [ $BUILD_CPU -eq 64 ]; then
-        echo "Running gd configure with: --enable-static --disable-shared --without-fontconfig --enable-silent-rules --with-jpeg=${PHP_JPEG_DIR} --with-png=${PHP_PNG_DIR} --with-freetype=${PHP_FREETYPE_DIR} --with-pic --prefix=${OEM_INSTALL_STAGE}/gd"
-        sh ./configure --enable-static --disable-shared --without-fontconfig --enable-silent-rules --with-jpeg="${PHP_JPEG_DIR}" --with-png="${PHP_PNG_DIR}" --with-freetype="${PHP_FREETYPE_DIR}" --with-pic --prefix="${OEM_INSTALL_STAGE}/gd"
+        sh ./configure --enable-static --disable-shared --without-fontconfig --with-jpeg=/usr/local --with-pic
     else
-        echo "Running gd configure with: --enable-static --disable-shared --without-fontconfig --enable-silent-rules --with-jpeg=${PHP_JPEG_DIR} --with-png=${PHP_PNG_DIR} --with-freetype=${PHP_FREETYPE_DIR} --prefix=${OEM_INSTALL_STAGE}/gd"
-        sh ./configure --enable-static --disable-shared --without-fontconfig --enable-silent-rules --with-jpeg="${PHP_JPEG_DIR}" --with-png="${PHP_PNG_DIR}" --with-freetype="${PHP_FREETYPE_DIR}" --prefix="${OEM_INSTALL_STAGE}/gd"
+        sh ./configure --enable-static --disable-shared --without-fontconfig --with-jpeg=/usr/local
     fi
-    #--with-png does not add the libpng include path to CPPFLAGS (???)
-    #So sed patch this path in
-    sed -i "s|^CPPFLAGS =|CPPFLAGS = -I$PHP_PNG_DIR/include/libpng |g" Makefile
     make && make install
     check_build
 fi



More information about the mapguide-commits mailing list