diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-08-12 13:08:38 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-08-12 13:08:38 +0800 |
commit | 2caff153c35274de15276b3cae10c7df54dacfc2 (patch) | |
tree | 056fefa7f8aa8204a17e171c58eddeab4810dfc6 | |
parent | 30a8368fd6134c239ad61f4ce2a713ba33fa6924 (diff) |
Automatic OpenJPEG download, configure & install
-rw-r--r-- | README.md | 28 | ||||
-rw-r--r-- | indra/cmake/OpenJPEG.cmake | 41 | ||||
-rw-r--r-- | indra/llimagej2coj/llimagej2coj.cpp | 6 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 |
4 files changed, 44 insertions, 33 deletions
@@ -37,21 +37,14 @@ $ 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 -L https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz -o openjpeg-2.5.2.tar.gz -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-darwin64-de53f55.tar.zst -OL https://get.videolan.org/vlc/3.0.21/macosx/vlc-3.0.21-universal.dmg -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 -OL https://get.videolan.org/vlc/3.0.21/macosx/vlc-3.0.21-universal.dmg -OL https://sourceforge.net/projects/xmlrpc-epi/files/xmlrpc-epi-base/0.54.2/xmlrpc-epi-0.54.2.tar.bz2 $ cd - $ cd .. -$ tar xf ~/Downloads/openjpeg-2.5.2.tar.gz $ 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 openjpeg-2.5.2 -$ sudo cp src/lib/openjp2/cio.h src/lib/openjp2/event.h /opt/local/include/openjpeg-2.5/ -$ mkdir -p build/`uname -m`-apple-darwin`uname -r` -$ cd build/`uname -m`-apple-darwin`uname -r` -$ cmake -DCMAKE_BUILD_TYPE:STRING=Release ../.. -$ sudo cp src/lib/openjp2/opj_config_private.h /opt/local/include/openjpeg-2.5/ -$ cd ../../../xmlrpc-epi-0.54.2 +$ cd xmlrpc-epi-0.54.2 $ export CPPFLAGS="$CPPFLAGS -I$PWD/src" $ rm -f config.sub missing $ autoreconf -is @@ -114,24 +107,13 @@ $ open newview/Megapahit.app ``` $ mkdir -p build/`uname -m`-linux-gnu/packages $ cd ~/Downloads -$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-linux64-513145c.tar.zst -OL https://github.com/secondlife/3p-open-libndofdev/releases/download/v1.14-r2/open_libndofdev-0.14.8730039102-linux64-8730039102.tar.zst -OL https://github.com/uclouvain/openjpeg/releases/download/v2.5.2/openjpeg-v2.5.2-linux-x86_64.tar.gz -L https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz -o openjpeg-2.5.2.tar.gz -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-linux64-de53f55.tar.zst +$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-linux64-513145c.tar.zst -OL https://github.com/secondlife/3p-open-libndofdev/releases/download/v1.14-r2/open_libndofdev-0.14.8730039102-linux64-8730039102.tar.zst -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-linux64-de53f55.tar.zst $ cd - $ cd build/`uname -m`-linux-gnu/packages $ tar xf ~/Downloads/curl-7.54.1-513145c-linux64-513145c.tar.zst $ tar xf ~/Downloads/open_libndofdev-0.14.8730039102-linux64-8730039102.tar.zst $ tar xf ~/Downloads/openssl-1.1.1q.de53f55-linux64-de53f55.tar.zst -$ cd ../../../.. -$ tar xf ~/Downloads/openjpeg-v2.5.2-linux-x86_64.tar.gz -$ cp -R openjpeg-v2.5.2-linux-x86_64/include/openjpeg-2.5 viewer/build/`uname -m`-linux-gnu/packages/include/openjpeg -$ cp openjpeg-v2.5.2-linux-x86_64/lib/libopenjp2.a viewer/build/`uname -m`-linux-gnu/packages/lib/release/ -$ tar xf ~/Downloads/openjpeg-2.5.2.tar.gz -$ cd openjpeg-2.5.2 -$ cp src/lib/openjp2/cio.h src/lib/openjp2/event.h ../viewer/build/`uname -m`-linux-gnu/packages/include/openjpeg/ -$ mkdir -p build/`uname -m`-linux-gnu -$ cd build/`uname -m`-linux-gnu -$ cmake -DCMAKE_BUILD_TYPE:STRING=Release ../.. -$ cp src/lib/openjp2/opj_config_private.h ../../../viewer/build/`uname -m`-linux-gnu/packages/include/openjpeg/ -$ cd ../../../viewer/build/`uname -m`-linux-gnu +$ cd .. $ export LL_BUILD="-O3 -std=c++17 -fPIC -DLL_LINUX=1" $ rm CMakeCache.txt ``` @@ -167,7 +149,7 @@ $ megapahit #### Fedora ``` -$ sudo dnf install gcc-c++ patchelf apr-util-devel boost-devel collada-dom-devel expat-devel fltk-devel mesa-libGLU-devel hunspell-devel jsoncpp-devel libnghttp2-devel nanosvg-devel pipewire-devel pulseaudio-libs-devel SDL2-devel uriparser-devel vlc-devel libvorbis-devel xmlrpc-epi-devel xxhash-devel +$ sudo dnf install gcc-c++ patchelf apr-util-devel boost-devel collada-dom-devel expat-devel fltk-devel mesa-libGLU-devel hunspell-devel jsoncpp-devel libnghttp2-devel nanosvg-devel openjpeg-devel pipewire-devel pulseaudio-libs-devel SDL2-devel uriparser-devel vlc-devel libvorbis-devel xmlrpc-epi-devel xxhash-devel $ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:INTERNAL=64 -DUSESYSTEMLIBS:BOOL=ON -DUSE_OPENAL:BOOL=OFF -DUSE_FMODSTUDIO:BOOL=ON -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=ON -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=ON -DPACKAGE:BOOL=ON ../../indra $ make -j`nproc` $ cpack -G RPM diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake index 6de03113ed..778cf62e29 100644 --- a/indra/cmake/OpenJPEG.cmake +++ b/indra/cmake/OpenJPEG.cmake @@ -6,15 +6,50 @@ add_library( ll::openjpeg INTERFACE IMPORTED ) if (NOT USESYSTEMLIBS) use_system_binary(openjpeg) -use_prebuilt_binary(openjpeg) -elseif (NOT LINUX) +elseif (${LINUX_DISTRO} MATCHES fedora OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD) include(FindPkgConfig) pkg_check_modules(Openjpeg REQUIRED libopenjp2) target_include_directories(ll::openjpeg SYSTEM INTERFACE ${Openjpeg_INCLUDE_DIRS}) target_link_directories(ll::openjpeg INTERFACE ${Openjpeg_LIBRARY_DIRS}) target_link_libraries(ll::openjpeg INTERFACE ${Openjpeg_LIBRARIES}) - return () endif (NOT USESYSTEMLIBS) +if (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)) + if (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/openjpeg_installed OR NOT ${openjpeg_installed} EQUAL 0) + execute_process( + COMMAND mkdir -p ${AUTOBUILD_INSTALL_DIR}/include/openjpeg-2.5 + COMMAND curl + -L https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz + -o openjpeg-2.5.2.tar.gz + WORKING_DIRECTORY $ENV{HOME}/Downloads + ) + execute_process( + COMMAND tar xf $ENV{HOME}/Downloads/openjpeg-2.5.2.tar.gz + WORKING_DIRECTORY /tmp + ) + execute_process( + COMMAND cmake + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + . + WORKING_DIRECTORY /tmp/openjpeg-2.5.2 + ) + execute_process( + COMMAND cp + /tmp/openjpeg-2.5.2/src/lib/openjp2/cio.h + /tmp/openjpeg-2.5.2/src/lib/openjp2/event.h + /tmp/openjpeg-2.5.2/src/lib/openjp2/opj_config_private.h + ${AUTOBUILD_INSTALL_DIR}/include/openjpeg-2.5/ + WORKING_DIRECTORY ${AUTOBUILD_INSTALL_DIR} + RESULT_VARIABLE openjpeg_installed + ) + endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/openjpeg_installed OR NOT ${openjpeg_installed} EQUAL 0) +else (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)) +use_prebuilt_binary(openjpeg) + execute_process(COMMAND mv + openjpeg + openjpeg-2.5 + WORKING_DIRECTORY ${AUTOBUILD_INSTALL_DIR}/include + ) target_link_libraries(ll::openjpeg INTERFACE openjp2 ) +endif (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)) target_include_directories( ll::openjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index b5f1df5507..5b03f76d32 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -28,15 +28,9 @@ #include "llimagej2coj.h" // this is defined so that we get static linking. -#if LL_LINUX || !LL_USESYSTEMLIBS -#include "openjpeg/openjpeg.h" -#include "openjpeg/event.h" -#include "openjpeg/cio.h" -#else #include <openjpeg-2.5/openjpeg.h> #include <openjpeg-2.5/event.h> #include <openjpeg-2.5/cio.h> -#endif #define MAX_ENCODED_DISCARD_LEVELS 5 diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2409fb1e18..bc597fb69e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2118,7 +2118,7 @@ if (LINUX) set(CPACK_RPM_PACKAGE_DESCRIPTION ${VIEWER_PACKAGE_DESCRIPTION} CACHE STRING "RPM package description.") set(CPACK_RPM_PACKAGE_REQUIRES - "apr-util, boost-fiber, boost-program-options, boost-regex, boost-thread, collada-dom, expat, fltk, mesa-libGLU, hunspell, jsoncpp, libnghttp2, SDL2, uriparser, vlc-libs, vlc-plugins-base, libvorbis, xmlrpc-epi" + "apr-util, boost-fiber, boost-program-options, boost-regex, boost-thread, collada-dom, expat, fltk, mesa-libGLU, hunspell, jsoncpp, libnghttp2, openjpeg2, SDL2, uriparser, vlc-libs, vlc-plugins-base, libvorbis, xmlrpc-epi" CACHE STRING "RPM package requirements.") endif (${LINUX_DISTRO} MATCHES debian OR ${LINUX_DISTRO} MATCHES ubuntu) endif (PACKAGE) |