summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-12 20:39:26 +0800
committerErik Kundiman <erik@megapahit.org>2024-08-12 21:07:06 +0800
commitaa363ba3d396685fa1e2454a903656b4cc973bba (patch)
tree21a48bd7cdb0ce48a185196a416f6529c47a6aa1
parentbef1c20c4c8e3c081066478381056932a188faa6 (diff)
Automatic XMLRPC-EPI Mac download, build & install
When linking to the static archive on arm64, it would fail with an error of undefined iconv symbols. When linking to the dynamic library, the path was to the dynamic library was still assumed to still be in /usr/local/lib, so specifically for the executable target, this needs to be changed (temporarily) to the one in the prebuilt directory first, to later be changed again by fixup_bundle to the bundled one in Frameworks.
-rw-r--r--README.md26
-rw-r--r--indra/cmake/XmlRpcEpi.cmake82
-rw-r--r--indra/newview/CMakeLists.txt11
3 files changed, 81 insertions, 38 deletions
diff --git a/README.md b/README.md
index 481349cc07..72015925db 100644
--- a/README.md
+++ b/README.md
@@ -37,35 +37,13 @@ $ cd viewer
$ sudo port install cmake pkgconfig autoconf automake apr-util +universal boost +universal collada-dom +universal hunspell +universal freetype +universal jsoncpp +universal openjpeg +universal openssl11 +universal uriparser +universal libvorbis +universal xxhashlib
$ mkdir -p build/universal-apple-darwin`uname -r`/packages
$ cd ~/Downloads
-$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-darwin64-513145c.tar.zst -OL https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/115452/994130/nanosvg-2022.09.27-darwin64-580364.tar.bz2 -OL https://github.com/secondlife/3p-libndofdev/releases/download/v0.1.8e9edc7/libndofdev-0.1.8e9edc7-darwin64-8e9edc7.tar.zst -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-darwin64-de53f55.tar.zst -OL https://sourceforge.net/projects/xmlrpc-epi/files/xmlrpc-epi-base/0.54.2/xmlrpc-epi-0.54.2.tar.bz2
+$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-darwin64-513145c.tar.zst -OL https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/115452/994130/nanosvg-2022.09.27-darwin64-580364.tar.bz2 -OL https://github.com/secondlife/3p-libndofdev/releases/download/v0.1.8e9edc7/libndofdev-0.1.8e9edc7-darwin64-8e9edc7.tar.zst -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-darwin64-de53f55.tar.zst
$ cd -
$ cd ..
-$ tar xf ~/Downloads/xmlrpc-epi-0.54.2.tar.bz2
$ git clone https://github.com/secondlife/3p-openssl
$ git clone https://github.com/secondlife/3p-curl
$ git clone https://github.com/secondlife/3p-libndofdev
-$ cd xmlrpc-epi-0.54.2
-$ export CPPFLAGS="$CPPFLAGS -I$PWD/src"
-$ rm -f config.sub missing
-$ autoreconf -is
-$ mkdir -p build/x86_64-apple-darwin`uname -r`
-$ cd build/x86_64-apple-darwin`uname -r`
-$ export CFLAGS="-arch x86_64 -mmacosx-version-min=10.5"
-$ ../../configure --host=x86_64-apple-darwin`uname -r`
-$ make -j`sysctl -n hw.ncpu`
-$ sudo make install
-$ cd -
-$ sed -i '' -e 's/XMLRPC_VALUE find_named_value/__attribute__((always_inline)) XMLRPC_VALUE find_named_value/g' src/xmlrpc_introspection.c
-$ sed -i '' -e 's/void describe_method/__attribute__((always_inline)) void describe_method/g' src/xmlrpc_introspection.c
-$ mkdir -p build/aarch64-apple-darwin`uname -r`
-$ cd build/aarch64-apple-darwin`uname -r`
-$ export CFLAGS="-arch arm64 -mmacosx-version-min=11.0"
-$ ../../configure --host=aarch64-apple-darwin`uname -r`
-$ make -j`sysctl -n hw.ncpu`
-$ sudo lipo src/.libs/libxmlrpc-epi.a /usr/local/lib/libxmlrpc-epi.a -create -output /usr/local/lib/libxmlrpc-epi.a
-$ sudo lipo src/.libs/libxmlrpc-epi.0.dylib /usr/local/lib/libxmlrpc-epi.0.dylib -create -output /usr/local/lib/libxmlrpc-epi.0.dylib
-$ unset CPPFLAGS CFLAGS
-$ cd ../../../3p-openssl/openssl
+$ cd 3p-openssl/openssl
$ mkdir -p build/aarch64-apple-darwin`uname -r`
$ cd build/aarch64-apple-darwin`uname -r`
$ ../../Configure no-shared darwin64-arm64-cc
diff --git a/indra/cmake/XmlRpcEpi.cmake b/indra/cmake/XmlRpcEpi.cmake
index 994df3d128..91cc30537f 100644
--- a/indra/cmake/XmlRpcEpi.cmake
+++ b/indra/cmake/XmlRpcEpi.cmake
@@ -4,20 +4,82 @@ include(Prebuilt)
include_guard()
add_library( ll::xmlrpc-epi INTERFACE IMPORTED )
-if (USE_AUTOBUILD_3P OR USE_CONAN)
+if (NOT USESYSTEMLIBS)
use_system_binary( xmlrpc-epi )
use_prebuilt_binary(xmlrpc-epi)
-endif ()
-
+elseif (DARWIN AND (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/xmlrpc-epi_installed OR NOT ${xmlrpc-epi_installed} EQUAL 0))
+ file(DOWNLOAD
+ https://sourceforge.net/projects/xmlrpc-epi/files/xmlrpc-epi-base/0.54.2/xmlrpc-epi-0.54.2.tar.bz2
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2.tar.bz2
+ )
+ file(ARCHIVE_EXTRACT
+ INPUT ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2.tar.bz2
+ DESTINATION ${CMAKE_BINARY_DIR}
+ )
+ file(MAKE_DIRECTORY ${AUTOBUILD_INSTALL_DIR}/include/xmlrpc-epi)
+ file(COPY
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/base64.h
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/encodings.h
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/queue.h
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/simplestring.h
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/xml_element.h
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/xml_to_xmlrpc.h
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/xmlrpc.h
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/xmlrpc_introspection.h
+ DESTINATION ${LIBS_PREBUILT_DIR}/include/xmlrpc-epi
+ )
+ file(REMOVE
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/config.sub
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/missing
+ )
+ execute_process(
+ COMMAND autoreconf -is
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2
+ )
+ set(ENV{CPPFLAGS} -I${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src)
+ set(ENV{CFLAGS} "-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.15")
+ if (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ execute_process(
+ COMMAND sed -i '' -e "s/XMLRPC_VALUE find_named_value/__attribute__((always_inline)) XMLRPC_VALUE find_named_value/g"
+ xmlrpc_introspection.c
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src
+ )
+ execute_process(
+ COMMAND sed -i '' -e "s/void describe_method/__attribute__((always_inline)) void describe_method/g"
+ xmlrpc_introspection.c
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src
+ )
+ execute_process(
+ COMMAND ./configure --host=aarch64-apple-darwin
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2
+ )
+ else (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ execute_process(
+ COMMAND ./configure --host=${CMAKE_OSX_ARCHITECTURES}-apple-darwin
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2
+ )
+ endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64)
+ execute_process(
+ COMMAND make -j${MAKE_JOBS}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2
+ RESULT_VARIABLE xmlrpc-epi_installed
+ )
+ unset(ENV{CPPFLAGS})
+ unset(ENV{CFLAGS})
+ file(COPY
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/.libs/libxmlrpc-epi.dylib
+ ${CMAKE_BINARY_DIR}/xmlrpc-epi-0.54.2/src/.libs/libxmlrpc-epi.0.dylib
+ DESTINATION ${LIBS_PREBUILT_DIR}/lib/release
+ FOLLOW_SYMLINK_CHAIN
+ )
+ file(WRITE ${PREBUILD_TRACKING_DIR}/xmlrpc-epi_installed "${xmlrpc-epi_installed}")
+endif (NOT USESYSTEMLIBS)
target_link_libraries(ll::xmlrpc-epi INTERFACE xmlrpc-epi )
-
-if (USE_AUTOBUILD_3P OR USE_CONAN)
+if (NOT USESYSTEMLIBS)
target_include_directories( ll::xmlrpc-epi SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include)
-elseif (LINUX)
- target_include_directories( ll::xmlrpc-epi SYSTEM INTERFACE
- ${CMAKE_SYSROOT}/usr/include/xmlrpc-epi)
elseif (DARWIN)
- target_include_directories( ll::xmlrpc-epi SYSTEM INTERFACE /usr/local/include)
- target_link_directories( ll::xmlrpc-epi INTERFACE /usr/local/lib)
+ target_include_directories( ll::xmlrpc-epi SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/xmlrpc-epi)
+elseif (LINUX)
+ target_include_directories( ll::xmlrpc-epi SYSTEM INTERFACE ${CMAKE_SYSROOT}/usr/include/xmlrpc-epi)
endif ()
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index bc597fb69e..19ecfe425c 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -2287,14 +2287,18 @@ if (DARWIN)
)
if (USESYSTEMLIBS)
-
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/English.lproj/InfoPlist.strings
${CMAKE_CURRENT_BINARY_DIR}/InfoPlist.strings
)
-
+ add_custom_command(
+ TARGET ${VIEWER_BINARY_NAME} POST_BUILD
+ COMMAND ${CMAKE_INSTALL_NAME_TOOL}
+ -change "/usr/local/lib/libxmlrpc-epi.0.dylib" "${AUTOBUILD_INSTALL_DIR}/lib/release/libxmlrpc-epi.0.dylib"
+ ${VIEWER_APP_EXE}
+ VERBATIM
+ )
else (USESYSTEMLIBS)
-
add_custom_command(
TARGET ${VIEWER_BINARY_NAME} POST_BUILD
COMMAND ${PYTHON_EXECUTABLE}
@@ -2319,7 +2323,6 @@ if (DARWIN)
${VIEWER_BINARY_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
)
-
endif (USESYSTEMLIBS)
if (ENABLE_MEDIA_PLUGINS)