diff --git a/.github/workflows/build_installer.yml b/.github/workflows/build_installer.yml new file mode 100644 index 0000000000..7c2207b7d5 --- /dev/null +++ b/.github/workflows/build_installer.yml @@ -0,0 +1,152 @@ +name: Build Installer + +on: + workflow_dispatch: {} + push: + +jobs: + win-installer: + name: Windows Installer + runs-on: windows-2022 + defaults: + run: + shell: msys2 {0} + env: + CI: 'True' + + steps: + - name: Checkout branch + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Windows system packages + uses: msys2/setup-msys2@v2 + with: + msystem: mingw64 + update: true + install: git mingw-w64-x86_64-wget unzip + + - name: Install Natron pacman repository + run: | + mkdir ${GITHUB_WORKSPACE}/natron_pacman_repo + cd ${GITHUB_WORKSPACE}/natron_pacman_repo + wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/natron_package_repo.zip + unzip natron_package_repo.zip + NATRON_REPO_PATH=`cygpath -u $GITHUB_WORKSPACE` + echo -e "#NATRON_REPO_START\n[natron]\nSigLevel = Optional TrustAll\nServer = file://${NATRON_REPO_PATH}/natron_pacman_repo/\n#NATRON_REPO_END" >> /etc/pacman.conf + pacman -Syl natron + pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 + + - name: Build + id: build + run: | + NATRON_BUILD_WORKSPACE=${GITHUB_WORKSPACE}/natron_build + NATRON_BUILD_WORKSPACE_UNIX=$(cygpath -u ${NATRON_BUILD_WORKSPACE}) + mkdir ${NATRON_BUILD_WORKSPACE_UNIX} + + cd tools/jenkins + + WORKSPACE=${NATRON_BUILD_WORKSPACE_UNIX} BUILD_NAME=natron BUILD_NUMBER=1 BITS=64 NATRON_LICENSE=GPL GIT_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git GIT_URL_IS_NATRON=1 SNAPSHOT_BRANCH=${GITHUB_REF_NAME} QT_VERSION_MAJOR=5 DISABLE_BREAKPAD=1 NOUPDATE=1 MKJOBS=$(nproc) MINIMIZE_DISK_USAGE=1 ./launchBuildMain.sh + + ARCHIVE_DIR=${NATRON_BUILD_WORKSPACE_UNIX}/builds_archive/natron/1 + INSTALLER_ZIP_UNIX=$(ls ${ARCHIVE_DIR}/Natron*Windows-x86_64.zip) + + set -x + # Unzip installer zip for artifact upload so we don't get a zipped zip file. + cd ${ARCHIVE_DIR} + INSTALLER_DIR="${ARCHIVE_DIR}/i" + INSTALLER_NAME=$(basename ${INSTALLER_ZIP_UNIX} .zip) + mkdir -p ${INSTALLER_DIR} + cd ${INSTALLER_DIR} + unzip ${INSTALLER_ZIP_UNIX} + + echo "INSTALLER_NAME=${INSTALLER_NAME}" >> $GITHUB_OUTPUT + echo "INSTALLER_DIR=$(cygpath -m ${INSTALLER_DIR})" >> $GITHUB_OUTPUT + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build.outputs.INSTALLER_NAME }} + path: ${{ steps.build.outputs.INSTALLER_DIR }} + + win-installer-breakpad: + name: Windows Installer (with Breakpad crash reporting) + runs-on: windows-2022 + defaults: + run: + shell: msys2 {0} + env: + CI: 'True' + + steps: + - name: Checkout branch + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Windows system packages + uses: msys2/setup-msys2@v2 + with: + msystem: mingw64 + update: true + install: git mingw-w64-x86_64-wget unzip + + - name: Install Natron pacman repository + run: | + mkdir ${GITHUB_WORKSPACE}/natron_pacman_repo + cd ${GITHUB_WORKSPACE}/natron_pacman_repo + wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/natron_package_repo.zip + unzip natron_package_repo.zip + NATRON_REPO_PATH=`cygpath -u $GITHUB_WORKSPACE` + echo -e "#NATRON_REPO_START\n[natron]\nSigLevel = Optional TrustAll\nServer = file://${NATRON_REPO_PATH}/natron_pacman_repo/\n#NATRON_REPO_END" >> /etc/pacman.conf + pacman -Syl natron + pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 + + - name: Build + id: build + run: | + NATRON_BUILD_WORKSPACE=${GITHUB_WORKSPACE}/natron_build + NATRON_BUILD_WORKSPACE_UNIX=$(cygpath -u ${NATRON_BUILD_WORKSPACE}) + mkdir ${NATRON_BUILD_WORKSPACE_UNIX} + + cd tools/jenkins + + WORKSPACE=${NATRON_BUILD_WORKSPACE_UNIX} BUILD_NAME=natron BUILD_NUMBER=1 BITS=64 NATRON_LICENSE=GPL GIT_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git GIT_URL_IS_NATRON=1 SNAPSHOT_BRANCH=${GITHUB_REF_NAME} QT_VERSION_MAJOR=5 NOUPDATE=1 MKJOBS=$(nproc) MINIMIZE_DISK_USAGE=1 ./launchBuildMain.sh + + ARCHIVE_DIR=${NATRON_BUILD_WORKSPACE_UNIX}/builds_archive/natron/1 + INSTALLER_ZIP_UNIX=$(ls ${ARCHIVE_DIR}/Natron*-breakpad.zip) + + set -x + # Unzip installer zip for artifact upload so we don't get a zipped zip file. + cd ${ARCHIVE_DIR} + INSTALLER_DIR="${ARCHIVE_DIR}/i" + INSTALLER_NAME=$(basename ${INSTALLER_ZIP_UNIX} .zip) + mkdir -p ${INSTALLER_DIR} + cd ${INSTALLER_DIR} + unzip ${INSTALLER_ZIP_UNIX} + + echo "INSTALLER_NAME=${INSTALLER_NAME}" >> $GITHUB_OUTPUT + echo "INSTALLER_DIR=$(cygpath -m ${INSTALLER_DIR})" >> $GITHUB_OUTPUT + + SYMBOLS_NAME="${INSTALLER_NAME}-symbols" + SYMBOLS_DIR="${ARCHIVE_DIR}/s" + cd ${ARCHIVE_DIR} + mv symbols ${SYMBOLS_NAME} + mkdir ${SYMBOLS_DIR} + mv ${SYMBOLS_NAME} ${SYMBOLS_DIR} + + echo "SYMBOLS_NAME=${SYMBOLS_NAME}" >> $GITHUB_OUTPUT + echo "SYMBOLS_DIR=$(cygpath -m ${SYMBOLS_DIR})" >> $GITHUB_OUTPUT + + - name: Upload installer + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build.outputs.INSTALLER_NAME }} + path: ${{ steps.build.outputs.INSTALLER_DIR }} + + - name: Upload symbols + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build.outputs.SYMBOLS_NAME }} + path: ${{ steps.build.outputs.SYMBOLS_DIR }} diff --git a/.github/workflows/build_pacman_repo.yml b/.github/workflows/build_pacman_repo.yml index 1d618cee0a..d99acb21fc 100644 --- a/.github/workflows/build_pacman_repo.yml +++ b/.github/workflows/build_pacman_repo.yml @@ -2,10 +2,11 @@ name: Build pacman repo on: workflow_dispatch: {} + pull_request: + paths: + - 'tools/MINGW-packages/**' + - '.github/workflows/build_pacman_repo.yml' push: - branches: - - 'main' - - 'build_natron_packages' paths: - 'tools/MINGW-packages/**' - '.github/workflows/build_pacman_repo.yml' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 793f08c379..41bc38f7f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,23 @@ name: Tests on: + workflow_dispatch: {} push: branches: - RB-2.5 + - RB-2.6 + - fix-ci # For testing. Remove before commit. paths-ignore: - Documentation pull_request: branches: - RB-2.5 + - RB-2.6 paths-ignore: - Documentation jobs: - test: + unix_test: name: Test ${{ matrix.os }} Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} defaults: @@ -22,60 +26,141 @@ jobs: env: CI: 'True' PYTHON_VERSION: ${{ matrix.python-version }} - # PYSIDE2_VERSION: ${{ matrix.pyside2-version }} - # PYSIDE2_QT_VERSION: ${{ matrix.pyside2-qt-version }} + OCIO_CONFIG_VERSION: 2.5 + MATRIX_OS: ${{ matrix.os }} + strategy: fail-fast: false matrix: - os: [ubuntu-18.04] # macos-latest, windows-latest - python-version: ['2.7'] # '3.6', '3.9' + os: [ubuntu-latest] #macos-latest + python-version: ['3.10'] include: - - os: ubuntu-18.04 + - os: ubuntu-latest special-invocation: 'xvfb-run --auto-servernum ' - python-version: '2.7' - # python-version: '3.6' - # pyside2-version: 5.12.0 # 5.12.1-5.12.6 fails on collection/segfaults on patch test - # - os: windows-latest - # python-version: '3.9' - # pyside2-version: 5.15 # No 5.12 wheel on Windows and Python 3.9 - # - os: macos-latest - # python-version: '2.7' - # python-version: '3.6' + python-version: '3.10' steps: - name: Checkout branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + submodules: recursive - name: Install Linux system packages if: contains(matrix.os, 'ubuntu') shell: bash run: | sudo apt update - sudo apt install libpulse-dev libegl1-mesa libopengl0 gcc-8 g++-8 libqt4-dev libqt4-opengl-dev libglew-dev libexpat1-dev \ - gdb libcairo2-dev python-dev python-pyside libpyside-dev libshiboken-dev libtinyxml-dev liblcms2-dev libyaml-cpp-dev \ - libopenjp2-7-dev libtiff-dev libjpeg-dev libpng-dev libwebp-dev libraw-dev libfreetype6-dev libssl-dev libboost-all-dev \ - python-qtpy + sudo apt install build-essential libboost-serialization-dev libboost-system-dev libexpat1-dev libcairo2-dev \ + qt5-qmake qtbase5-dev qtdeclarative5-dev \ + python3-dev libshiboken2-dev libpyside2-dev python3-pyside2.qtwidgets python3-qtpy \ + libwayland-dev libwayland-client0 libwayland-egl1 \ + extra-cmake-modules clang - name: Install Macos system packages if: contains(matrix.os, 'macos') shell: bash run: | brew install xctool python@2 boost giflib jpeg libpng libtiff libxml2 openssl pcre readline sqlite expat cairo \ gnu-sed glew openssl ilmbase openexr freetype fontconfig ffmpeg openjpeg libraw libheif openvdb - - name: Build - if: always() && !contains(github.ref, 'coverity_scan') + + - name: Download OpenColorIO-Configs run: | - ./.github/workflows/gen_config.sh - ./tools/travis/build.sh - - name: Upload coverage data to coveralls.io - if: contains(matrix.os, 'ubuntu') && contains(github.ref, 'coverity_scan') - shell: bash - env: - COVERALLS_FLAG_NAME: ${{ matrix.os }} Python ${{ matrix.python-version }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + wget https://github.com/NatronGitHub/OpenColorIO-Configs/archive/Natron-v${OCIO_CONFIG_VERSION}.tar.gz + tar xzf Natron-v${OCIO_CONFIG_VERSION}.tar.gz + mv OpenColorIO-Configs-Natron-v${OCIO_CONFIG_VERSION} OpenColorIO-Configs + + - name: Build Unix run: | - ln -s Tests/google-mock Tests/google-test . - pushd Tests - gcov -lp *.gcno > /dev/null - popd .. - python -m pip install --upgrade cpp-coveralls - python -b -X dev -m cpp-coveralls -n --exclude /usr/include --exclude 'Tests/google-test' --exclude 'Tests/google-mock' \ - --exclude 'google-test' --exclude 'google-mock' --exclude 'libs/OpenFX' --exclude-pattern '.*/moc_.*\.cpp' \ - --exclude-pattern='.*/Tests/.*\.cpp' --exclude-pattern='.*/Tests/.*\.h' + mkdir build && cd build + cmake ../ + make -j2 + + - name: Run Unix Tests + id: run-unix-tests + # Allow continuing after error so logs can be uploaded. + continue-on-error: true + run: | + cd build + + mkdir Plugins && cd Plugins + wget https://github.com/NatronGitHub/openfx-io/releases/download/natron_testing/openfx-io-build-ubuntu_22-testing.zip + unzip openfx-io-build-ubuntu_22-testing.zip + cd .. + + OFX_PLUGIN_PATH=$PWD/Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V + + - name: Upload ${{ matrix.os }} Test Log artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.os }} Test Logs + path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log + + - name: Check for test failures + if: steps.run-unix-tests.outcome == 'failure' + run: exit 1 + + win-test: + name: Test ${{ matrix.os }} Python ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: msys2 {0} + env: + CI: 'True' + PYTHON_VERSION: ${{ matrix.python-version }} + OCIO_CONFIG_VERSION: 2.5 + MATRIX_OS: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ windows-latest] + python-version: ['3.10'] + steps: + - name: Checkout branch + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Windows system packages + uses: msys2/setup-msys2@v2 + with: + msystem: mingw64 + update: true + install: git base-devel mingw-w64-x86_64-cc mingw-w64-x86_64-qt5-base mingw-w64-x86_64-pyside2 + mingw-w64-x86_64-shiboken2 mingw-w64-x86_64-python-qtpy mingw-w64-x86_64-ninja + mingw-w64-x86_64-cmake mingw-w64-x86_64-boost mingw-w64-x86_64-cairo mingw-w64-x86_64-expat + mingw-w64-x86_64-wget unzip + + - name: Download OpenColorIO-Configs + run: | + wget https://github.com/NatronGitHub/OpenColorIO-Configs/archive/Natron-v${OCIO_CONFIG_VERSION}.tar.gz + tar xzf Natron-v${OCIO_CONFIG_VERSION}.tar.gz + mv OpenColorIO-Configs-Natron-v${OCIO_CONFIG_VERSION} OpenColorIO-Configs + + - name: Build Windows + run: | + mkdir build && cd build + cmake ../ + ninja + + - name: Run Windows Tests + id: run-windows-tests + # Allow continuing after error so logs can be uploaded. + continue-on-error: true + run: | + cd build + + mkdir Plugins && cd Plugins + wget https://github.com/NatronGitHub/openfx-io/releases/download/natron_testing/openfx-io-build-windows_latest-testing.zip + unzip openfx-io-build-windows_latest-testing.zip + cd .. + + PYTHONHOME=/mingw64 OFX_PLUGIN_PATH=$PWD/Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V + + - name: Upload ${{ matrix.os }} Test Log artifacts + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.os }} Test Logs + path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log + + - name: Check for test failures + if: steps.run-windows-tests.outcome == 'failure' + run: exit 1 diff --git a/App/NatronApp_main.cpp b/App/NatronApp_main.cpp index 65d292db1c..415c81924b 100644 --- a/App/NatronApp_main.cpp +++ b/App/NatronApp_main.cpp @@ -71,17 +71,28 @@ int main(int argc, char *argv[]) #ifdef Q_OS_WIN // Setup Windows console output - bool hasConsole = false; QSettings settings( QString::fromUtf8(NATRON_ORGANIZATION_NAME), QString::fromUtf8(NATRON_APPLICATION_NAME) ); bool enableConsoleWindow = settings.value( QString::fromUtf8("enableConsoleWindow"), false ).toBool(); - if (enableConsoleWindow) { // output to console window - hasConsole = ( AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole() ); - } else { // output to parent console - hasConsole = AttachConsole(ATTACH_PARENT_PROCESS); + HANDLE stdOutHandle = GetStdHandle(STD_OUTPUT_HANDLE); + if (stdOutHandle == INVALID_HANDLE_VALUE) { + // Already having an invalid handle when starting likely means something is terribly wrong. + OutputDebugStringA("Invalid STD_OUTPUT_HANDLE."); + return 1; } - if (hasConsole) { - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); + if (stdOutHandle == NULL) { + // A console is not already attached to this process. Try attaching to our parent's console. + bool hasConsole = AttachConsole(ATTACH_PARENT_PROCESS); + if (!hasConsole && enableConsoleWindow) { + // Failed to attach to the parent console. Try creating a console window. + hasConsole = AllocConsole(); + } + + if (hasConsole) { + // Reopen stdout & stderr streams so that writing to + // them will display on the attached/allocated console. + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + } } #endif diff --git a/CMakeLists.txt b/CMakeLists.txt index 7249a3c20d..337c753bc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,16 @@ set(CMAKE_CXX_STANDARD 14) option(NATRON_SYSTEM_LIBS "use system versions of dependencies instead of bundled ones" OFF) option(NATRON_BUILD_TESTS "build the Natron test suite" ON) +if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE) + message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified.") +endif() + find_package(Boost COMPONENTS headers serialization) +if(WIN32) + # Prevent looking in the registry so that the MinGW python can be found. + set(Python3_FIND_REGISTRY NEVER) +endif() find_package(Python3 COMPONENTS Interpreter Development) find_package(Qt5 5.15 CONFIG REQUIRED COMPONENTS Core Gui Network Widgets Concurrent) find_package(Shiboken2 5.15 CONFIG REQUIRED COMPONENTS libshiboken2 shiboken2) @@ -43,6 +52,18 @@ set(QTCORE_INCLUDE_DIRS ${Qt5_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS}) set(QTGUI_INCLUDE_DIRS ${Qt5Gui_INCLUDE_DIRS}) set(QTWIDGETS_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS}) +#Since in Natron and OpenFX all strings are supposed UTF-8 and that the constructor +#for QString(const char*) assumes ASCII strings, we may run into troubles +add_compile_definitions(QT_NO_CAST_FROM_ASCII) + +if (NOT MSVC) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes" ) + add_compile_options(-Wall -Wextra -Wmissing-declarations -Wno-multichar -Winit-self -Wno-long-long + -Wvla -Wdate-time -Wshift-overflow=2 + -Wduplicated-cond -Wno-stringop-overflow -Wno-format-overflow + -Wno-deprecated-copy) +endif() + if(NATRON_SYSTEM_LIBS) find_package(glog) find_package(Ceres) @@ -55,9 +76,13 @@ if(UNIX AND NOT APPLE) find_package(Wayland COMPONENTS Client Egl) elseif(APPLE) enable_language(OBJCXX) -elseif(WINDOWS) +elseif(WIN32) enable_language(RC) + add_compile_definitions(WINDOWS WIN32 _UNICODE UNICODE NOMINMAX QHTTP_SERVER_STATIC) + add_compile_definitions(COMPILED_FROM_DSP XML_STATIC) # for expat if (NOT MSVC) + add_compile_options(-mwindows -municode -mthreads) + add_link_options(-mwindows -municode) set(CMAKE_RC_COMPILER_INIT windres) set(CMAKE_RC_COMPILE_OBJECT " -O coff -i -o ") diff --git a/Engine/AppManager.cpp b/Engine/AppManager.cpp index abd8a40818..cba7a4658c 100644 --- a/Engine/AppManager.cpp +++ b/Engine/AppManager.cpp @@ -3844,7 +3844,7 @@ NATRON_PYTHON_NAMESPACE::isKeyword(const std::string& str) } #if !defined(NDEBUG) && !defined(DEBUG_PYTHON_GIL) -#pragma message WARN("define DEBUG_PYTHON_GIL in AppManager.h to debug Python GIL issues") +//#pragma message WARN("define DEBUG_PYTHON_GIL in AppManager.h to debug Python GIL issues") #endif #ifdef DEBUG_PYTHON_GIL diff --git a/Engine/CMakeLists.txt b/Engine/CMakeLists.txt index 9e225d93c6..9cf20b076a 100644 --- a/Engine/CMakeLists.txt +++ b/Engine/CMakeLists.txt @@ -27,14 +27,14 @@ file(GLOB NatronEngine_SOURCES *.cpp) set(PYENGINE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Qt${QT_VERSION_MAJOR}) set(PYENGINE_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIRS} ${PYSIDE_INCLUDE_DIRS}/QtCore) list(APPEND PYENGINE_INCLUDE_DIRS ${QTCORE_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) -list(JOIN PYENGINE_INCLUDE_DIRS ":" PYENGINE_INCS) +list(TRANSFORM PYENGINE_INCLUDE_DIRS PREPEND "-I" OUTPUT_VARIABLE PYENGINE_INCS) set(PYENGINE_HEADER PySide2_Engine_Python.h) set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh) set(shiboken_args "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero" "--avoid-protected-hack" "--enable-pyside-extensions" - "-I.:..:../Global:../libs/OpenFX/include:${PYENGINE_INCS}" + "-I." "-I.." "-I../Global" "-I../libs/OpenFX/include" ${PYENGINE_INCS} "-T${PYSIDE_TYPESYSTEMS}" "--output-directory=${PYENGINE_OUT}" "${PYENGINE_HEADER}" "typesystem_engine.xml") if(APPLE) @@ -94,6 +94,12 @@ target_link_libraries(NatronEngine openMVG tess ) + +if(WIN32) + #System library is required on windows to map network share names from drive letters + target_link_libraries(NatronEngine PRIVATE mpr) +endif() + target_include_directories(NatronEngine PUBLIC ../Global/glad$,Deb,Rel>/include diff --git a/Engine/EffectInstance.cpp b/Engine/EffectInstance.cpp index fd3f61d4fb..968793e8a7 100644 --- a/Engine/EffectInstance.cpp +++ b/Engine/EffectInstance.cpp @@ -654,9 +654,8 @@ EffectInstance::retrieveGetImageDataUponFailure(const double time, getRegionsOfInterest(time, scale, optionalBounds, optionalBounds, ViewIdx(0), inputRois_p); } - assert( !( (supportsRenderScaleMaybe() == eSupportsNo) && !(scale.x == 1. && scale.y == 1.) ) ); - RectI pixelRod; - rod.toPixelEnclosing(scale, getAspectRatio(-1), &pixelRod); + assert(isSupportedRenderScale(supportsRenderScaleMaybe(), scale)); + const RectI pixelRod = rod.toPixelEnclosing(scale, getAspectRatio(-1)); try { int identityInputNb; double identityTime; @@ -992,8 +991,7 @@ EffectInstance::getImage(int inputNb, } - RectI pixelRoI; - roi.toPixelEnclosing(renderScaleOneUpstreamIfRenderScaleSupportDisabled ? 0 : mipMapLevel, par, &pixelRoI); + RectI pixelRoI = roi.toPixelEnclosing(renderScaleOneUpstreamIfRenderScaleSupportDisabled ? 0 : mipMapLevel, par); ImagePtr inputImg; @@ -1115,23 +1113,19 @@ EffectInstance::getImage(int inputNb, assert(inputImgMipMapLevel != 0); ///Resize the image according to the requested scale ImageBitDepthEnum bitdepth = inputImg->getBitDepth(); - RectI bounds; - inputImg->getRoD().toPixelEnclosing(0, par, &bounds); + const RectI bounds = inputImg->getRoD().toPixelEnclosing(0, par); ImagePtr rescaledImg = std::make_shared( inputImg->getComponents(), inputImg->getRoD(), bounds, 0, par, bitdepth, inputImg->getPremultiplication(), inputImg->getFieldingOrder() ); inputImg->upscaleMipMap( inputImg->getBounds(), inputImgMipMapLevel, 0, rescaledImg.get() ); if (roiPixel) { - RectD canonicalPixelRoI; - if (!inputRoDSet) { bool isProjectFormat; StatusEnum st = inputEffect->getRegionOfDefinition_public(inputEffect->getRenderHash(), time, scale, view, &inputRoD, &isProjectFormat); Q_UNUSED(st); } - pixelRoI.toCanonical(inputImgMipMapLevel, par, inputRoD, &canonicalPixelRoI); - canonicalPixelRoI.toPixelEnclosing(0, par, roiPixel); - pixelRoI = *roiPixel; + pixelRoI = pixelRoI.toNewMipMapLevel(inputImgMipMapLevel, 0, par, inputRoD); + *roiPixel = pixelRoI; } inputImg = rescaledImg; @@ -1185,7 +1179,7 @@ EffectInstance::calcDefaultRegionOfDefinition(U64 /*hash*/, unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); RectI format = getOutputFormat(); double par = getAspectRatio(-1); - format.toCanonical_noClipping(mipMapLevel, par, rod); + *rod = format.toCanonical_noClipping(mipMapLevel, par); } StatusEnum @@ -1198,7 +1192,7 @@ EffectInstance::getRegionOfDefinition(U64 hash, bool firstInput = true; RenderScale renderMappedScale = scale; - assert( !( (supportsRenderScaleMaybe() == eSupportsNo) && !(scale.x == 1. && scale.y == 1.) ) ); + assert(isSupportedRenderScale(supportsRenderScaleMaybe(), scale)); for (int i = 0; i < getNInputs(); ++i) { if ( isInputMask(i) ) { @@ -1288,7 +1282,7 @@ EffectInstance::ifInfiniteApplyHeuristic(U64 hash, assert(!format.isNull()); double par = getAspectRatio(-1); unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); - format.toCanonical_noClipping(mipMapLevel, par, &canonicalFormat); + canonicalFormat = format.toCanonical_noClipping(mipMapLevel, par); } // BE CAREFUL: @@ -1680,7 +1674,7 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, ////just discard this entry Format projectFormat; getApp()->getProject()->getProjectDefaultFormat(&projectFormat); - RectD canonicalProject = projectFormat.toCanonicalFormat(); + const RectD canonicalProject = projectFormat.toCanonicalFormat(); if ( canonicalProject != (*it)->getRoD() ) { appPTR->removeFromNodeCache(*it); continue; @@ -1740,22 +1734,12 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, //The rodParam might be different of oldParams->getRoD() simply because the RoD is dependent on the mipmap level const RectD & rod = rodParam ? *rodParam : oldParams->getRoD(); - - //RectD imgToConvertCanonical; - //imgToConvertBounds.toCanonical(imageToConvert->getMipMapLevel(), imageToConvert->getPixelAspectRatio(), rod, &imgToConvertCanonical); - RectI downscaledBounds; - rod.toPixelEnclosing(mipMapLevel, imageToConvert->getPixelAspectRatio(), &downscaledBounds); - //imgToConvertCanonical.toPixelEnclosing(imageToConvert->getMipMapLevel(), imageToConvert->getPixelAspectRatio(), &imgToConvertBounds); - //imgToConvertCanonical.toPixelEnclosing(mipMapLevel, imageToConvert->getPixelAspectRatio(), &downscaledBounds); + RectI downscaledBounds = rod.toPixelEnclosing(mipMapLevel, imageToConvert->getPixelAspectRatio()); if (boundsParam) { downscaledBounds.merge(*boundsParam); } - //RectI pixelRoD; - //rod.toPixelEnclosing(mipMapLevel, oldParams->getPixelAspectRatio(), &pixelRoD); - //downscaledBounds.intersect(pixelRoD, &downscaledBounds); - ImageParamsPtr imageParams = Image::makeParams(rod, downscaledBounds, oldParams->getPixelAspectRatio(), @@ -1786,9 +1770,9 @@ EffectInstance::getImageFromCacheAndConvertIfNeeded(bool /*useCache*/, */ int downscaleLevels = img->getMipMapLevel() - imageToConvert->getMipMapLevel(); RectI dstRoi = imgToConvertBounds.downscalePowerOfTwoSmallestEnclosing(downscaleLevels); - dstRoi.intersect(downscaledBounds, &dstRoi); + dstRoi.clipIfOverlaps(downscaledBounds); dstRoi = dstRoi.upscalePowerOfTwo(downscaleLevels); - dstRoi.intersect(imgToConvertBounds, &dstRoi); + dstRoi.clipIfOverlaps(imgToConvertBounds); if (imgToConvertBounds.area() > 1) { imageToConvert->downscaleMipMap( rod, @@ -2229,11 +2213,9 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT ///Upscale the RoI to a region in the full scale image so it is in canonical coordinates - RectD canonicalRectToRender; - renderMappedRectToRender.toCanonical(renderMappedMipMapLevel, par, rod, &canonicalRectToRender); if (renderFullScaleThenDownscale) { assert(mipMapLevel > 0 && renderMappedMipMapLevel != mipMapLevel); - canonicalRectToRender.toPixelEnclosing(mipMapLevel, par, &downscaledRectToRender); + downscaledRectToRender = renderMappedRectToRender.toNewMipMapLevel(renderMappedMipMapLevel, mipMapLevel, par, rod); } // at this point, it may be unnecessary to call render because it was done a long time ago => check the bitmap here! @@ -2296,10 +2278,9 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT RenderScale scale( Image::getScaleFromMipMapLevel(mipMapLevel) ); // check the dimensions of all input and output images const RectD & dstRodCanonical = firstPlaneToRender.renderMappedImage->getRoD(); - RectI dstBounds; - dstRodCanonical.toPixelEnclosing(firstPlaneToRender.renderMappedImage->getMipMapLevel(), par, &dstBounds); // compute dstRod at level 0 - RectI dstRealBounds = firstPlaneToRender.renderMappedImage->getBounds(); + const RectI dstBounds = dstRodCanonical.toPixelEnclosing(firstPlaneToRender.renderMappedImage->getMipMapLevel(), par); // compute dstRod at level 0 if (!frameArgs->tilesSupported) { + const RectI dstRealBounds = firstPlaneToRender.renderMappedImage->getBounds(); assert(dstRealBounds.x1 == dstBounds.x1); assert(dstRealBounds.x2 == dstBounds.x2); assert(dstRealBounds.y1 == dstBounds.y1); @@ -2311,8 +2292,7 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT ++it) { for (ImageList::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { const RectD & srcRodCanonical = (*it2)->getRoD(); - RectI srcBounds; - srcRodCanonical.toPixelEnclosing( (*it2)->getMipMapLevel(), (*it2)->getPixelAspectRatio(), &srcBounds ); // compute srcRod at level 0 + const RectI srcBounds = srcRodCanonical.toPixelEnclosing( (*it2)->getMipMapLevel(), (*it2)->getPixelAspectRatio() ); // compute srcRod at level 0 if (!frameArgs->tilesSupported) { // http://openfx.sourceforge.net/Documentation/1.3/ofxProgrammingReference.html#kOfxImageEffectPropSupportsTiles @@ -2325,7 +2305,7 @@ EffectInstance::Implementation::tiledRenderingFunctor(const RectToRender & rectT * Blur will actually retrieve the image from the cache and downscale it rather than recompute it. * Since the Writer does not support tiles, the Blur image is the full image and not a tile, which can be veryfied by * - * blurCachedImage->getRod().toPixelEnclosing(blurCachedImage->getMipMapLevel(), blurCachedImage->getPixelAspectRatio(), &bounds) + * bounds = blurCachedImage->getRod().toPixelEnclosing(blurCachedImage->getMipMapLevel(), blurCachedImage->getPixelAspectRatio()) * * Since the Blur RoD changed (the RoD at mmlevel 0 is different than the ROD at mmlevel 1), * the resulting bounds of the downscaled image are not necessarily exactly result of the new downscaled RoD to the enclosing pixel @@ -2422,7 +2402,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, actionArgs.byPassCache = byPassCache; actionArgs.processChannels = processChannels; actionArgs.mappedScale.x = actionArgs.mappedScale.y = Image::getScaleFromMipMapLevel( firstPlane.renderMappedImage->getMipMapLevel() ); - assert( !( (_publicInterface->supportsRenderScaleMaybe() == eSupportsNo) && !(actionArgs.mappedScale.x == 1. && actionArgs.mappedScale.y == 1.) ) ); + assert(isSupportedRenderScale(_publicInterface->supportsRenderScaleMaybe(), actionArgs.mappedScale)); actionArgs.originalScale.x = Image::getScaleFromMipMapLevel(mipMapLevel); actionArgs.originalScale.y = actionArgs.originalScale.x; actionArgs.draftMode = frameArgs->draftMode; @@ -2553,8 +2533,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, ///then upscale const RectD & rod = sourceImage->getRoD(); - RectI bounds; - rod.toPixelEnclosing(it->second.renderMappedImage->getMipMapLevel(), it->second.renderMappedImage->getPixelAspectRatio(), &bounds); + const RectI bounds = rod.toPixelEnclosing(it->second.renderMappedImage->getMipMapLevel(), it->second.renderMappedImage->getPixelAspectRatio()); ImagePtr inputPlane = std::make_shared(it->first, rod, bounds, @@ -2576,8 +2555,7 @@ EffectInstance::Implementation::renderHandler(const EffectTLSDataPtr& tls, if ( ( it->second.downscaleImage->getComponents() != idIt->second->getComponents() ) || ( it->second.downscaleImage->getBitDepth() != idIt->second->getBitDepth() ) ) { ViewerColorSpaceEnum colorspace = _publicInterface->getApp()->getDefaultColorSpaceForBitDepth( idIt->second->getBitDepth() ); ViewerColorSpaceEnum dstColorspace = _publicInterface->getApp()->getDefaultColorSpaceForBitDepth( it->second.fullscaleImage->getBitDepth() ); - RectI convertWindow; - idIt->second->getBounds().intersect(downscaledRectToRender, &convertWindow); + const RectI convertWindow = idIt->second->getBounds().intersect(downscaledRectToRender); idIt->second->convertToFormat( convertWindow, colorspace, dstColorspace, 3, false, false, it->second.downscaleImage.get() ); } else { it->second.downscaleImage->pasteFrom(*(idIt->second), downscaledRectToRender, false, glContext); @@ -3773,8 +3751,6 @@ EffectInstance::isIdentity_public(bool useIdentityCache, // only set to true whe ViewIdx* inputView, int* inputNb) { - //assert( !( (supportsRenderScaleMaybe() == eSupportsNo) && !(scale.x == 1. && scale.y == 1.) ) ); - if (useIdentityCache) { double timeF = 0.; bool foundInCache = _imp->actionsCache->getIdentityResult(hash, time, view, inputNb, inputView, &timeF); @@ -3874,7 +3850,7 @@ EffectInstance::getRegionOfDefinition_public(U64 hash, if (isProjectFormat) { *isProjectFormat = false; } -#pragma message WARN("[FD] why is an empty RoD a failure case? this is ignored in renderRoI, search for 'if getRoD fails, this might be because the RoD is null after all (e.g: an empty Roto node), we don't want the render to fail'") +//#pragma message WARN("[FD] why is an empty RoD a failure case? this is ignored in renderRoI, search for 'if getRoD fails, this might be because the RoD is null after all (e.g: an empty Roto node), we don't want the render to fail'") if ( rod->isNull() ) { return eStatusFailed; } @@ -4671,7 +4647,7 @@ EffectInstance::getOverlayInteractRenderScale() const if (isDoingInteractAction() && _imp->overlaysViewport) { unsigned int mmLevel = _imp->overlaysViewport->getCurrentRenderScale(); - renderScale.x = renderScale.y = 1 << mmLevel; + renderScale.x = renderScale.y = Image::getScaleFromMipMapLevel(mmLevel); } return renderScale; diff --git a/Engine/EffectInstance.h b/Engine/EffectInstance.h index f22586a178..b50e56c580 100644 --- a/Engine/EffectInstance.h +++ b/Engine/EffectInstance.h @@ -1127,6 +1127,14 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON **/ virtual void getFrameRange(double *first, double *last); + /** + * @brief Returns true if the value of renderScale is supported for the given the value of supportsRS. + **/ + static bool isSupportedRenderScale(SupportsEnum supportsRS, const RenderScale renderScale) + { + return (supportsRS != eSupportsNo) || (renderScale.x == 1. && renderScale.y == 1.); + } + public: StatusEnum getRegionOfDefinition_public(U64 hash, diff --git a/Engine/EffectInstanceRenderRoI.cpp b/Engine/EffectInstanceRenderRoI.cpp index cd426ad817..f6cf358752 100644 --- a/Engine/EffectInstanceRenderRoI.cpp +++ b/Engine/EffectInstanceRenderRoI.cpp @@ -202,8 +202,7 @@ EffectInstance::convertPlanesFormatsIfNeeded(const AppInstancePtr& app, #endif tmp->setKey(inputImage->getKey()); - RectI clippedRoi; - roi.intersect(bounds, &clippedRoi); + const RectI clippedRoi = roi.intersect(bounds); bool unPremultIfNeeded = outputPremult == eImagePremultiplicationPremultiplied && inputImage->getComponentsCount() == 4 && tmp->getComponentsCount() == 3; @@ -388,7 +387,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, renderMappedMipMapLevel = args.mipMapLevel; } RenderScale renderMappedScale( Image::getScaleFromMipMapLevel(renderMappedMipMapLevel) ); - assert( !( (supportsRS == eSupportsNo) && !(renderMappedScale.x == 1. && renderMappedScale.y == 1.) ) ); + assert(isSupportedRenderScale(supportsRS, renderMappedScale)); const FrameViewRequest* requestPassData = 0; @@ -398,26 +397,27 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// Get the RoD /////////////////////////////////////////////////////////////// - RectD rod; //!< rod is in canonical coordinates + + RectD rodNc; //!< rod is in canonical coordinates bool isProjectFormat = false; { ///if the rod is already passed as parameter, just use it and don't call getRegionOfDefinition if ( !args.preComputedRoD.isNull() ) { - rod = args.preComputedRoD; + rodNc = args.preComputedRoD; } else { ///Check if the pre-pass already has the RoD if (requestPassData) { - rod = requestPassData->globalData.rod; + rodNc = requestPassData->globalData.rod; isProjectFormat = requestPassData->globalData.isProjectFormat; } else { - assert( !( (supportsRS == eSupportsNo) && !(renderMappedScale.x == 1. && renderMappedScale.y == 1.) ) ); - StatusEnum stat = getRegionOfDefinition_public(nodeHash, args.time, renderMappedScale, args.view, &rod, &isProjectFormat); + assert(isSupportedRenderScale(supportsRS, renderMappedScale)); + StatusEnum stat = getRegionOfDefinition_public(nodeHash, args.time, renderMappedScale, args.view, &rodNc, &isProjectFormat); ///The rod might be NULL for a roto that has no beziers and no input if (stat == eStatusFailed) { ///if getRoD fails, this might be because the RoD is null after all (e.g: an empty Roto node), we don't want the render to fail return eRenderRoIRetCodeOk; - } else if ( rod.isNull() ) { + } else if ( rodNc.isNull() ) { //Nothing to render return eRenderRoIRetCodeOk; } @@ -433,20 +433,9 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, } } } + const RectD rod = rodNc; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// End get RoD /////////////////////////////////////////////////////////////// - RectI roi; - { - if (renderFullScaleThenDownscale) { - //We cache 'image', hence the RoI should be expressed in its coordinates - //renderRoIInternal should check the bitmap of 'image' and not downscaledImage! - RectD canonicalRoI; - args.roi.toCanonical(args.mipMapLevel, par, rod, &canonicalRoI); - canonicalRoI.toPixelEnclosing(0, par, &roi); - } else { - roi = args.roi; - } - } ///Determine needed planes ComponentsNeededMapPtr neededComps = std::make_shared(); @@ -556,10 +545,9 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, double inputTimeIdentity = 0.; int inputNbIdentity; ViewIdx inputIdentityView(args.view); - assert( !( (supportsRS == eSupportsNo) && !(renderMappedScale.x == 1. && renderMappedScale.y == 1.) ) ); + assert(isSupportedRenderScale(supportsRS, renderMappedScale)); bool identity; - RectI pixelRod; - rod.toPixelEnclosing(args.mipMapLevel, par, &pixelRod); + const RectI pixelRod = rod.toPixelEnclosing(args.mipMapLevel, par); ViewInvarianceLevel viewInvariance = isViewInvariant(); if ( (args.view != 0) && (viewInvariance == eViewInvarianceAllViewsInvariant) ) { @@ -617,12 +605,6 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, double firstFrame, lastFrame; getFrameRange_public(nodeHash, &firstFrame, &lastFrame); - RectD canonicalRoI; - ///WRONG! We can't clip against the RoD of *this* effect. We should clip against the RoD of the input effect, but this is done - ///later on for us already. - //args.roi.toCanonical(args.mipMapLevel, rod, &canonicalRoI); - args.roi.toCanonical_noClipping(args.mipMapLevel, par, &canonicalRoI); - EffectInstancePtr inputEffectIdentity = getInput(inputNbIdentity); if (inputEffectIdentity) { if ( frameArgs->stats && frameArgs->stats->isInDepthProfilingEnabled() ) { @@ -746,56 +728,51 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// Compute RoI depending on render scale /////////////////////////////////////////////////// + RectI downscaledImageBoundsNc = rod.toPixelEnclosing(args.mipMapLevel, par); + RectI upscaledImageBoundsNc = rod.toPixelEnclosing(0, par); + RectI roi; - RectI downscaledImageBoundsNc; - RectI upscaledImageBoundsNc; - { - rod.toPixelEnclosing(args.mipMapLevel, par, &downscaledImageBoundsNc); - rod.toPixelEnclosing(0, par, &upscaledImageBoundsNc); + if (renderFullScaleThenDownscale) { + //We cache 'image', hence the RoI should be expressed in its coordinates + //renderRoIInternal should check the bitmap of 'image' and not downscaledImage! + roi = args.roi.toNewMipMapLevel(args.mipMapLevel, 0, par, rod); + if (frameArgs->tilesSupported && !roi.clipIfOverlaps(upscaledImageBoundsNc)) { + return eRenderRoIRetCodeOk; + } + assert( upscaledImageBoundsNc.contains(roi)); + } else { + roi = args.roi; - ///Make sure the RoI falls within the image bounds - ///Intersection will be in pixel coordinates - if (frameArgs->tilesSupported) { - if (renderFullScaleThenDownscale) { - if ( !roi.intersect(upscaledImageBoundsNc, &roi) ) { - return eRenderRoIRetCodeOk; - } - assert(roi.x1 >= upscaledImageBoundsNc.x1 && roi.y1 >= upscaledImageBoundsNc.y1 && - roi.x2 <= upscaledImageBoundsNc.x2 && roi.y2 <= upscaledImageBoundsNc.y2); - } else { - if ( !roi.intersect(downscaledImageBoundsNc, &roi) ) { - return eRenderRoIRetCodeOk; - } - assert(roi.x1 >= downscaledImageBoundsNc.x1 && roi.y1 >= downscaledImageBoundsNc.y1 && - roi.x2 <= downscaledImageBoundsNc.x2 && roi.y2 <= downscaledImageBoundsNc.y2); - } -#ifndef NATRON_ALWAYS_ALLOCATE_FULL_IMAGE_BOUNDS - ///just allocate the roi - upscaledImageBoundsNc.intersect(roi, &upscaledImageBoundsNc); - downscaledImageBoundsNc.intersect(args.roi, &downscaledImageBoundsNc); -#endif + if (frameArgs->tilesSupported && !roi.clipIfOverlaps(downscaledImageBoundsNc)) { + return eRenderRoIRetCodeOk; } + assert(downscaledImageBoundsNc.contains(roi)); } /* - * Keep in memory what the user as requested, and change the roi to the full bounds if the effect doesn't support tiles + * Keep in memory what the user has requested, and change the roi to the full bounds if the effect doesn't support tiles */ const RectI originalRoI = roi; - if (!frameArgs->tilesSupported) { + // Store the mipMapLevel for originalRoI here because renderFullScaleThenDownscale may change later and we'll lose + // the ability to recover this information when we potentially need it for a downscale operation later. + const unsigned int originalRoIMipMapLevel = renderFullScaleThenDownscale ? 0 : args.mipMapLevel; + + if (frameArgs->tilesSupported) { +#ifndef NATRON_ALWAYS_ALLOCATE_FULL_IMAGE_BOUNDS + ///just allocate the roi + const RectI upscaledRoI = renderFullScaleThenDownscale ? roi : roi.toNewMipMapLevel(args.mipMapLevel, 0, par, rod); + upscaledImageBoundsNc.clipIfOverlaps(upscaledRoI); + downscaledImageBoundsNc.clipIfOverlaps(args.roi); +#endif + } else { roi = renderFullScaleThenDownscale ? upscaledImageBoundsNc : downscaledImageBoundsNc; } const RectI & downscaledImageBounds = downscaledImageBoundsNc; const RectI & upscaledImageBounds = upscaledImageBoundsNc; - RectD canonicalRoI; - { - if (renderFullScaleThenDownscale) { - roi.toCanonical(0, par, rod, &canonicalRoI); - } else { - roi.toCanonical(args.mipMapLevel, par, rod, &canonicalRoI); - } - } + const RectD canonicalRoI = roi.toCanonical(renderFullScaleThenDownscale ? 0 : args.mipMapLevel, par, rod); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// End Compute RoI ///////////////////////////////////////////////////////////////////////// const PluginOpenGLRenderSupport openGLSupport = frameArgs->currentOpenglSupport; @@ -864,7 +841,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, renderMappedScale.x = renderMappedScale.y = Image::getScaleFromMipMapLevel(renderMappedMipMapLevel); if (frameArgs->tilesSupported) { roi = args.roi; - if ( !roi.intersect(downscaledImageBoundsNc, &roi) ) { + if ( !roi.clipIfOverlaps(downscaledImageBoundsNc) ) { return eRenderRoIRetCodeOk; } } else { @@ -1114,7 +1091,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, lastStrokeRoD = getApp()->getLastPaintStrokeBbox(); node->clearLastPaintStrokeRoD(); // qDebug() << getScriptName_mt_safe().c_str() << "last stroke RoD: " << lastStrokeRoD.x1 << lastStrokeRoD.y1 << lastStrokeRoD.x2 << lastStrokeRoD.y2; - lastStrokeRoD.toPixelEnclosing(mipMapLevel, par, &lastStrokePixelRoD); + lastStrokePixelRoD = lastStrokeRoD.toPixelEnclosing(mipMapLevel, par); } } @@ -1158,8 +1135,8 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, if ( isDuringPaintStroke && !rectsLeftToRender.empty() && !lastStrokePixelRoD.isNull() ) { rectsLeftToRender.clear(); - RectI intersection; - if ( downscaledImageBounds.intersect(lastStrokePixelRoD, &intersection) ) { + const RectI intersection = downscaledImageBounds.intersect(lastStrokePixelRoD); + if ( !intersection.isNull() ) { rectsLeftToRender.push_back(intersection); } } @@ -1219,10 +1196,9 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, if (!input) { continue; } - bool isProjectFormat; ParallelRenderArgsPtr inputFrameArgs = input->getParallelRenderArgsTLS(); U64 inputHash = (inputFrameArgs) ? inputFrameArgs->nodeHash : input->getHash(); - StatusEnum stat = input->getRegionOfDefinition_public(inputHash, args.time, args.scale, args.view, &inputRod, &isProjectFormat); + StatusEnum stat = input->getRegionOfDefinition_public(inputHash, args.time, args.scale, args.view, &inputRod, nullptr); if ( (stat != eStatusOK) && !inputRod.isNull() ) { break; } @@ -1239,7 +1215,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, hasDifferentRods = true; } } - inputsIntersection.intersect(inputRod, &inputsIntersection); + inputsIntersection.clipIfOverlaps(inputRod); } } @@ -1251,7 +1227,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, are identity over one of the input effect, thus avoiding pixels to render. */ if ( inputsIntersectionSet && (hasMask || hasDifferentRods) ) { - inputsIntersection.toPixelEnclosing(mipMapLevel, par, &inputsRoDIntersectionPixel); + inputsRoDIntersectionPixel = inputsIntersection.toPixelEnclosing(mipMapLevel, par); tryIdentityOptim = true; } } @@ -1322,12 +1298,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, } RenderRoIRetCode inputCode; { - RectD canonicalRoI; - if (renderFullScaleThenDownscale) { - it->rect.toCanonical(0, par, rod, &canonicalRoI); - } else { - it->rect.toCanonical(args.mipMapLevel, par, rod, &canonicalRoI); - } + const RectD canonicalRoI = it->rect.toCanonical(renderFullScaleThenDownscale ? 0 : args.mipMapLevel, par, rod); inputCode = renderInputImagesForRoI(requestPassData, useTransforms, @@ -1478,8 +1449,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, } if ( renderFullScaleThenDownscale && (it->second.fullscaleImage->getMipMapLevel() == 0) ) { - RectI bounds; - rod.toPixelEnclosing(args.mipMapLevel, par, &bounds); + const RectI bounds = rod.toPixelEnclosing(args.mipMapLevel, par); it->second.downscaleImage = std::make_shared(*components, rod, downscaledImageBounds, @@ -1690,9 +1660,8 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, if (!frameArgs->tilesSupported) { //assert that bounds are consistent with the RoD if tiles are not supported const RectD & srcRodCanonical = renderFullScaleThenDownscale ? it->second.fullscaleImage->getRoD() : it->second.downscaleImage->getRoD(); - RectI srcBounds; - srcRodCanonical.toPixelEnclosing(renderFullScaleThenDownscale ? it->second.fullscaleImage->getMipMapLevel() : it->second.downscaleImage->getMipMapLevel(), par, &srcBounds); - RectI srcRealBounds = renderFullScaleThenDownscale ? it->second.fullscaleImage->getBounds() : it->second.downscaleImage->getBounds(); + const RectI srcBounds = srcRodCanonical.toPixelEnclosing(renderFullScaleThenDownscale ? it->second.fullscaleImage->getMipMapLevel() : it->second.downscaleImage->getMipMapLevel(), par); + const RectI srcRealBounds = renderFullScaleThenDownscale ? it->second.fullscaleImage->getBounds() : it->second.downscaleImage->getBounds(); assert(srcRealBounds.x1 == srcBounds.x1); assert(srcRealBounds.x2 == srcBounds.x2); assert(srcRealBounds.y1 == srcBounds.y1); @@ -1784,7 +1753,8 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, assert(comp); ///The image might need to be converted to fit the original requested format if (comp) { - it->second.downscaleImage = convertPlanesFormatsIfNeeded(getApp(), it->second.downscaleImage, originalRoI, *comp, args.bitdepth, useAlpha0ForRGBToRGBAConversion, planesToRender->outputPremult, -1); + const RectI downscaledOriginalRoI = originalRoI.toNewMipMapLevel(originalRoIMipMapLevel, args.mipMapLevel, par, rod); + it->second.downscaleImage = convertPlanesFormatsIfNeeded(getApp(), it->second.downscaleImage, downscaledOriginalRoI, *comp, args.bitdepth, useAlpha0ForRGBToRGBAConversion, planesToRender->outputPremult, -1); assert(it->second.downscaleImage->getComponents() == *comp && it->second.downscaleImage->getBitDepth() == args.bitdepth); StorageModeEnum imageStorage = it->second.downscaleImage->getStorageMode(); @@ -1812,10 +1782,8 @@ EffectInstance::renderRoI(const RenderRoIArgs & args, } #ifdef DEBUG - RectI renderedImageBounds; - rod.toPixelEnclosing(args.mipMapLevel, par, &renderedImageBounds); - RectI expectedContainedRoI; - args.roi.intersect(renderedImageBounds, &expectedContainedRoI); + const RectI renderedImageBounds = rod.toPixelEnclosing(args.mipMapLevel, par); + const RectI expectedContainedRoI = args.roi.intersect(renderedImageBounds); if ( !it->second.downscaleImage->getBounds().contains(expectedContainedRoI) ) { qDebug() << "[WARNING]:" << getScriptName_mt_safe().c_str() << "rendered an image with an RoI that fell outside its bounds."; } @@ -1938,7 +1906,7 @@ EffectInstance::renderRoIInternal(EffectInstance* self, if (callBegin) { - assert( !( (self->supportsRenderScaleMaybe() == eSupportsNo) && !(renderMappedScale.x == 1. && renderMappedScale.y == 1.) ) ); + assert( self->isSupportedRenderScale(self->supportsRenderScaleMaybe(), renderMappedScale) ); if (self->beginSequenceRender_public(time, time, 1, !appPTR->isBackground(), renderMappedScale, isSequentialRender, isRenderMadeInResponseToUserInteraction, frameArgs->draftMode, view, planesToRender->useOpenGL, planesToRender->glContextData) == eStatusFailed) { renderStatus = eRenderingFunctorRetFailed; @@ -2026,7 +1994,7 @@ EffectInstance::renderRoIInternal(EffectInstance* self, ///never call endsequence render here if the render is sequential if (callBegin) { - assert( !( (self->supportsRenderScaleMaybe() == eSupportsNo) && !(renderMappedScale.x == 1. && renderMappedScale.y == 1.) ) ); + assert( self->isSupportedRenderScale(self->supportsRenderScaleMaybe(), renderMappedScale) ); if (self->endSequenceRender_public(time, time, time, false, renderMappedScale, isSequentialRender, isRenderMadeInResponseToUserInteraction, diff --git a/Engine/FileSystemModel.cpp b/Engine/FileSystemModel.cpp index 81b4023bbd..7442c67282 100644 --- a/Engine/FileSystemModel.cpp +++ b/Engine/FileSystemModel.cpp @@ -56,45 +56,123 @@ CLANG_DIAG_ON(uninitialized) #include "Global/FloatingPointExceptions.h" #endif +#include "AppManager.h" // appPTR & StrUtils + + NATRON_NAMESPACE_ENTER -static QStringList -getSplitPath(const QString& path) +static int +getDriveNameSize(const QString& name) { - if ( path.isEmpty() ) { - return QStringList(); +#ifdef __NATRON_WIN32__ + if (name.size() < 3) { + return 0; } - QString pathCpy = path; - bool isdriveOrRoot; + + if (name.at(0).isLetter() && name.at(1) == QLatin1Char(':') && ( name.at(2) == QLatin1Char('/') || name.at(2) == QLatin1Char('\\') ) ) { + // Drive path. (e.g. C:/ or C:\) + return 3; + } + + if (((name.at(0) == QLatin1Char('/') && name.at(1) == QLatin1Char('/')) || + (name.at(0) == QLatin1Char('\\') && name.at(1) == QLatin1Char('\\'))) && name.at(2).isLetterOrNumber()) { + // Possible Network share. (e.g. //SomeHost/ShareName) + + // Search for end of hostname. + int idx = name.indexOf(QLatin1Char('/'), 2); + if (idx == -1) { + idx = name.indexOf(QLatin1Char('\\'), 2); + } + + if (idx == -1) { + // Hostname only without a trailing slash. (e.g. //SomeHost). + // Do not consider this valid, just like "C:" is not considered a valid drive. + return 0; + } + + ++idx; // Move beyond slash. + return idx; + } +#else + if (name.startsWith(QDir::rootPath())) { + return QDir::rootPath().size(); + } +#endif + + return 0; +} + #ifdef __NATRON_WIN32__ - QString startPath = pathCpy.mid(0, 3); - isdriveOrRoot = FileSystemModel::isDriveName(startPath); - if (isdriveOrRoot) { - pathCpy = pathCpy.remove(0, 3); +// Ensures that drive names and network share hostnames are always upper case. +static QString +ensureCanonicalDriveAndShareNames(const QString& path) +{ + if (path.isEmpty() || !FileSystemModel::startsWithDriveName(path)) { + return path; } - if ( (pathCpy.size() > 0) && ( pathCpy[pathCpy.size() - 1] == QChar::fromLatin1('/') ) ) { - pathCpy = pathCpy.mid(0, pathCpy.size() - 1); + + if (path.size() < 3) { + return path; } - QStringList splitPath = pathCpy.split( QChar::fromLatin1('/') ); - if (isdriveOrRoot) { - splitPath.prepend( startPath.mid(0, 3) ); + + // Assume that any path that reaches this point has already had backslashes converted + // to forward slashes. + assert(path.indexOf(QLatin1Char('\\')) == -1); + + QString ret = path; + if (path[0] == QLatin1Char('/') && path[1] == QLatin1Char('/') && path[2].isLetterOrNumber()) { + // Network share name. + + int idx = path.indexOf(QLatin1Char('/'), 2); + ret.truncate(2); // keep starting slashes. + if (idx == -1) { + // No trailing slash. Hostname only case. + // Change the hostname to upper case and add the trailing slash. + ret.append(path.mid(2).toUpper()); + ret.append(QLatin1Char('/')); // Add a trailing slash. + } else { + // Hostname with slash and possible path components. + const QString hostname = path.mid(2, idx - 2); + + // Change hostname to upper case and append any path components that may remain. + ret.append(hostname.toUpper()); + ret.append(path.mid(idx)); + } + } else if (path[0].isLetter() && path[1] == QLatin1Char(':') && path[2] == QLatin1Char('/')) { + // Drive name. + // Force drive letter to be upper case. + ret[0] = ret[0].toUpper(); } -#else - isdriveOrRoot = pathCpy.startsWith( QChar::fromLatin1('/') ); - if (isdriveOrRoot) { - pathCpy = pathCpy.remove(0, 1); + return ret; +} +#endif // __NATRON_WIN32__ + +QStringList +FileSystemModel::getSplitPath(const QString& path) +{ + if ( path.isEmpty() ) { + return QStringList(); + } + QString pathCpy = path; + + int driveNameSize = getDriveNameSize(path); + if (driveNameSize > 0) { + // Remove the drive name from pathCpy. + pathCpy = pathCpy.remove(0, driveNameSize); } + + // Remove trailing slash. if ( (pathCpy.size() > 0) && ( pathCpy[pathCpy.size() - 1] == QChar::fromLatin1('/') ) ) { - pathCpy = pathCpy.mid(0, pathCpy.size() - 1); + pathCpy = pathCpy.mid(0, pathCpy.size() - 1); } + QStringList splitPath = pathCpy.split( QChar::fromLatin1('/') ); - if (isdriveOrRoot) { - splitPath.prepend( QChar::fromLatin1('/') ); + if (driveNameSize > 0) { + // Put the drive name at the beginning of the list. + splitPath.prepend(path.mid(0, driveNameSize)); } -#endif - return splitPath; } @@ -164,9 +242,7 @@ generateChildAbsoluteName(FileSystemItem* parent, { QString childName = parent->absoluteFilePath(); - if ( !childName.endsWith( QChar::fromLatin1('/') ) ) { - childName.append( QChar::fromLatin1('/') ); - } + StrUtils::ensureLastPathSeparator(childName); childName.append(name); return childName; @@ -612,25 +688,57 @@ FileSystemModel::getSharedItemPtr(FileSystemItem* item) const bool FileSystemModel::isDriveName(const QString& name) { -#ifdef __NATRON_WIN32__ - - return name.size() == 3 && name.at(0).isLetter() && name.at(1) == QLatin1Char(':') && ( name.at(2) == QLatin1Char('/') || name.at(2) == QLatin1Char('\\') ); -#else - - return name == QDir::rootPath(); -#endif + return !name.isEmpty() && getDriveNameSize(name) == name.size(); } bool FileSystemModel::startsWithDriveName(const QString& name) { + return getDriveNameSize(name) > 0; +} + +QString FileSystemModel::cleanPath(const QString& path) { + if (path.isEmpty()) { + return path; + } + + QString newPath = path; + #ifdef __NATRON_WIN32__ + // Replace backslashes with slashes. + newPath.replace( QLatin1Char('\\'), QLatin1Char('/') ); +#endif - return name.size() >= 3 && name.at(0).isLetter() && name.at(1) == QLatin1Char(':') && ( name.at(2) == QLatin1Char('/') || name.at(2) == QLatin1Char('\\') ); -#else + bool startedWithDriveName = startsWithDriveName(newPath); + + // Resolve and remove '.' and "..". + newPath = QDir::cleanPath(newPath); + + if (newPath.isEmpty()) { + return newPath; + } - return name.startsWith( QDir::rootPath() ); + // QDir::cleanPath() strips the trailing slash for network shares + // (e.g. //SomeHost/) , but not for drives (e.g. C:/). The trailing + // slash is required for network shares to behave the same way as + // drives elsewhere in the code so we need to put back the trailing + // slash. + if (startedWithDriveName && !startsWithDriveName(newPath)) { + // The path no longer starts with a drive name after cleaning. + // See if appending a trailing slash fixes it. + const QString newPathWithTrailingSlash = newPath + QLatin1Char('/'); + if (startsWithDriveName(newPathWithTrailingSlash)) { + newPath = newPathWithTrailingSlash; + } + } + +#ifdef __NATRON_WIN32__ + // Make sure drive letters and share hostnames are upper case so they get properly + // collapsed together in the UI and other path matching. + newPath = ensureCanonicalDriveAndShareNames(newPath); #endif + + return newPath; } QVariant @@ -895,24 +1003,6 @@ FileSystemModel::rootPath() const return _imp->currentRootPath; } -QVariant -FileSystemModel::myComputer(int /*role*/) const -{ -// switch (role) { -// case Qt::DisplayRole: -#ifdef Q_OS_WIN - - return tr("Computer"); -#else - - return tr("Computer"); -#endif -// case Qt::DecorationRole: -// return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer); -// } -// return QVariant(); -} - void FileSystemModel::setFilter(const QDir::Filters& filters) { @@ -1192,7 +1282,7 @@ FileSystemModelPrivate::getItemFromPath(const QString &path) const if ( path.isEmpty() || !rootItem ) { return rootItem; } - QStringList splitPath = getSplitPath(path); + QStringList splitPath = FileSystemModel::getSplitPath(path); return rootItem->matchPath( splitPath, 0 ); } @@ -1204,11 +1294,8 @@ FileSystemModel::setRootPath(const QString& path) ///Check if the path exists - if ( !path.isEmpty() ) { - QDir dir(path); - if ( !dir.exists() ) { - return false; - } + if ( !path.isEmpty() && !QDir(path).exists()) { + return false; } _imp->currentRootPath = path; @@ -1309,8 +1396,7 @@ FileSystemModel::onWatchedDirectoryChanged(const QString& directory) } } - QDir dir(_imp->currentRootPath); - if ( !dir.exists() ) { + if ( !QDir(_imp->currentRootPath).exists() ) { ///The current directory has changed its name or was deleted.. just fallback the filesystem to the root-path setRootPath( QDir::rootPath() ); } else { diff --git a/Engine/FileSystemModel.h b/Engine/FileSystemModel.h index aab4969dbe..0484e9bd8d 100644 --- a/Engine/FileSystemModel.h +++ b/Engine/FileSystemModel.h @@ -236,6 +236,8 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON static bool isDriveName(const QString& name); static bool startsWithDriveName(const QString& name); + static QStringList getSplitPath(const QString& path); + static QString cleanPath(const QString& path); virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const OVERRIDE FINAL WARN_UNUSED_RETURN; virtual Qt::ItemFlags flags(const QModelIndex &index) const OVERRIDE FINAL WARN_UNUSED_RETURN; virtual int columnCount(const QModelIndex & parent) const OVERRIDE FINAL WARN_UNUSED_RETURN; @@ -271,8 +273,6 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON **/ bool setRootPath(const QString& path); - QVariant myComputer(int role = Qt::DisplayRole) const WARN_UNUSED_RETURN; - void setFilter(const QDir::Filters& filters); const QDir::Filters filter() const WARN_UNUSED_RETURN; diff --git a/Engine/Format.h b/Engine/Format.h index cfa89dd49a..f0bd7b7201 100644 --- a/Engine/Format.h +++ b/Engine/Format.h @@ -116,11 +116,7 @@ class Format RectD toCanonicalFormat() const { - RectD ret; - - toCanonical_noClipping(0, _par, &ret); - - return ret; + return toCanonical_noClipping(0, _par); } Format & operator=(const Format & other) diff --git a/Engine/FrameEntry.cpp b/Engine/FrameEntry.cpp index e3d0efa53b..b29eb66ae1 100644 --- a/Engine/FrameEntry.cpp +++ b/Engine/FrameEntry.cpp @@ -94,8 +94,8 @@ FrameEntry::copy(const FrameEntry& other) srcBoundsRect.x2 = srcBounds.x2; srcBoundsRect.y1 = srcBounds.y1; srcBoundsRect.y2 = srcBounds.y2; - RectI roi; - if ( !dstBounds.intersect(srcBoundsRect, &roi) ) { + const RectI roi = dstBounds.intersect(srcBoundsRect); + if (roi.isNull()) { return; } diff --git a/Engine/Image.cpp b/Engine/Image.cpp index b19de56b36..a56efba90f 100644 --- a/Engine/Image.cpp +++ b/Engine/Image.cpp @@ -213,9 +213,7 @@ minimalNonMarkedRects_internal(const RectI & roi, { assert(ret.empty()); ///Any out of bounds portion is pushed to the rectangles to render - RectI intersection; - - roi.intersect(_bounds, &intersection); + const RectI intersection = roi.intersect(_bounds); if (roi != intersection) { if ( (_bounds.x1 > roi.x1) && (_bounds.y2 > _bounds.y1) ) { RectI left(roi.x1, _bounds.y1, _bounds.x1, _bounds.y2); @@ -464,31 +462,23 @@ minimalNonMarkedRects_internal(const RectI & roi, RectI Bitmap::minimalNonMarkedBbox(const RectI & roi) const { - if (_dirtyZoneSet) { - RectI realRoi; - if ( !roi.intersect(_dirtyZone, &realRoi) ) { - return RectI(); - } - - return minimalNonMarkedBbox_internal<0>(realRoi, _bounds, _map, NULL); - } else { - return minimalNonMarkedBbox_internal<0>(roi, _bounds, _map, NULL); + RectI realRoi = roi; + if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { + return RectI(); } + + return minimalNonMarkedBbox_internal<0>(realRoi, _bounds, _map, NULL); } void Bitmap::minimalNonMarkedRects(const RectI & roi, std::list& ret) const { - if (_dirtyZoneSet) { - RectI realRoi; - if ( !roi.intersect(_dirtyZone, &realRoi) ) { - return; - } - minimalNonMarkedRects_internal<0>(realRoi, _bounds, _map, ret, NULL); - } else { - minimalNonMarkedRects_internal<0>(roi, _bounds, _map, ret, NULL); + RectI realRoi = roi; + if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { + return; } + minimalNonMarkedRects_internal<0>(realRoi, _bounds, _map, ret, NULL); } #if NATRON_ENABLE_TRIMAP @@ -496,18 +486,13 @@ RectI Bitmap::minimalNonMarkedBbox_trimap(const RectI & roi, bool* isBeingRenderedElsewhere) const { - if (_dirtyZoneSet) { - RectI realRoi; - if ( !roi.intersect(_dirtyZone, &realRoi) ) { - *isBeingRenderedElsewhere = false; - - return RectI(); - } - - return minimalNonMarkedBbox_internal<1>(realRoi, _bounds, _map, isBeingRenderedElsewhere); - } else { - return minimalNonMarkedBbox_internal<1>(roi, _bounds, _map, isBeingRenderedElsewhere); + RectI realRoi = roi; + if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { + *isBeingRenderedElsewhere = false; + return RectI(); } + + return minimalNonMarkedBbox_internal<1>(realRoi, _bounds, _map, isBeingRenderedElsewhere); } void @@ -515,17 +500,12 @@ Bitmap::minimalNonMarkedRects_trimap(const RectI & roi, std::list& ret, bool* isBeingRenderedElsewhere) const { - if (_dirtyZoneSet) { - RectI realRoi; - if ( !roi.intersect(_dirtyZone, &realRoi) ) { - *isBeingRenderedElsewhere = false; - - return; - } - minimalNonMarkedRects_internal<1>(realRoi, _bounds, _map, ret, isBeingRenderedElsewhere); - } else { - minimalNonMarkedRects_internal<1>(roi, _bounds, _map, ret, isBeingRenderedElsewhere); + RectI realRoi = roi; + if (_dirtyZoneSet && !realRoi.clipIfOverlaps(_dirtyZone)) { + *isBeingRenderedElsewhere = false; + return; } + minimalNonMarkedRects_internal<1>(realRoi, _bounds, _map, ret, isBeingRenderedElsewhere); } #endif @@ -822,9 +802,7 @@ Image::makeParams(const RectD & rod, StorageModeEnum storage, U32 textureTarget) { - RectI bounds; - - rod.toPixelEnclosing(mipMapLevel, par, &bounds); + const RectI bounds = rod.toPixelEnclosing(mipMapLevel, par); #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES return ImageParamsPtr( new ImageParams(rod, @@ -928,13 +906,11 @@ Image::pasteFromForDepth(const Image & srcImg, // only copy the intersection of roi, bounds and otherBounds RectI roi = srcRoi; - bool doInteresect = roi.intersect(bounds, &roi); - if (!doInteresect) { + if (!roi.clipIfOverlaps(bounds)) { // no intersection between roi and the bounds of this image return; } - doInteresect = roi.intersect(srcBounds, &roi); - if (!doInteresect) { + if (!roi.clipIfOverlaps(srcBounds)) { // no intersection between roi and the bounds of the other image return; } @@ -1258,13 +1234,11 @@ Image::pasteFrom(const Image & src, // only copy the intersection of roi, bounds and otherBounds RectI roi = srcRoi; - bool doInteresect = roi.intersect(dstBounds, &roi); - if (!doInteresect) { + if (!roi.clipIfOverlaps(dstBounds)) { // no intersection between roi and the bounds of this image return; } - doInteresect = roi.intersect(srcBounds, &roi); - if (!doInteresect) { + if (!roi.clipIfOverlaps(srcBounds)) { // no intersection between roi and the bounds of the other image return; } @@ -1332,13 +1306,11 @@ Image::pasteFrom(const Image & src, // only copy the intersection of roi, bounds and otherBounds RectI roi = srcRoi; - bool doInteresect = roi.intersect(dstBounds, &roi); - if (!doInteresect) { + if (!roi.clipIfOverlaps(dstBounds)) { // no intersection between roi and the bounds of this image return; } - doInteresect = roi.intersect(srcBounds, &roi); - if (!doInteresect) { + if (!roi.clipIfOverlaps(srcBounds)) { // no intersection between roi and the bounds of the other image return; } @@ -1414,8 +1386,7 @@ Image::fillForDepthForComponents(const RectI & roi_, assert( (getBitDepth() == eImageBitDepthByte && sizeof(PIX) == 1) || (getBitDepth() == eImageBitDepthShort && sizeof(PIX) == 2) || (getBitDepth() == eImageBitDepthFloat && sizeof(PIX) == 4) ); RectI roi = roi_; - bool doInteresect = roi.intersect(_bounds, &roi); - if (!doInteresect) { + if (!roi.clipIfOverlaps(_bounds)) { // no intersection between roi and the bounds of the image return; } @@ -1484,8 +1455,7 @@ Image::fill(const RectI & roi, if (getStorageMode() == eStorageModeGLTex) { RectI realRoI = roi; - bool doInteresect = roi.intersect(_bounds, &realRoI); - if (!doInteresect) { + if (!realRoI.clipIfOverlaps(_bounds)) { // no intersection between roi and the bounds of the image return; } @@ -1552,9 +1522,9 @@ Image::fillZero(const RectI& roi, } QWriteLocker k(&_entryLock); - RectI intersection; + const RectI intersection = roi.intersect(_bounds); - if ( !roi.intersect(_bounds, &intersection) ) { + if (intersection.isNull()) { return; } @@ -1854,7 +1824,7 @@ Image::halveRoIForDepth(const RectI & roi, RectI dstRoI; RectI srcRoI = roi; - srcRoI.intersect(srcBounds, &srcRoI); // intersect srcRoI with the region of definition + srcRoI.clipIfOverlaps(srcBounds); // intersect srcRoI with the region of definition #ifdef DEBUG_NAN assert(!checkForNaNsNoLock(srcRoI)); #endif @@ -2108,10 +2078,6 @@ Image::downscaleMipMap(const RectD& dstRod, assert(_bounds.x1 <= roi.x1 && roi.x2 <= _bounds.x2 && _bounds.y1 <= roi.y1 && roi.y2 <= _bounds.y2); double par = getPixelAspectRatio(); -// RectD roiCanonical; -// roi.toCanonical(fromLevel, par , dstRod, &roiCanonical); -// RectI dstRoI; -// roiCanonical.toPixelEnclosing(toLevel, par , &dstRoI); unsigned int downscaleLvls = toLevel - fromLevel; assert( !copyBitMap || _bitmap.getBitmap() ); @@ -2213,15 +2179,10 @@ Image::upscaleMipMapForDepth(const RectI & roi, assert(roi.x1 <= _bounds.x1 && _bounds.x2 <= roi.x2 && roi.y1 <= _bounds.y1 && _bounds.y2 <= roi.y2); - ///The source rectangle, intersected to this image region of definition in pixels - RectD roiCanonical; - roi.toCanonical(fromLevel, _par, getRoD(), &roiCanonical); - RectI dstRoi; - roiCanonical.toPixelEnclosing(toLevel, _par, &dstRoi); - const RectI & srcRoi = roi; - - dstRoi.intersect(output->_bounds, &dstRoi); //output may be a bit smaller than the upscaled RoI + // The source rectangle, intersected to this image region of definition in pixels and the output bounds. + RectI dstRoi = roi.toNewMipMapLevel(fromLevel, toLevel, _par, getRoD()); + dstRoi.clipIfOverlaps(output->_bounds); //output may be a bit smaller than the upscaled RoI int scale = 1 << (fromLevel - toLevel); assert( output->getComponents() == getComponents() ); @@ -2456,9 +2417,7 @@ void Image::premultInternal(const RectI& roi) { WriteAccess acc(this); - RectI renderWindow; - - roi.intersect(_bounds, &renderWindow); + const RectI renderWindow = roi.intersect(_bounds); assert(getComponentsCount() == 4); diff --git a/Engine/Image.h b/Engine/Image.h index 8bc85d304e..4449f5531c 100644 --- a/Engine/Image.h +++ b/Engine/Image.h @@ -685,8 +685,7 @@ class Image return; } QWriteLocker locker(&_entryLock); - RectI intersection; - _bounds.intersect(roi, &intersection); + const RectI intersection = _bounds.intersect(roi); _bitmap.markForRendered(intersection); } @@ -698,8 +697,7 @@ class Image return; } QWriteLocker locker(&_entryLock); - RectI intersection; - _bounds.intersect(roi, &intersection); + const RectI intersection = _bounds.intersect(roi); _bitmap.markForRendering(intersection); } @@ -711,8 +709,7 @@ class Image return; } QWriteLocker locker(&_entryLock); - RectI intersection; - _bounds.intersect(roi, &intersection); + const RectI intersection = _bounds.intersect(roi); _bitmap.clear(intersection); } diff --git a/Engine/ImageConvert.cpp b/Engine/ImageConvert.cpp index c3202f080a..77cb347f8a 100644 --- a/Engine/ImageConvert.cpp +++ b/Engine/ImageConvert.cpp @@ -138,9 +138,9 @@ Image::convertToFormatInternal_sameComps(const RectI & renderWindow, bool copyBitmap) { const RectI & r = srcImg._bounds; - RectI intersection; + const RectI intersection = renderWindow.intersect(r); - if ( !renderWindow.intersect(r, &intersection) ) { + if ( intersection.isNull() ) { return; } diff --git a/Engine/ImageCopyChannels.cpp b/Engine/ImageCopyChannels.cpp index fabf846443..8da69c8d1d 100644 --- a/Engine/ImageCopyChannels.cpp +++ b/Engine/ImageCopyChannels.cpp @@ -619,8 +619,7 @@ Image::copyUnProcessedChannels(const RectI& roi, assert( !originalImage || getBitDepth() == originalImage->getBitDepth() ); - RectI srcRoi; - roi.intersect(_bounds, &srcRoi); + const RectI srcRoi = roi.intersect(_bounds); if (getStorageMode() == eStorageModeGLTex) { assert(glContext); diff --git a/Engine/ImageMaskMix.cpp b/Engine/ImageMaskMix.cpp index 26425d07de..59bf73633b 100644 --- a/Engine/ImageMaskMix.cpp +++ b/Engine/ImageMaskMix.cpp @@ -208,8 +208,7 @@ Image::applyMaskMix(const RectI& roi, if (maskImg) { maskLock.reset( new QReadLocker(&maskImg->_entryLock) ); } - RectI realRoI; - roi.intersect(_bounds, &realRoI); + const RectI realRoI = roi.intersect(_bounds); assert( !originalImg || getBitDepth() == originalImg->getBitDepth() ); assert( !masked || !maskImg || maskImg->getComponents() == ImagePlaneDesc::getAlphaComponents() ); diff --git a/Engine/Knob.cpp b/Engine/Knob.cpp index d3c1510725..2c0cd87abb 100644 --- a/Engine/Knob.cpp +++ b/Engine/Knob.cpp @@ -381,7 +381,7 @@ struct KnobHelperPrivate KnobHelper* publicInterface; #ifdef DEBUG -#pragma message WARN("This should be a weak_ptr") +//#pragma message WARN("This should be a weak_ptr") #endif KnobHolder* holder; mutable QMutex labelMutex; diff --git a/Engine/KnobTypes.cpp b/Engine/KnobTypes.cpp index 199725f715..54c0ea0a14 100644 --- a/Engine/KnobTypes.cpp +++ b/Engine/KnobTypes.cpp @@ -976,7 +976,7 @@ bool BothAreSpaces(char lhs, char rhs) { return (lhs == rhs) && (lhs == ' '); } // 5- paren/bracket-insensitive match (for WriteFFmpeg's format and codecs) // 6- if the choice ends with " 1" try to match exactly everything before that (for formats with PAR=1, where the PAR was removed) // returns index if choice was matched, -1 if not matched -#pragma message WARN("choiceMatch() should be moved into filterKnobChoiceOptionCompat().") +//#pragma message WARN("choiceMatch() should be moved into filterKnobChoiceOptionCompat().") // TODO: choiceMatch() should be moved into filterKnobChoiceOptionCompat() // TODO: filterKnobChoiceOptionCompat() should be used everywhere instead of choiceMatch() int diff --git a/Engine/Lut.cpp b/Engine/Lut.cpp index 817d02f35b..f3aa4ba60b 100644 --- a/Engine/Lut.cpp +++ b/Engine/Lut.cpp @@ -171,7 +171,7 @@ static bool clip(RectI* what, const RectI & to) { - return what->intersect(to, what); + return what->clipIfOverlaps(to); } #ifdef DEAD_CODE diff --git a/Engine/Node.cpp b/Engine/Node.cpp index add92cdfdb..117aebe80a 100644 --- a/Engine/Node.cpp +++ b/Engine/Node.cpp @@ -3333,8 +3333,7 @@ Node::makePreviewImage(SequenceTime time, scale.y = scale.x; const double par = effect->getAspectRatio(-1); - RectI renderWindow; - rod.toPixelEnclosing(mipMapLevel, par, &renderWindow); + const RectI renderWindow = rod.toPixelEnclosing(mipMapLevel, par); NodePtr thisNode = shared_from_this(); RenderingFlagSetter flagIsRendering(thisNode); diff --git a/Engine/NodeMain.cpp b/Engine/NodeMain.cpp index 36feb9b5e5..fb03e30fb7 100644 --- a/Engine/NodeMain.cpp +++ b/Engine/NodeMain.cpp @@ -621,7 +621,7 @@ Node::Implementation::restoreUserKnobsRecursive(const std::list_choiceString; // first, try to get the id the easy way ( see choiceMatch() ) int id = isChoice->choiceRestorationId(choiceSerialized, optionID); -#pragma message WARN("TODO: choice id filters") +//#pragma message WARN("TODO: choice id filters") //if (id < 0) { // // no luck, try the filters // filterKnobChoiceOptionCompat(getPluginID(), serialization.getPluginMajorVersion(), serialization.getPluginMinorVersion(), projectInfos.vMajor, projectInfos.vMinor, projectInfos.vRev, serializedName, &optionID); diff --git a/Engine/Noise.cpp b/Engine/Noise.cpp index 0603a679c8..39a46e5abb 100644 --- a/Engine/Noise.cpp +++ b/Engine/Noise.cpp @@ -24,6 +24,7 @@ #include #endif #include +#include #include "Global/Macros.h" diff --git a/Engine/OSGLContext_wayland.cpp b/Engine/OSGLContext_wayland.cpp index 9f86dcfb3a..f09f19de76 100644 --- a/Engine/OSGLContext_wayland.cpp +++ b/Engine/OSGLContext_wayland.cpp @@ -716,6 +716,11 @@ OSGLContext_wayland::makeContextCurrent(const OSGLContext_wayland*) return false; } +bool +OSGLContext_wayland::threadHasACurrentContext() { + return false; +} + void OSGLContext_wayland::getGPUInfos(std::list&) { diff --git a/Engine/OSGLContext_win.cpp b/Engine/OSGLContext_win.cpp index f4d25f7d17..3665c4c03e 100644 --- a/Engine/OSGLContext_win.cpp +++ b/Engine/OSGLContext_win.cpp @@ -26,6 +26,7 @@ #include "OSGLContext_win.h" #ifdef __NATRON_WIN32__ +#include // std::cerr #include // stringstream #include // for Q_UNUSED diff --git a/Engine/OSGLContext_win.h b/Engine/OSGLContext_win.h index c36b50d173..862f8f65d2 100644 --- a/Engine/OSGLContext_win.h +++ b/Engine/OSGLContext_win.h @@ -29,6 +29,7 @@ #include "Global/Macros.h" #include "Global/GLIncludes.h" +#include "Engine/EngineFwd.h" #ifdef __NATRON_WIN32__ diff --git a/Engine/OfxClipInstance.cpp b/Engine/OfxClipInstance.cpp index 7f811d5980..a266a1b9bd 100644 --- a/Engine/OfxClipInstance.cpp +++ b/Engine/OfxClipInstance.cpp @@ -1383,11 +1383,11 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, // The bounds of the image at the moment we peak the rowBytes and the internal buffer pointer. // Note that when the ReadAccess, or WriteAccess object is released, the image may be resized afterwards (only bigger) - RectI pluginsSeenBounds; + const RectI bounds = internalImage->getBounds(); + const RectI pluginsSeenBounds = renderWindow.intersect(bounds); int dataSizeOf = getSizeOfForBitDepth( internalImage->getBitDepth() ); - if (isSrcImage) { // Some plug-ins need a local version of the input image because they modify it (e.g: ReMap). This is out of spec // and if it does so, it may modify the cached output of the node from which this input image comes from. @@ -1397,9 +1397,6 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, const bool copySrcToPluginLocalData = appPTR->isCopyInputImageForPluginRenderEnabled(); NATRON_NAMESPACE::Image::ReadAccessPtr access( new NATRON_NAMESPACE::Image::ReadAccess( internalImage.get() ) ); - // data ptr - const RectI bounds = internalImage->getBounds(); - renderWindow.intersect(bounds, &pluginsSeenBounds); const std::size_t srcRowSize = bounds.width() * nComps * dataSizeOf; // row bytes @@ -1408,8 +1405,6 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, if (storage == eStorageModeGLTex) { _imp->access = access; } else { - - if (!copySrcToPluginLocalData) { const unsigned char* ptr = access->pixelAt( pluginsSeenBounds.left(), pluginsSeenBounds.bottom() ); assert(ptr); @@ -1440,7 +1435,6 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, } } } else { - const RectI bounds = internalImage->getBounds(); const std::size_t srcRowSize = bounds.width() * nComps * dataSizeOf; // row bytes @@ -1448,9 +1442,6 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, NATRON_NAMESPACE::Image::WriteAccessPtr access( new NATRON_NAMESPACE::Image::WriteAccess( internalImage.get() ) ); - // data ptr - renderWindow.intersect(bounds, &pluginsSeenBounds); - if (storage != eStorageModeGLTex) { unsigned char* ptr = access->pixelAt( pluginsSeenBounds.left(), pluginsSeenBounds.bottom() ); assert(ptr); @@ -1475,8 +1466,7 @@ OfxImageCommon::OfxImageCommon(OFX::Host::ImageEffect::ImageBase* ofxImageBase, // " An image's region of definition, in *PixelCoordinates,* is the full frame area of the image plane that the image covers." // Image::getRoD() is in *CANONICAL* coordinates // OFX::Image RoD is in *PIXEL* coordinates - RectI pixelRod; - rod.toPixelEnclosing(mipMapLevel, internalImage->getPixelAspectRatio(), &pixelRod); + const RectI pixelRod = rod.toPixelEnclosing(mipMapLevel, internalImage->getPixelAspectRatio()); ofxImageBase->setIntProperty(kOfxImagePropRegionOfDefinition, pixelRod.left(), 0); ofxImageBase->setIntProperty(kOfxImagePropRegionOfDefinition, pixelRod.bottom(), 1); ofxImageBase->setIntProperty(kOfxImagePropRegionOfDefinition, pixelRod.right(), 2); diff --git a/Engine/OfxEffectInstance.cpp b/Engine/OfxEffectInstance.cpp index 22eff83043..2b36ae9d8c 100644 --- a/Engine/OfxEffectInstance.cpp +++ b/Engine/OfxEffectInstance.cpp @@ -756,7 +756,7 @@ OfxEffectInstance::tryInitializeOverlayInteracts() OFX::Host::Interact::Descriptor &interactDesc = paramToKnob->getInteractDesc(); interactDesc.getProperties().addProperties(interactDescProps); interactDesc.setEntryPoint(interactEntryPoint); -#pragma message WARN("FIXME: bitdepth and hasalpha are probably wrong") +//#pragma message WARN("FIXME: bitdepth and hasalpha are probably wrong") interactDesc.describe(/*bitdepthPerComponent=*/ 8, /*hasAlpha=*/ false); OfxParamOverlayInteractPtr overlayInteract( new OfxParamOverlayInteract( knob.get(), interactDesc, effectInstance()->getHandle()) ); knob->setCustomInteract(overlayInteract); @@ -1598,7 +1598,7 @@ OfxEffectInstance::getRegionsOfInterest(double time, Q_UNUSED(outputRoD); assert(renderWindow.x2 >= renderWindow.x1 && renderWindow.y2 >= renderWindow.y1); - assert((supportsRenderScaleMaybe() != eSupportsNo) || (scale.x == 1. && scale.y == 1.)); + assert(isSupportedRenderScale(supportsRenderScaleMaybe(), scale)); OfxStatus stat; @@ -1828,11 +1828,10 @@ OfxEffectInstance::isIdentity(double time, // isIdentity may be the first action with renderscale called on any effect. // it may have to check for render scale support. SupportsEnum supportsRS = supportsRenderScaleMaybe(); - bool scaleIsOne = (scale.x == 1. && scale.y == 1.); - if ( (supportsRS == eSupportsNo) && !scaleIsOne ) { - qDebug() << "isIdentity called with render scale != 1, but effect does not support render scale!"; + if (!isSupportedRenderScale(supportsRS, scale) ) { + qDebug() << "isIdentity called with an unsupported RenderScale!"; assert(false); - throw std::logic_error("isIdentity called with render scale != 1, but effect does not support render scale!"); + throw std::logic_error("isIdentity called with an unsupported RenderScale"); } unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); @@ -1863,7 +1862,7 @@ OfxEffectInstance::isIdentity(double time, stat = _imp->effect->isIdentityAction(inputTimeOfx, field, ofxRoI, scale, identityView, identityPlane, inputclip); } if (identityView != view || identityPlane != kFnOfxImagePlaneColour) { -#pragma message WARN("can Natron RB2-multiplane2 handle isIdentity across views and planes?") +//#pragma message WARN("can Natron RB2-multiplane2 handle isIdentity across views and planes?") // Natron 2 cannot handle isIdentity across planes stat = kOfxStatOK; } @@ -1944,11 +1943,7 @@ OfxEffectInstance::beginSequenceRender(double first, bool isOpenGLRender, const EffectInstance::OpenGLContextEffectDataPtr& glContextData) { - { - bool scaleIsOne = (scale.x == 1. && scale.y == 1.); - assert( !( (supportsRenderScaleMaybe() == eSupportsNo) && !scaleIsOne ) ); - Q_UNUSED(scaleIsOne); - } + assert(isSupportedRenderScale(supportsRenderScaleMaybe(), scale)); OfxStatus stat; unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); @@ -1990,11 +1985,7 @@ OfxEffectInstance::endSequenceRender(double first, bool isOpenGLRender, const EffectInstance::OpenGLContextEffectDataPtr& glContextData) { - { - bool scaleIsOne = (scale.x == 1. && scale.y == 1.); - assert( !( (supportsRenderScaleMaybe() == eSupportsNo) && !scaleIsOne ) ); - Q_UNUSED(scaleIsOne); - } + assert(isSupportedRenderScale(supportsRenderScaleMaybe(), scale)); OfxStatus stat; unsigned int mipMapLevel = Image::getLevelFromScale(scale.x); diff --git a/Engine/OfxImageEffectInstance.cpp b/Engine/OfxImageEffectInstance.cpp index 75d453a939..3e78fe085a 100644 --- a/Engine/OfxImageEffectInstance.cpp +++ b/Engine/OfxImageEffectInstance.cpp @@ -327,8 +327,7 @@ OfxImageEffectInstance::getProjectSize(double & xSize, pixelF.x2 = f.x2; pixelF.y1 = f.y1; pixelF.y2 = f.y2; - RectD canonicalF; - pixelF.toCanonical_noClipping(0, f.getPixelAspectRatio(), &canonicalF); + const RectD canonicalF = pixelF.toCanonical_noClipping(0, f.getPixelAspectRatio()); xSize = canonicalF.width(); ySize = canonicalF.height(); } @@ -350,8 +349,7 @@ OfxImageEffectInstance::getProjectOffset(double & xOffset, pixelF.x2 = f.x2; pixelF.y1 = f.y1; pixelF.y2 = f.y2; - RectD canonicalF; - pixelF.toCanonical_noClipping(0, f.getPixelAspectRatio(), &canonicalF); + const RectD canonicalF = pixelF.toCanonical_noClipping(0, f.getPixelAspectRatio()); xOffset = canonicalF.left(); yOffset = canonicalF.bottom(); } @@ -373,8 +371,7 @@ OfxImageEffectInstance::getProjectExtent(double & xSize, pixelF.x2 = f.x2; pixelF.y1 = f.y1; pixelF.y2 = f.y2; - RectD canonicalF; - pixelF.toCanonical_noClipping(0, f.getPixelAspectRatio(), &canonicalF); + const RectD canonicalF = pixelF.toCanonical_noClipping(0, f.getPixelAspectRatio()); xSize = canonicalF.right(); ySize = canonicalF.top(); } diff --git a/Engine/OfxParamInstance.cpp b/Engine/OfxParamInstance.cpp index 90bcad94e8..91facaf655 100644 --- a/Engine/OfxParamInstance.cpp +++ b/Engine/OfxParamInstance.cpp @@ -4831,7 +4831,7 @@ OfxParametricInstance::addControlPoint(int curveIndex, KeyframeTypeEnum interpolation = eKeyframeTypeSmooth; // a reasonable default // The initial curve for some plugins may be better with a specific interpolation. Unfortunately, the kOfxParametricSuiteV1 doesn't offer different interpolation methods #ifdef DEBUG -#pragma message WARN("This is a hack, we should extend the parametric suite to add derivatives infos") +//#pragma message WARN("This is a hack, we should extend the parametric suite to add derivatives infos") #endif if (effect) { if ( (effect->getPluginID() == PLUGINID_OFX_COLORCORRECT) || (effect->getPluginID() == PLUGINID_OFX_TIMEDISSOLVE) ) { diff --git a/Engine/OutputSchedulerThread.cpp b/Engine/OutputSchedulerThread.cpp index 0c52313886..c1dee7c0af 100644 --- a/Engine/OutputSchedulerThread.cpp +++ b/Engine/OutputSchedulerThread.cpp @@ -2301,9 +2301,7 @@ class DefaultRenderFrameRunnable components.push_back(*it2); } } - RectI renderWindow; - rod.toPixelEnclosing(scale, par, &renderWindow); - + const RectI renderWindow = rod.toPixelEnclosing(scale, par); AbortableRenderInfoPtr abortInfo = AbortableRenderInfo::create(true, 0); if (isAbortableThread) { @@ -2413,8 +2411,6 @@ DefaultScheduler::processFrame(const BufferedFrames& frames) OutputEffectInstancePtr effect = _effect.lock(); U64 hash = effect->getHash(); bool isProjectFormat; - RectD rod; - RectI roi; std::list components; { @@ -2447,9 +2443,9 @@ DefaultScheduler::processFrame(const BufferedFrames& frames) false, false, it->stats); - + RectD rod; ignore_result( effect->getRegionOfDefinition_public(hash, it->time, scale, it->view, &rod, &isProjectFormat) ); - rod.toPixelEnclosing(0, par, &roi); + const RectI roi = rod.toPixelEnclosing(0, par); RenderingFlagSetter flagIsRendering( effect->getNode() ); diff --git a/Engine/ParallelRenderArgs.cpp b/Engine/ParallelRenderArgs.cpp index fbeab27a94..8043e7ede9 100644 --- a/Engine/ParallelRenderArgs.cpp +++ b/Engine/ParallelRenderArgs.cpp @@ -260,10 +260,9 @@ EffectInstance::treeRecurseFunctor(bool isRenderFunctor, frameArgs->request->getFrameViewCanonicalRoI(f, viewIt->first, &roi); } - RectI inputRoIPixelCoords; const unsigned int upstreamMipMapLevel = useScaleOneInputs ? 0 : originalMipMapLevel; const RenderScale & upstreamScale = useScaleOneInputs ? scaleOne : scale; - roi.toPixelEnclosing(upstreamMipMapLevel, inputPar, &inputRoIPixelCoords); + const RectI inputRoIPixelCoords = roi.toPixelEnclosing(upstreamMipMapLevel, inputPar); std::map inputImgs; { @@ -381,8 +380,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, fvRequest->globalData.identityView = view; - RectI identityRegionPixel; - canonicalRenderWindow.toPixelEnclosing(mappedLevel, par, &identityRegionPixel); + const RectI identityRegionPixel = canonicalRenderWindow.toPixelEnclosing(mappedLevel, par); if ( (view != 0) && (viewInvariance == eViewInvarianceAllViewsInvariant) ) { fvRequest->globalData.isIdentity = true; @@ -414,7 +412,7 @@ EffectInstance::getInputsRoIsFunctor(bool useTransforms, ///Concatenate transforms if needed if (useTransforms) { fvRequest->globalData.transforms = std::make_shared(); -#pragma message WARN("TODO: can set draftRender properly here?") +//#pragma message WARN("TODO: can set draftRender properly here?") effect->tryConcatenateTransforms( time, /*draftRender=*/false, view, nodeRequest->mappedScale, fvRequest->globalData.transforms.get() ); } diff --git a/Engine/Project.cpp b/Engine/Project.cpp index b7a880ca43..4b30403bce 100644 --- a/Engine/Project.cpp +++ b/Engine/Project.cpp @@ -1190,7 +1190,7 @@ Project::getProjectDefaultFormat(Format *f) const ChoiceOption formatSpec = _imp->formatKnob->getActiveEntry(); // use the label here, because the id does not contain the format specifications. // see ProjectPrivate::generateStringFromFormat() -#pragma message WARN("TODO: can't we store the format somewhere instead of parsing the label???") +//#pragma message WARN("TODO: can't we store the format somewhere instead of parsing the label???") if ( !formatSpec.label.empty() ) { ProjectPrivate::generateFormatFromString(QString::fromUtf8( formatSpec.label.c_str() ), f); } else { diff --git a/Engine/ProjectPrivate.cpp b/Engine/ProjectPrivate.cpp index 462a32e17f..03932084a7 100644 --- a/Engine/ProjectPrivate.cpp +++ b/Engine/ProjectPrivate.cpp @@ -168,7 +168,7 @@ ProjectPrivate::restoreFromSerialization(const ProjectSerialization & obj, std::string optionID = choiceData->_choiceString; // first, try to get the id the easy way ( see choiceMatch() ) int id = isChoice->choiceRestorationId(choiceSerialized, optionID); -#pragma message WARN("TODO: choice id filters") +//#pragma message WARN("TODO: choice id filters") //if (id < 0) { // // no luck, try the filters // filterKnobChoiceOptionCompat(getPluginID(), serialization.getPluginMajorVersion(), serialization.getPluginMinorVersion(), projectInfos.vMajor, projectInfos.vMinor, projectInfos.vRev, serializedName, &optionID); diff --git a/Engine/ReadNode.cpp b/Engine/ReadNode.cpp index 7e1d247f19..4f86bb8f44 100644 --- a/Engine/ReadNode.cpp +++ b/Engine/ReadNode.cpp @@ -418,7 +418,7 @@ ReadNodePrivate::cloneGenericKnobs() std::string optionID = choiceData->_choiceString; // first, try to get the id the easy way ( see choiceMatch() ) int id = isChoice->choiceRestorationId(choiceSerialized, optionID); -#pragma message WARN("TODO: choice id filters") +//#pragma message WARN("TODO: choice id filters") //if (id < 0) { // // no luck, try the filters // filterKnobChoiceOptionCompat(getPluginID(), serialization.getPluginMajorVersion(), serialization.getPluginMinorVersion(), projectInfos.vMajor, projectInfos.vMinor, projectInfos.vRev, serializedName, &optionID); @@ -552,7 +552,7 @@ ReadNodePrivate::destroyReadNode() //This will remove the GUI of non generic parameters _publicInterface->recreateKnobs(true); -#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") +//#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") QMutexLocker k(&embeddedPluginMutex); if (embeddedPlugin) { @@ -793,7 +793,7 @@ ReadNodePrivate::createReadNode(bool throwErrors, //This will refresh the GUI with this Reader specific parameters _publicInterface->recreateKnobs(true); -#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") +//#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") KnobIPtr knob = node ? node->getKnobByName(kOfxImageEffectFileParamName) : _publicInterface->getKnobByName(kOfxImageEffectFileParamName); if (knob) { diff --git a/Engine/RectD.cpp b/Engine/RectD.cpp index 96a25afa61..5d8e67c0a9 100644 --- a/Engine/RectD.cpp +++ b/Engine/RectD.cpp @@ -33,28 +33,25 @@ NATRON_NAMESPACE_ENTER -void -RectD::toPixelEnclosing(const RenderScale & scale, - double par, - RectI *rect) const +RectI +RectD::toPixelEnclosing(const RenderScale& scale, + double par) const { - rect->x1 = std::floor(x1 * scale.x / par); - rect->y1 = std::floor(y1 * scale.y); - rect->x2 = std::ceil(x2 * scale.x / par); - rect->y2 = std::ceil(y2 * scale.y); + return RectI(std::floor(x1 * scale.x / par), + std::floor(y1 * scale.y), + std::ceil(x2 * scale.x / par), + std::ceil(y2 * scale.y)); } -void +RectI RectD::toPixelEnclosing(unsigned int mipMapLevel, - double par, - RectI *rect) const + double par) const { - double scale = 1. / (1 << mipMapLevel); - - rect->x1 = std::floor(x1 * scale / par); - rect->y1 = std::floor(y1 * scale); - rect->x2 = std::ceil(x2 * scale / par); - rect->y2 = std::ceil(y2 * scale); + const double scale = 1. / (1 << mipMapLevel); + return RectI(std::floor(x1 * scale / par), + std::floor(y1 * scale), + std::ceil(x2 * scale / par), + std::ceil(y2 * scale)); } NATRON_NAMESPACE_EXIT diff --git a/Engine/RectD.h b/Engine/RectD.h index 3c2f05ba6e..e33778ea8b 100644 --- a/Engine/RectD.h +++ b/Engine/RectD.h @@ -219,15 +219,19 @@ class RectD y2 = std::max(y2, t); } - /*intersection of two boxes*/ - bool intersect(const RectD & r, +private: + /** + * @brief Computes intersection of this rectangle and the one provided as a parameter, if they overlap. + * + * @param[in] r The rectangle to intersect with this rectangle. + * @param[out] intersection Updated to contain the intersection of the two rectangles if this method returns true. Otherwise left unmodified. + * @returns True if this rectangle and the one passed in are not null and overlap. + **/ + // Note: This is private to encourage the use of intersect() or clipIfOverlaps(). + bool intersectInternal(const RectD & r, RectD* intersection) const { - if ( isNull() || r.isNull() ) { - return false; - } - - if ( (x1 > r.x2) || (r.x1 > x2) || (y1 > r.y2) || (r.y1 > y2) ) { + if (!intersects(r)) { return false; } @@ -239,13 +243,36 @@ class RectD return true; } - bool intersect(double l, - double b, - double r, - double t, - RectD* intersection) const +public: + + /** + * @brief Computes the intersection of this rectangle and rect. + * + * @returns Intersection of the two rectangles if they overlap. If there is no overlap a null (i.e. default constructed) rectangle is returned. + **/ + RectD intersect(const RectD & rect) const + { + RectD intersection; + intersectInternal(rect, &intersection); + return intersection; + } + + RectD intersect(double l, + double b, + double r, + double t) const + { + return intersect(RectD(l, b, r, t)); + } + + /** + * @brief Updates this rectangle to the intersection rectangle if this rectangle overlaps with rect. If there is no overlap then this rectangle remains unchanged. + * + * @returns True if the rectangles overlap and this rectangle was clipped. + **/ + bool clipIfOverlaps(const RectD& rect) { - return intersect(RectD(l, b, r, t), intersection); + return intersectInternal(rect, this); } /// returns true if the rect passed as parameter is intersects this one @@ -307,13 +334,11 @@ class RectD #endif - void toPixelEnclosing(const RenderScale & scale, - double par, - RectI *rect) const; + RectI toPixelEnclosing(const RenderScale & scale, + double par) const; - void toPixelEnclosing(unsigned int mipMapLevel, - double par, - RectI *rect) const; + RectI toPixelEnclosing(unsigned int mipMapLevel, + double par) const; static void ofxRectDToRectD(const OfxRectD & r, RectD *ret) diff --git a/Engine/RectI.cpp b/Engine/RectI.cpp index 720d6edbc0..27a80e1908 100644 --- a/Engine/RectI.cpp +++ b/Engine/RectI.cpp @@ -114,25 +114,30 @@ std::vector RectI::splitIntoSmallerRects(int splitsCount) const return ret; } // RectI::splitIntoSmallerRects -void +RectD RectI::toCanonical(unsigned int thisLevel, double par, - const RectD & rod, - RectD *rect) const + const RectD& rod) const { - toCanonical_noClipping(thisLevel, par, rect); - rect->intersect(rod, rect); + RectD rect = toCanonical_noClipping(thisLevel, par); + rect.clipIfOverlaps(rod); + return rect; } -void +RectD RectI::toCanonical_noClipping(unsigned int thisLevel, - double par, - RectD *rect) const + double par) const { - rect->x1 = (x1 << thisLevel) * par; - rect->x2 = (x2 << thisLevel) * par; - rect->y1 = y1 << thisLevel; - rect->y2 = y2 << thisLevel; + return RectD((x1 << thisLevel) * par, + y1 << thisLevel, + (x2 << thisLevel) * par, + y2 << thisLevel); +} + +RectI +RectI::toNewMipMapLevel(unsigned int fromLevel, unsigned int toLevel, double par, const RectD& rod) const +{ + return toCanonical(fromLevel, par, rod).toPixelEnclosing(toLevel, par); } NATRON_NAMESPACE_EXIT diff --git a/Engine/RectI.h b/Engine/RectI.h index 3c605a3268..6220d5a643 100644 --- a/Engine/RectI.h +++ b/Engine/RectI.h @@ -174,8 +174,23 @@ class RectI return ret; } - void toCanonical(unsigned int thisLevel, double par, const RectD & rod, RectD *rect) const; - void toCanonical_noClipping(unsigned int thisLevel, double par, RectD *rect) const; + /** + * @brief Converts this rectangle to canonical coordinates and clips it if it intersects with the rod provided. + */ + RectD toCanonical(unsigned int thisLevel, double par, const RectD & rod) const; + + RectD toCanonical_noClipping(unsigned int thisLevel, double par) const; + + /** + * @brief Converts this rectangle to an equivalent one at a different mipmap level. + * + * @param fromLevel The mipmap level of this rectangle. + * @param toLevel The mipmap level we want to convert to. + * @param par The pixel aspect ratio for this rectangle. + * @param rod The region of definition to clip this rectangle to when converting it to canonical coordinates. + * + **/ + RectI toNewMipMapLevel(unsigned int fromLevel, unsigned int toLevel, double par, const RectD& rod) const; // the following should never be used: only canonical coordinates may be downscaled /** @@ -339,8 +354,17 @@ class RectI } } - /*intersection of two boxes*/ - bool intersect(const RectI & r, + +private: + /** + * @brief Computes intersection of this rectangle and the one provided as a parameter, if they overlap. + * + * @param[in] r The rectangle to intersect with this rectangle. + * @param[out] intersection Updated to contain the intersection of the two rectangles if this method returns true. Otherwise left unmodified. + * @returns True if this rectangle and the one passed in are not null and overlap. + **/ + // Note: This is private to encourage the use of intersect() or clipIfOverlaps(). + bool intersectInternal(const RectI & r, RectI* intersection) const { if ( !intersects(r) ) { @@ -359,13 +383,36 @@ class RectI return true; } - bool intersect(int x1_, - int y1_, - int x2_, - int y2_, - RectI* intersection) const +public: + + /** + * @brief Computes the intersection of this rectangle and rect. + * + * @returns Intersection of the two rectangles if they overlap. If there is no overlap a null (i.e. default constructed) rectangle is returned. + **/ + RectI intersect(const RectI & rect) const + { + RectI intersection; + intersectInternal(rect, &intersection); + return intersection; + } + + RectI intersect(int x1_, + int y1_, + int x2_, + int y2_) const + { + return intersect(RectI(x1_, y1_, x2_, y2_)); + } + + /** + * @brief Updates this rectangle to the intersection rectangle if this rectangle overlaps with rect. If there is no overlap then this rectangle remains unchanged. + * + * @returns True if the rectangles overlap and this rectangle was clipped. + **/ + bool clipIfOverlaps(const RectI& rect) { - return intersect(RectI(x1_, y1_, x2_, y2_), intersection); + return intersectInternal(rect, this); } /// returns true if the rect passed as parameter intersects this one diff --git a/Engine/RotoContext.cpp b/Engine/RotoContext.cpp index 874c74e891..8be90e4fc1 100644 --- a/Engine/RotoContext.cpp +++ b/Engine/RotoContext.cpp @@ -2540,9 +2540,7 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, getColor(time, shapeColor); ImagePtr source = *image; - RectI pixelPointsBbox; - pointsBbox.toPixelEnclosing(mipmapLevel, par, &pixelPointsBbox); - + const RectI pixelPointsBbox = pointsBbox.toPixelEnclosing(mipmapLevel, par); NodePtr node = getContext()->getNode(); ImageFieldingOrderEnum fielding = node->getEffectInstance()->getFieldingOrder(); @@ -2565,13 +2563,10 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, mipMapLevelChanged = true; RectD otherRoD = (*image)->getRoD(); - RectI oldBounds; - otherRoD.toPixelEnclosing( (*image)->getMipMapLevel(), par, &oldBounds ); + const RectI oldBounds = otherRoD.toPixelEnclosing( (*image)->getMipMapLevel(), par); RectD mergeRoD = pointsBbox; mergeRoD.merge(otherRoD); - RectI mergeBounds; - mergeRoD.toPixelEnclosing(mipmapLevel, par, &mergeBounds); - + const RectI mergeBounds = mergeRoD.toPixelEnclosing(mipmapLevel, par); //upscale the original image source.reset( new Image(components, @@ -2590,12 +2585,10 @@ RotoStrokeItem::renderSingleStroke(const RectD& pointsBbox, mipMapLevelChanged = true; RectD otherRoD = (*image)->getRoD(); - RectI oldBounds; - otherRoD.toPixelEnclosing( (*image)->getMipMapLevel(), par, &oldBounds ); + const RectI oldBounds = otherRoD.toPixelEnclosing( (*image)->getMipMapLevel(), par ); RectD mergeRoD = pointsBbox; mergeRoD.merge(otherRoD); - RectI mergeBounds; - mergeRoD.toPixelEnclosing(mipmapLevel, par, &mergeBounds); + const RectI mergeBounds = mergeRoD.toPixelEnclosing(mipmapLevel, par); //downscale the original image source.reset( new Image(components, @@ -2814,9 +2807,7 @@ RotoDrawableItem::renderMaskFromStroke(const ImagePlaneDesc& components, rotoBbox.merge(rotoNodeSrcRod); } - RectI pixelRod; - rotoBbox.toPixelEnclosing(mipmapLevel, 1., &pixelRod); - + const RectI pixelRod = rotoBbox.toPixelEnclosing(mipmapLevel, 1.); ImageParamsPtr params = Image::makeParams( rotoBbox, pixelRod, diff --git a/Engine/RotoContextPrivate.h b/Engine/RotoContextPrivate.h index 2c3751c52a..aad27495ee 100644 --- a/Engine/RotoContextPrivate.h +++ b/Engine/RotoContextPrivate.h @@ -1138,7 +1138,7 @@ struct RotoDrawableItemPrivate int defVal = 0; { std::vector choices; -#pragma message WARN("TODO: better sync with OFX filter param") +//#pragma message WARN("TODO: better sync with OFX filter param") // must be kept in sync with ofxsFilter.h choices.push_back(ChoiceOption("impulse", kFilterImpulse, tr(kFilterImpulseHint).toStdString())); choices.push_back(ChoiceOption("box", kFilterBox, tr(kFilterBoxHint).toStdString())); @@ -2081,7 +2081,7 @@ struct RotoContextPrivate shutterType->setDefaultValue(0); { std::vector options; -#pragma message WARN("TODO: sync with ofxsShutter") +//#pragma message WARN("TODO: sync with ofxsShutter") options.push_back(ChoiceOption("centered", "Centered", tr(kRotoShutterOffsetCenteredHint).toStdString())); options.push_back(ChoiceOption("start", "Start", tr(kRotoShutterOffsetStartHint).toStdString())); options.push_back(ChoiceOption("end", "End", tr(kRotoShutterOffsetEndHint).toStdString())); @@ -2139,7 +2139,7 @@ struct RotoContextPrivate globalShutterType->setHintToolTip( tr(kRotoShutterOffsetTypeParamHint) ); globalShutterType->setDefaultValue(0); { -#pragma message WARN("TODO: sync with ofxsShutter") +//#pragma message WARN("TODO: sync with ofxsShutter") std::vector options, helps; options.push_back("Centered"); helps.push_back(kRotoShutterOffsetCenteredHint); diff --git a/Engine/RotoPaint.cpp b/Engine/RotoPaint.cpp index 8ab09ebc28..7879edd999 100644 --- a/Engine/RotoPaint.cpp +++ b/Engine/RotoPaint.cpp @@ -1455,8 +1455,7 @@ RotoPaint::isIdentity(double time, bool isProjectFormat; StatusEnum s = maskInput->getRegionOfDefinition_public(maskInput->getRenderHash(), time, scale, view, &maskRod, &isProjectFormat); Q_UNUSED(s); - RectI maskPixelRod; - maskRod.toPixelEnclosing(scale, getAspectRatio(ROTOPAINT_MASK_INPUT_INDEX), &maskPixelRod); + const RectI maskPixelRod = maskRod.toPixelEnclosing(scale, getAspectRatio(ROTOPAINT_MASK_INPUT_INDEX)); if ( !maskPixelRod.intersects(roi) ) { *inputTime = time; *inputNb = 0; @@ -1628,8 +1627,8 @@ RotoPaint::render(const RenderActionArgs& args) plane->second->fillZero(dRect); if ( bgImg->getComponents() != plane->second->getComponents() ) { - RectI intersection; - if (args.roi.intersect(bgImg->getBounds(), &intersection)) { + const RectI intersection = args.roi.intersect(bgImg->getBounds()); + if (!intersection.isNull()) { bgImg->convertToFormat( intersection, getApp()->getDefaultColorSpaceForBitDepth( rotoImagesIt->second->getBitDepth() ), getApp()->getDefaultColorSpaceForBitDepth( plane->second->getBitDepth() ), 3 diff --git a/Engine/RotoSmear.cpp b/Engine/RotoSmear.cpp index d30258d122..32e90791f3 100644 --- a/Engine/RotoSmear.cpp +++ b/Engine/RotoSmear.cpp @@ -128,8 +128,7 @@ RotoSmear::isIdentity(double time, NodePtr node = getNode(); node->getPaintStrokeRoD(time, &maskRod); - RectI maskPixelRod; - maskRod.toPixelEnclosing(scale, getAspectRatio(-1), &maskPixelRod); + const RectI maskPixelRod = maskRod.toPixelEnclosing(scale, getAspectRatio(-1)); if ( !maskPixelRod.intersects(roi) ) { *inputTime = time; *inputNb = 0; @@ -153,9 +152,7 @@ renderSmearDot(const unsigned char* maskData, { /// First copy the portion of the image around the previous dot into tmpBuf RectD prevDotRoD(prev.x - brushSizePixels / 2., prev.y - brushSizePixels / 2., prev.x + brushSizePixels / 2., prev.y + brushSizePixels / 2.); - RectI prevDotBounds; - - prevDotRoD.toPixelEnclosing(0, outputImage->getPixelAspectRatio(), &prevDotBounds); + const RectI prevDotBounds = prevDotRoD.toPixelEnclosing(0, outputImage->getPixelAspectRatio()); ImagePtr tmpBuf( new Image(outputImage->getComponents(), prevDotRoD, prevDotBounds, diff --git a/Engine/TrackMarker.cpp b/Engine/TrackMarker.cpp index b1b08f03b7..6f3a946e74 100644 --- a/Engine/TrackMarker.cpp +++ b/Engine/TrackMarker.cpp @@ -1152,15 +1152,12 @@ TrackMarker::getMarkerImageRoI(int time) const roiCanonical.x2 = swTr->getValueAtTime(time, 0) + center.x + offset.x; roiCanonical.y2 = swTr->getValueAtTime(time, 1) + center.y + offset.y; - RectI roi; NodePtr node = getContext()->getNode(); NodePtr input = node->getInput(0); if (!input) { return RectI(); } - roiCanonical.toPixelEnclosing(mipmapLevel, input ? input->getEffectInstance()->getAspectRatio(-1) : 1., &roi); - - return roi; + return roiCanonical.toPixelEnclosing(mipmapLevel, input ? input->getEffectInstance()->getAspectRatio(-1) : 1.); } std::pair diff --git a/Engine/TrackerFrameAccessor.cpp b/Engine/TrackerFrameAccessor.cpp index c07f03670f..e2ec226569 100644 --- a/Engine/TrackerFrameAccessor.cpp +++ b/Engine/TrackerFrameAccessor.cpp @@ -347,7 +347,7 @@ TrackerFrameAccessor::GetImage(int /*clip*/, return (mv::FrameAccessor::Key)0; } double par = effect->getAspectRatio(-1); - precomputedRoD.toPixelEnclosing( (unsigned int)downscale, par, &roi ); + roi = precomputedRoD.toPixelEnclosing( (unsigned int)downscale, par); } std::list components; @@ -400,8 +400,8 @@ TrackerFrameAccessor::GetImage(int /*clip*/, assert( !planes.empty() ); const ImagePtr& sourceImage = planes.begin()->second; RectI sourceBounds = sourceImage->getBounds(); - RectI intersectedRoI; - if ( !roi.intersect(sourceBounds, &intersectedRoI) ) { + const RectI intersectedRoI = roi.intersect(sourceBounds); + if ( intersectedRoI.isNull() ) { #ifdef TRACE_LIB_MV qDebug() << QThread::currentThread() << "FrameAccessor::GetImage():" << "RoI does not intersect the source image bounds (RoI x1=" << roi.x1 << "y1=" << roi.y1 << "x2=" << roi.x2 << "y2=" << roi.y2 << ")"; @@ -494,7 +494,7 @@ TrackerFrameAccessor::GetMaskForTrack(int clip, // https://developer.blender.org/rBb0015686e2e48a384a0b2a03a75f6daaad7271c0 // -#pragma message WARN("TODO: implement TrackerFrameAccessor::GetMaskForTrack") +//#pragma message WARN("TODO: implement TrackerFrameAccessor::GetMaskForTrack") return NULL; } diff --git a/Engine/TrackerNodeInteract.cpp b/Engine/TrackerNodeInteract.cpp index c6d69327ec..fd129e6854 100644 --- a/Engine/TrackerNodeInteract.cpp +++ b/Engine/TrackerNodeInteract.cpp @@ -725,8 +725,7 @@ TrackerNodeInteract::drawSelectedMarkerKeyframes(const std::pair textureRectCanonical.y1 = textureRectCanonical.y2 - height; - RectD canonicalSearchWindow; - texRect.toCanonical_noClipping(0, texRect.par, &canonicalSearchWindow); + const RectD canonicalSearchWindow = texRect.toCanonical_noClipping(0, texRect.par); //Remove any offset to the center to see the marker in the magnification window double xCenterPercent = (center.x - canonicalSearchWindow.x1 + offset.x) / (canonicalSearchWindow.x2 - canonicalSearchWindow.x1); @@ -899,8 +898,7 @@ TrackerNodeInteract::drawSelectedMarkerTexture(const std::pair& texCoords.x1 = texCoords.y1 = 0.; texCoords.x2 = texCoords.y2 = 1.; - RectD canonicalSearchWindow; - texRect.toCanonical_noClipping(0, texRect.par, &canonicalSearchWindow); + const RectD canonicalSearchWindow = texRect.toCanonical_noClipping(0, texRect.par); Point centerPoint, innerTopLeft, innerTopRight, innerBtmLeft, innerBtmRight; @@ -1157,7 +1155,7 @@ TrackerNodeInteract::convertImageTosRGBOpenGLTexture(const ImagePtr& image, if (image) { bounds = image->getBounds(); - renderWindow.intersect(bounds, &roi); + roi = renderWindow.intersect(bounds); } else { bounds = renderWindow; roi = bounds; diff --git a/Engine/ViewerInstance.cpp b/Engine/ViewerInstance.cpp index 9bb0d65669..d948953463 100644 --- a/Engine/ViewerInstance.cpp +++ b/Engine/ViewerInstance.cpp @@ -962,7 +962,7 @@ ViewerInstance::getRegionsOfInterest(double /*time*/, ViewIdx /*view*/, RoIMap* ret) { -#pragma message WARN("2.2: fix this and only add RoI for thread local input") +//#pragma message WARN("2.2: fix this and only add RoI for thread local input") for (int i = 0; i < getNInputs(); ++i) { EffectInstancePtr input = getInput(i); if (input) { @@ -998,10 +998,9 @@ ViewerInstance::getViewerRoIAndTexture(const RectD& rod, QMutexLocker k(&_imp->viewerParamsMutex); partialRects = _imp->partialUpdateRects; for (std::list::iterator it = partialRects.begin(); it != partialRects.end(); ++it) { - RectI pixelRect; - it->toPixelEnclosing(mipmapLevel, outArgs->params->pixelAspectRatio, &pixelRect); + RectI pixelRect = it->toPixelEnclosing(mipmapLevel, outArgs->params->pixelAspectRatio); ///Intersect to the RoI - if ( pixelRect.intersect(outArgs->params->roi, &pixelRect) ) { + if ( pixelRect.clipIfOverlaps(outArgs->params->roi) ) { tile.rect.set(pixelRect); tile.rectRounded = pixelRect; tile.rect.closestPo2 = 1 << mipmapLevel; @@ -1400,8 +1399,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, if (useTLS) { - RectD canonicalRoi; - roi.toCanonical(inArgs.params->mipMapLevel, inArgs.params->pixelAspectRatio, inArgs.params->rod, &canonicalRoi); + const RectD canonicalRoi = roi.toCanonical(inArgs.params->mipMapLevel, inArgs.params->pixelAspectRatio, inArgs.params->rod); FrameRequestMap requestPassData; StatusEnum stat = EffectInstance::computeRequestPass(inArgs.params->time, view, inArgs.params->mipMapLevel, canonicalRoi, getNode(), requestPassData); @@ -1503,7 +1501,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, stats->setGlobalRenderInfosForNode(getNode(), inArgs.params->rod, inArgs.params->srcPremult, channelsRendered, true, true, inArgs.params->mipMapLevel); } -#pragma message WARN("Implement Viewer so it accepts OpenGL Textures in input") +//#pragma message WARN("Implement Viewer so it accepts OpenGL Textures in input") BufferableObjectPtrList partialUpdateObjects; for (std::size_t rectIndex = 0; rectIndex < splitRoi.size(); ++rectIndex) { //AlphaImage will only be set when displaying the Matte overlay @@ -1609,7 +1607,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, //Make sure the viewer does not render something outside the bounds RectI viewerRenderRoI; if (colorImage) { - splitRoi[rectIndex].intersect(colorImage->getBounds(), &viewerRenderRoI); + viewerRenderRoI = splitRoi[rectIndex].intersect(colorImage->getBounds()); } UpdateViewerParamsPtr updateParams; @@ -1673,8 +1671,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, //Overwrite the RoI to only the last portion rendered RectD lastPaintBbox = getApp()->getLastPaintStrokeBbox(); - - lastPaintBbox.toPixelEnclosing(updateParams->mipMapLevel, par, &lastPaintBboxPixel); + lastPaintBboxPixel = lastPaintBbox.toPixelEnclosing(updateParams->mipMapLevel, par); //The last buffer must be valid @@ -1702,19 +1699,6 @@ ViewerInstance::renderViewer_internal(ViewIdx view, return eViewerRenderRetCodeFail; } - /*UpdateViewerParams::CachedTile tileCopy = tile; - //If we are painting, only render the portion needed - if ( !lastPaintBboxPixel.isNull() ) { - tileCopy.rect.intersect(lastPaintBboxPixel, &tileCopy.rect); - std::size_t pixelSize = 4; - if (updateParams->depth == eImageBitDepthFloat) { - pixelSize *= sizeof(float); - } - std::size_t dstRowSize = tileCopy.rect.width() * pixelSize; - tileCopy.bytesCount = tileCopy.rect.height() * dstRowSize; - } - - unCachedTiles.push_back(tileCopy);*/ unCachedTiles.push_back(tile); } _imp->lastRenderParams[updateParams->textureIndex] = updateParams; @@ -1737,12 +1721,9 @@ ViewerInstance::renderViewer_internal(ViewIdx view, // For the viewer, we need the enclosing rectangle to avoid black borders. // Do this here to avoid infinity values. - RectI bounds; - updateParams->rod.toPixelEnclosing(updateParams->mipMapLevel, updateParams->pixelAspectRatio, &bounds); + const RectI bounds = updateParams->rod.toPixelEnclosing(updateParams->mipMapLevel, updateParams->pixelAspectRatio); - RectI tileBounds; - tileBounds.x1 = tileBounds.y1 = 0; - tileBounds.x2 = tileBounds.y2 = inArgs.params->tileSize; + const RectI tileBounds(0, 0, inArgs.params->tileSize, inArgs.params->tileSize); assert(!tileBounds.isNull()); if (tileBounds.isNull()) { return eViewerRenderRetCodeRedraw; @@ -1821,7 +1802,7 @@ ViewerInstance::renderViewer_internal(ViewIdx view, //If we are painting, only render the portion needed if ( !lastPaintBboxPixel.isNull() ) { - lastPaintBboxPixel.intersect(viewerRenderRoI, &viewerRenderRoI); + viewerRenderRoI.clipIfOverlaps(lastPaintBboxPixel); } TimeLapsePtr viewerRenderTimeRecorder; @@ -2899,8 +2880,6 @@ ViewerInstance::ViewerInstancePrivate::updateViewer(UpdateViewerParamsPtr params doUpdate = false; }*/ if (doUpdate) { - /*RectI bounds; - params->rod.toPixelEnclosing(params->mipMapLevel, params->pixelAspectRatio, &bounds);*/ assert( (params->isPartialRect && params->tiles.size() == 1) || !params->isPartialRect ); diff --git a/Engine/WriteNode.cpp b/Engine/WriteNode.cpp index ff5d790e87..47834783b9 100644 --- a/Engine/WriteNode.cpp +++ b/Engine/WriteNode.cpp @@ -381,7 +381,7 @@ WriteNodePrivate::cloneGenericKnobs() std::string optionID = choiceData->_choiceString; // first, try to get the id the easy way ( see choiceMatch() ) int id = isChoice->choiceRestorationId(choiceSerialized, optionID); -#pragma message WARN("TODO: choice id filters") +//#pragma message WARN("TODO: choice id filters") //if (id < 0) { // // no luck, try the filters // filterKnobChoiceOptionCompat(getPluginID(), serialization.getPluginMajorVersion(), serialization.getPluginMinorVersion(), projectInfos.vMajor, projectInfos.vMinor, projectInfos.vRev, serializedName, &optionID); @@ -513,7 +513,7 @@ WriteNodePrivate::destroyWriteNode() //This will remove the GUI of non generic parameters _publicInterface->recreateKnobs(true); -#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") +//#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") if (embeddedNode) { embeddedNode->destroyNode(true, false); @@ -878,7 +878,7 @@ WriteNodePrivate::createWriteNode(bool throwErrors, //This will refresh the GUI with this Reader specific parameters _publicInterface->recreateKnobs(true); -#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") +//#pragma message WARN("TODO: if Gui, refresh pluginID, version, help tooltip in DockablePanel to reflect embedded node change") KnobIPtr knob = writeNode ? writeNode->getKnobByName(kOfxImageEffectFileParamName) : _publicInterface->getKnobByName(kOfxImageEffectFileParamName); if (knob) { diff --git a/Engine/typesystem_engine.xml b/Engine/typesystem_engine.xml index 8d60b66bc0..e01264e84c 100644 --- a/Engine/typesystem_engine.xml +++ b/Engine/typesystem_engine.xml @@ -236,37 +236,9 @@ - - + + - - - - - - - - - RectI t; - %CPPSELF.%FUNCTION_NAME(%1,&t); - %PYARG_0 = %CONVERTTOPYTHON[RectI](t); - return %PYARG_0; - - - - - - - - - - - RectI t; - %CPPSELF.%FUNCTION_NAME(%1,%2,%3,%4,&t); - %PYARG_0 = %CONVERTTOPYTHON[RectI](t); - return %PYARG_0; - - @@ -737,36 +709,7 @@ - - - - - - - - - - RectD t; - %CPPSELF.%FUNCTION_NAME(%1,&t); - %PYARG_0 = %CONVERTTOPYTHON[RectD](t); - return %PYARG_0; - - - - - - - - - - - RectD t; - %CPPSELF.%FUNCTION_NAME(%1,%2,%3,%4,&t); - %PYARG_0 = %CONVERTTOPYTHON[RectD](t); - return %PYARG_0; - - - + diff --git a/Gui/CMakeLists.txt b/Gui/CMakeLists.txt index c45cdb46d8..86677df158 100644 --- a/Gui/CMakeLists.txt +++ b/Gui/CMakeLists.txt @@ -22,19 +22,20 @@ file(GLOB NatronGui_HEADERS *.h) file(GLOB NatronGui_SOURCES *.cpp) set(PYGUI_OUT ${CMAKE_CURRENT_BINARY_DIR}/Qt${QT_VERSION_MAJOR}) -set(PYGUI_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIRS} ${PYSIDE_INCLUDE_DIRS}/QtCore +set(PYGUI_INCLUDE_DIRS . .. ../Engine ../Global ../libs/OpenFX/include) +list(APPEND PYGUI_INCLUDE_DIRS ${PYSIDE_INCLUDE_DIRS} ${PYSIDE_INCLUDE_DIRS}/QtCore ${PYSIDE_INCLUDE_DIRS}/QtGui ${PYSIDE_INCLUDE_DIRS}/QtWidgets) list(APPEND PYGUI_INCLUDE_DIRS ${QTCORE_INCLUDE_DIRS} ${QTGUI_INCLUDE_DIRS} ${QTWIDGETS_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) -list(JOIN PYGUI_INCLUDE_DIRS ":" PYGUI_INCS) +list(TRANSFORM PYGUI_INCLUDE_DIRS PREPEND "-I" OUTPUT_VARIABLE PYGUI_INCS) set(PYGUI_HEADER PySide2_Gui_Python.h) set(POST_SHIBOKEN ../tools/utils/runPostShiboken2.sh) set(shiboken_args "--enable-parent-ctor-heuristic" "--use-isnull-as-nb_nonzero" "--avoid-protected-hack" "--enable-pyside-extensions" - "-I.:..:../Engine:../Global:../libs/OpenFX/include:${PYGUI_INCS}" - "-T../Engine:${PYSIDE_TYPESYSTEMS}" "--output-directory=${PYGUI_OUT}" + ${PYGUI_INCS} + "-T../Engine" "-T${PYSIDE_TYPESYSTEMS}" "--output-directory=${PYGUI_OUT}" "${PYGUI_HEADER}" "typesystem_natronGui.xml") if(APPLE) list(APPEND shiboken_args -I${Qt5_DIR}/../../../include) diff --git a/Gui/DocumentationManager.cpp b/Gui/DocumentationManager.cpp index c8ccaa4a70..ef0f429941 100644 --- a/Gui/DocumentationManager.cpp +++ b/Gui/DocumentationManager.cpp @@ -345,7 +345,7 @@ DocumentationManager::handler(QHttpRequest *req, html = parser(html, docDir); body = html.toUtf8(); } else if ( page == QString::fromUtf8("_group.html") ) { -#pragma message WARN("TODO: produce HTML from file templates") +//#pragma message WARN("TODO: produce HTML from file templates") // TODO: we should really read and parse _group.html or _groupChannel.html and just replace the relevant sections QString html; QString group; diff --git a/Gui/DopeSheetView.cpp b/Gui/DopeSheetView.cpp index 6ed9d80b6f..ba3e343937 100644 --- a/Gui/DopeSheetView.cpp +++ b/Gui/DopeSheetView.cpp @@ -1984,7 +1984,7 @@ DopeSheetViewPrivate::computeRetimeRange(DSNode *retimer) FrameRange range; #ifdef DEBUG -#pragma message WARN("only considering first view") +//#pragma message WARN("only considering first view") #endif { const FrameRangesMap& rangeFirst = framesFirst[0]; diff --git a/Gui/FileTypeMainWindow_win.h b/Gui/FileTypeMainWindow_win.h index d3525e9466..197919b171 100644 --- a/Gui/FileTypeMainWindow_win.h +++ b/Gui/FileTypeMainWindow_win.h @@ -121,7 +121,7 @@ class DocumentWindow * Creates a DocumentWindow with a given @arg parent and @arg flags. */ explicit DocumentWindow(QWidget* parent = 0, - Qt::WindowFlags flags = 0); + Qt::WindowFlags flags = Qt::WindowFlags()); /** * Destructor @@ -230,8 +230,8 @@ class DocumentWindow */ void registerCommand(const QString& command, const QString& documentId, - const QString cmdLineArg = QString::null, - const QString ddeCommand = QString::null); + const QString cmdLineArg = QString(), + const QString ddeCommand = QString()); /** * Call this method to enable the user to open data files associated with your application @@ -262,7 +262,7 @@ class DocumentWindow /** * Sets specified value in the registry under HKCU\Software\Classes, which is mapped to HKCR then. */ - bool SetHkcrUserRegKey(QString key, const QString& value, const QString& valueName = QString::null); + bool SetHkcrUserRegKey(QString key, const QString& value, const QString& valueName = QString()); /** * this method is called to do the DDE command handling. It does argument splitting and then calls diff --git a/Gui/Gui40.cpp b/Gui/Gui40.cpp index e0a372c4f9..f9aa6c2306 100644 --- a/Gui/Gui40.cpp +++ b/Gui/Gui40.cpp @@ -642,7 +642,8 @@ Gui::debugImage(const Image* image, if ( roi.isNull() ) { renderWindow = bounds; } else { - if ( !roi.intersect(bounds, &renderWindow) ) { + renderWindow = roi.intersect(bounds); + if ( renderWindow.isNull() ) { qDebug() << "The RoI does not intersect the bounds of the image."; return; diff --git a/Gui/Histogram.cpp b/Gui/Histogram.cpp index cbc4e9ce67..a4271f25ca 100644 --- a/Gui/Histogram.cpp +++ b/Gui/Histogram.cpp @@ -1013,7 +1013,7 @@ HistogramPrivate::computeHistogram(Histogram::DisplayModeEnum channel) GLenum attachment = colorAttachmentFromDisplayMode(channel); #ifdef DEBUG -#pragma message WARN("TODO: ave currently bound VA, Buffer, and bound texture") +//#pragma message WARN("TODO: ave currently bound VA, Buffer, and bound texture") #endif /*binding the VAO holding managing the VBO*/ glBindVertexArray(vaoID); diff --git a/Gui/NodeGraph10.cpp b/Gui/NodeGraph10.cpp index 6d38c6200d..0decd50bbe 100644 --- a/Gui/NodeGraph10.cpp +++ b/Gui/NodeGraph10.cpp @@ -273,7 +273,7 @@ NodeGraph::mousePressEvent(QMouseEvent* e) if ( ( (nearbyItemCode == eNearbyItemNode) || (nearbyItemCode == eNearbyItemBackdropFrame) ) && groupEdited ) { assert(nearbyNode); -#pragma message WARN("TODO: if control is held, select all the nodes above, see https://github.com/NatronGitHub/Natron/issues/97") +//#pragma message WARN("TODO: if control is held, select all the nodes above, see https://github.com/NatronGitHub/Natron/issues/97") NodeGuiPtr selectedNode = nearbyNode->shared_from_this(); didSomething = true; diff --git a/Gui/ProjectGui.cpp b/Gui/ProjectGui.cpp index 3cabbcf93b..1278e9e5f4 100644 --- a/Gui/ProjectGui.cpp +++ b/Gui/ProjectGui.cpp @@ -242,8 +242,7 @@ AddFormatDialog::onCopyFromViewer() RectD f = tab->getViewer()->getRoD(0); RectD canonicalFormat = tab->getViewer()->getCanonicalFormat(0); double par = tab->getViewer()->getPAR(0); - RectI format; - canonicalFormat.toPixelEnclosing(0, par, &format); + const RectI format = canonicalFormat.toPixelEnclosing(0, par); _widthSpinBox->setValue( format.width() ); _heightSpinBox->setValue( format.height() ); _pixelAspectSpinBox->setValue(par); diff --git a/Gui/Resources/Stylesheets/mainstyle.qss b/Gui/Resources/Stylesheets/mainstyle.qss index 54be1e3bab..75c9185fb6 100644 --- a/Gui/Resources/Stylesheets/mainstyle.qss +++ b/Gui/Resources/Stylesheets/mainstyle.qss @@ -18,21 +18,18 @@ QLabel { color: %5; } +Label[altered="true"], +Natron--Label[altered="true"] { color: %10; } +Label[altered="false"], +Natron--Label[altered="false"] { color: %5; } - - - - -Label[altered="true"] { color: %10; } -Label[altered="false"] { color: %5; } - - - -NodeSettingsPanel[_selected="true"] { +NodeSettingsPanel[_selected="true"], +Natron--NodeSettingsPanel[_selected="true"] { border:1px solid white; border-radius: 2px; } -NodeSettingsPanel[_selected="false"] { +NodeSettingsPanel[_selected="false"], +Natron--NodeSettingsPanel[_selected="false"] { border:1px solid black; border-radius: 2px; } @@ -155,7 +152,6 @@ QScrollBar::sub-line:horizontal { subcontrol-origin: margin; } - QTreeView,QListView,QHeaderView { color: %5; background-color: %3; @@ -196,7 +192,8 @@ QHeaderView:section { selection-background-color: %1; /* same as selection-color??? */ } -ComboBox { +ComboBox, +Natron--ComboBox { border-radius: 2px; border: 1px solid black; } @@ -204,72 +201,84 @@ ComboBox { /*See http://doc.qt.io/qt-5/stylesheet-syntax.html for classes in namespaces*/ /*Basic background: No multiple selection, no animation, no sunken style*/ -ClickableLabel[dirty="false"][animation="0"][sunkenStyle="false"]{ +ClickableLabel[dirty="false"][animation="0"][sunkenStyle="false"], +Natron--ClickableLabel[dirty="false"][animation="0"][sunkenStyle="false"] { background-color: %2; } /*Basic background: No multiple selection, no animation but sunken style*/ -ClickableLabel[dirty="false"][animation="0"][sunkenStyle="true"]{ +ClickableLabel[dirty="false"][animation="0"][sunkenStyle="true"], +Natron--ClickableLabel[dirty="false"][animation="0"][sunkenStyle="true"] { background-color: %3; } /*Multiple selection always have a black background*/ -ClickableLabel[dirty="true"]{ +ClickableLabel[dirty="true"], +Natron--ClickableLabel[dirty="true"] { background-color: black; } /*No multiple selection and interpolated*/ -ClickableLabel[dirty="false"][animation="1"]{ +ClickableLabel[dirty="false"][animation="1"], +Natron--ClickableLabel[dirty="false"][animation="1"] { background-color: %6; } /*Multiple selection and interpolated: change text color instead*/ -ClickableLabel[dirty="true"][animation="1"] { +ClickableLabel[dirty="true"][animation="1"], +Natron--ClickableLabel[dirty="true"][animation="1"] { color: %6; } /*No multiple selection and keyframe*/ -ClickableLabel[dirty="false"][animation="2"]{ +ClickableLabel[dirty="false"][animation="2"], +Natron--ClickableLabel[dirty="false"][animation="2"] { background-color: %7; } /*Multiple selection and keyframe: change text color instead*/ -ClickableLabel[dirty="true"][animation="2"] { +ClickableLabel[dirty="true"][animation="2"], +Natron--ClickableLabel[dirty="true"][animation="2"] { color: %7; } /*No multiple selection and expr. Change also text colour otherwise the default white is not perceptible*/ -ClickableLabel[dirty="false"][animation="3"] { +ClickableLabel[dirty="false"][animation="3"], +Natron--ClickableLabel[dirty="false"][animation="3"] { background-color: %7; color: %9; } /*Multiple selection and expr: change text color instead*/ -ClickableLabel[dirty="true"][animation="3"] { +ClickableLabel[dirty="true"][animation="3"], +Natron--ClickableLabel[dirty="true"][animation="3"] { color: %9; } /*Disabled and no multiple selection: */ -ClickableLabel[readOnly="true"][dirty="false"] { +ClickableLabel[readOnly="true"][dirty="false"], +Natron--ClickableLabel[readOnly="true"][dirty="false"] { color: %8; } /*Disabled and multiple selection: */ -ClickableLabel[readOnly="true"][dirty="true"] { +ClickableLabel[readOnly="true"][dirty="true"], +Natron--ClickableLabel[readOnly="true"][dirty="true"] { background-color: black; color: %8; } - - -TabWidget{ +TabWidget, +Natron--TabWidget { background-color: %4; } -NodeSettingsPanel{ +NodeSettingsPanel, +Natron--NodeSettingsPanel { background-color: %2; color: %5; } + QPushButton{ background-color: %3; color: %5; @@ -304,8 +313,8 @@ QDialog { background-color: %2; } - -NodeCreationDialog { +NodeCreationDialog, +Natron--NodeCreationDialog { background-color: %2; border: 5px black; border-radius:2px; @@ -319,30 +328,31 @@ QToolButton:pressed { border: 1px solid %1; } - QToolButton:focus { border: 1px solid %1; } -ViewerToolButton[isSelected="true"] -{ +ViewerToolButton[isSelected="true"], +Natron--ViewerToolButton[isSelected="true"] { border: 1px solid %1; } -ViewerToolButton -{ +ViewerToolButton, +Natron--ViewerToolButton { border: 0px ; } -ViewerToolButton[isSelected="false"]:pressed { +ViewerToolButton[isSelected="false"]:pressed, +Natron--ViewerToolButton[isSelected="false"]:pressed { border: 0px; } -ViewerToolButton[isSelected="true"]:pressed { +ViewerToolButton[isSelected="true"]:pressed, +Natron--ViewerToolButton[isSelected="true"]:pressed { border: 1px solid %1; } - -ViewerToolButton:focus { +ViewerToolButton:focus, +Natron--ViewerToolButton:focus { border: 0px; } @@ -384,7 +394,6 @@ QScrollArea { background-color: %2; } - QComboBox { color: %5; background-color: %3; @@ -416,7 +425,6 @@ QTabWidget::pane { margin-top: -1px; } - QLineEdit { border: 1px solid; border-radius: 1px; @@ -475,7 +483,8 @@ QTabBar::tab { border-top-left-radius: 5px; } -QTabBar::tab#DockablePanelTabWidget { +QTabBar::tab#DockablePanelTabWidget, +QTabBar::tab#Natron--DockablePanelTabWidget { min-width: 3em; } @@ -488,7 +497,6 @@ QTabBar::tab:selected { /*border-color: %1;*/ } - QTabBar::tab:!selected { color: %5; /* color of the text on deselected tabs */ } @@ -518,15 +526,18 @@ QTabBar::close-button:hover { subcontrol-position: right; } -TabBar[mouseOverFocus="true"][clickFocus="false"] { +TabBar[mouseOverFocus="true"][clickFocus="false"], +Natron--TabBar[mouseOverFocus="true"][clickFocus="false"] { color: %11; } -TabBar[clickFocus="true"] { +TabBar[clickFocus="true"], +Natron--TabBar[clickFocus="true"] { color: %1; } -TabBar[mouseOverFocus="false"][clickFocus="false"] { +TabBar[mouseOverFocus="false"][clickFocus="false"], +Natron--TabBar[mouseOverFocus="false"][clickFocus="false"] { color: %5; } @@ -583,8 +594,6 @@ Natron--SpinBox[altered="true"][dirty="false"] { color: %10; } - - LineEdit[animation="0"], Natron--LineEdit[animation="0"] { background-color: %3; @@ -611,7 +620,7 @@ Natron--LineEdit[altered="true"] { color: %10; } -QTextEdit{ +QTextEdit { color: %5; background-color: %3; selection-color: %8; @@ -748,7 +757,14 @@ QPlainTextEdit { selection-background-color: %1; } -OutputScriptTextEdit { +QTextBrowser[html], +QTextBrowser[plainText] { + color: %5; +} + +OutputScriptTextEdit, +Natron--OutputScriptTextEdit, +Natron--OutputScriptTextEdit[plainText] { color: %5; background-color: %2; selection-color: %8; diff --git a/Gui/SequenceFileDialog.cpp b/Gui/SequenceFileDialog.cpp index 6db66d3d91..e55b165dc1 100644 --- a/Gui/SequenceFileDialog.cpp +++ b/Gui/SequenceFileDialog.cpp @@ -115,31 +115,8 @@ CLANG_DIAG_ON(uninitialized) #include "Gui/Menu.h" #include "Global/QtCompat.h" // removeFileExtension -#define FILE_DIALOG_DISABLE_ICONS - -using std::make_pair; NATRON_NAMESPACE_ENTER -#if 0 -static inline bool -nocase_equal_char (char c1, - char c2) -{ - return toupper(c1) == toupper(c2); -} - -static inline bool -nocase_equal_string (const std::string &s1, - const std::string &s2) -{ - return s1.size() == s2.size() && // ensure same sizes - std::equal (s1.begin(), s1.end(), // first source string - s2.begin(), // second source string - nocase_equal_char); -} - -#endif - static inline bool isCaseSensitiveFileSystem(const QString &path) { @@ -158,40 +135,26 @@ isCaseSensitiveFileSystem(const QString &path) #endif } -#if 0 - -#ifdef FILE_DIALOG_DISABLE_ICONS -class EmptyIconProvider - : public QFileIconProvider -{ -public: - - EmptyIconProvider() - : QFileIconProvider() - { - } - - virtual QIcon icon(IconType /*type*/) const - { - return QIcon(); +static void removeTrailingSlash(QString& str) { + if ( (str.size() > 1) && ( str.endsWith( QLatin1Char('/') ) || str.endsWith( QLatin1Char('\\') ) ) ) { + str = str.remove(str.size() - 1, 1); } +} - virtual QIcon icon(const QFileInfo & /*info*/) const - { - return QIcon(); - } +static QString urlToPathString(const QUrl& url) { + return QtCompat::toLocalFileUrlFixed(url).toLocalFile(); +} - virtual QString type(const QFileInfo & /*info*/) const - { +static QString bookmarkToUrlPath(const QUrl& bookmark) { + QString urlPath = urlToPathString(bookmark); + if (urlPath.isEmpty()) { return QString(); } -}; - -#endif -#endif \ - // 0 + removeTrailingSlash(urlPath); + return urlPath; +} ///////////////////////// SequenceFileDialog @@ -351,12 +314,6 @@ SequenceFileDialog::SequenceFileDialog( QWidget* parent, // necessary to transmi _favoriteButtonsLayout->addWidget(_addFavoriteButton); QObject::connect( _addFavoriteButton, SIGNAL(clicked()), this, SLOT(addFavorite()) ); - // we don't need an editor: just romove favorite and add a new one - //_editFavoriteButton = new Button(tr("Edit"), this); - //_editFavoriteButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Edit the selected favorite."), NATRON_NAMESPACE::WhiteSpaceNormal) ); - //_favoriteButtonsLayout->addWidget(_editFavoriteButton); - //QObject::connect( _editFavoriteButton, SIGNAL(clicked()), this, SLOT(editUrl()) ); - _removeFavoriteButton = new Button(QString::fromUtf8(" - "), this); _removeFavoriteButton->setMaximumSize(20, 20); _removeFavoriteButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Remove the selected directory from the favorites list."), NATRON_NAMESPACE::WhiteSpaceNormal) ); @@ -423,10 +380,6 @@ SequenceFileDialog::SequenceFileDialog( QWidget* parent, // necessary to transmi _model->initialize(this); _view->setSortingEnabled( isCaseSensitiveFileSystem( rootPath() ) ); -#ifdef FILE_DIALOG_DISABLE_ICONS - //EmptyIconProvider* iconProvider = new EmptyIconProvider; - //_model->setIconProvider(iconProvider); -#endif _model->setSequenceModeEnabled(isSequenceDialog ? true : false); @@ -587,12 +540,14 @@ SequenceFileDialog::SequenceFileDialog( QWidget* parent, // necessary to transmi } if (!hasRestoredDir) { - // try to go up until we find a directory that exists. + // try to go up until we find a directory that exists or we have reached a drive name. + // Stopping at the drive name is important because cleanPath() does not guarantee that + // applying a "/.." to all drive names will return an empty string. (e.g. network shares //somehost/) QString dir = QString::fromUtf8( directoryArgs.c_str() ); //qDebug() << "dir=" << dir; - while (!dir.isEmpty() && !hasRestoredDir) { - dir = QDir::cleanPath(dir + QString::fromUtf8("/..")); - if ( QDir(dir).exists() ) { + while (!dir.isEmpty() && !FileSystemModel::isDriveName(dir) && !hasRestoredDir) { + dir = FileSystemModel::cleanPath(dir + QString::fromUtf8("/..")); + if ( isDirectory(dir) ) { hasRestoredDir = setDirectory(dir); break; } @@ -711,6 +666,7 @@ SequenceFileDialog::restoreState(const QByteArray & state, _gui->getApp()->getProject()->getEnvironmentVariables(envVar); std::vector stdBookMarks; + std::set stdBookMarkUrlPaths; QStringList expandedVars; for (std::map::iterator it = envVar.begin(); it != envVar.end(); ++it) { QString var( QString::fromUtf8( it->second.c_str() ) ); @@ -719,38 +675,21 @@ SequenceFileDialog::restoreState(const QByteArray & state, Project::expandVariable(envVar, it->second); expandedVars.push_back(var); QUrl url = QUrl::fromLocalFile(var); - QDir dir(var); - if ( dir.exists() ) { + if ( isDirectory(var) ) { stdBookMarks.push_back(url); + stdBookMarkUrlPaths.emplace(bookmarkToUrlPath(url)); } } } + // Add bookmarks to paths that are not already covered by the environment variables. for (int i = 0; i < bookmarks.count(); ++i) { - QString urlPath = QtCompat::toLocalFileUrlFixed(bookmarks[i]).toLocalFile(); - - if ( !urlPath.isEmpty() ) { - if ( (urlPath.size() > 1) && ( urlPath.endsWith( QLatin1Char('/') ) || urlPath.endsWith( QLatin1Char('\\') ) ) ) { - urlPath = urlPath.remove(urlPath.size() - 1, 1); - } - bool alreadyFound = false; - - for (U32 j = 0; j < stdBookMarks.size(); ++j) { - QString otherUrl = QtCompat::toLocalFileUrlFixed(stdBookMarks[j]).toLocalFile(); - - if ( (otherUrl.size() > 1) && ( otherUrl.endsWith( QLatin1Char('/') ) || otherUrl.endsWith( QLatin1Char('\\') ) ) ) { - otherUrl = otherUrl.remove(otherUrl.size() - 1, 1); - } - if (otherUrl == urlPath) { - alreadyFound = true; - break; - } - } - - QDir dir(urlPath); - if ( !alreadyFound && dir.exists() ) { - stdBookMarks.push_back( bookmarks[i] ); - } + const QString urlPath = bookmarkToUrlPath(bookmarks[i]); + if (!urlPath.isEmpty() && + stdBookMarkUrlPaths.find(urlPath) == stdBookMarkUrlPaths.end() && + isDirectory(urlPath)) { + stdBookMarks.push_back(bookmarks[i]); + stdBookMarkUrlPaths.emplace(urlPath); } } @@ -800,7 +739,10 @@ SequenceFileDialog::setFileExtensionOnLineEdit(const QString & ext) return; } else { int pos = str.lastIndexOf( QLatin1Char('.') ); - if (pos != -1) { + if (pos == 0) { + // Do not modify filenames that start with a period. + return; + } else if (pos != -1) { if ( str.at(pos - 1) == QLatin1Char('#') ) { --pos; } @@ -957,16 +899,8 @@ SequenceFileDialog::onSelectionChanged() proxyAndSetLineEditText(absolutePath); - if ( !item->isDir() ) { - if (_dialogMode == eFileDialogModeSave) { - QString extension = item->fileExtension(); - for (int i = 0; i < _fileExtensionCombo->count(); ++i) { - if (_fileExtensionCombo->itemText(i) == extension) { - _fileExtensionCombo->setCurrentIndex_no_emit(i); - break; - } - } - } + if ( !item->isDir() && _dialogMode == eFileDialogModeSave) { + updateFileExtensionCombo(item->fileExtension()); } ///refrsh preview if any @@ -975,6 +909,16 @@ SequenceFileDialog::onSelectionChanged() } } // onSelectionChanged +void +SequenceFileDialog::updateFileExtensionCombo(const QString& extension) { + for (int i = 0; i < _fileExtensionCombo->count(); ++i) { + if (_fileExtensionCombo->itemText(i) == extension) { + _fileExtensionCombo->setCurrentIndex_no_emit(i); + break; + } + } +} + void SequenceFileDialog::enterDirectory(const QModelIndex & index) { @@ -990,14 +934,11 @@ SequenceFileDialog::setDirectory(const QString &directory) { QString newDirectory = directory; - - #ifdef __NATRON_WIN32__ +#ifdef __NATRON_WIN32__ newDirectory = appPTR->mapUNCPathToPathWithDriveLetter(newDirectory); #endif - QDir dir(newDirectory); - - if ( !newDirectory.isEmpty() && !dir.exists() ) { + if ( !newDirectory.isEmpty() && !isDirectory(newDirectory) ) { return false; } @@ -1005,7 +946,7 @@ SequenceFileDialog::setDirectory(const QString &directory) _view->verticalScrollBar()->setValue(0); //we remove .. and . from the given path if exist if ( !newDirectory.isEmpty() ) { - newDirectory = QDir::cleanPath(newDirectory); + newDirectory = FileSystemModel::cleanPath(newDirectory); } if ( !directory.isEmpty() && newDirectory.isEmpty() ) { @@ -1022,15 +963,13 @@ SequenceFileDialog::setDirectory(const QString &directory) return false; } - - _requestedDir = newDirectory; if ( !_model->setRootPath(newDirectory) ) { return false; } _createDirButton->setEnabled(_dialogMode != eFileDialogModeOpen); - if ( !newDirectory.isEmpty() && ( newDirectory.at(newDirectory.size() - 1) != QLatin1Char('/') ) ) { - newDirectory.append( QLatin1Char('/') ); + if ( !newDirectory.isEmpty() ) { + StrUtils::ensureLastPathSeparator(newDirectory); } _selectionLineEdit->blockSignals(true); @@ -1145,7 +1084,7 @@ SequenceDialogView::dropEvent(QDropEvent* e) QList urls = e->mimeData()->urls(); QString path; if (urls.size() > 0) { - path = QtCompat::toLocalFileUrlFixed( urls.at(0) ).path(); + path = urlToPathString( urls.at(0) ); } if ( !path.isEmpty() ) { _fd->setDirectory(path); @@ -1222,7 +1161,6 @@ SequenceItemDelegate::paint(QPainter * painter, return QStyledItemDelegate::paint(painter, option, index); } - QString filename = item->getUserFriendlyFilename(); //QFont f(appFont,appFontSize); //painter->setFont(f); if (option.state & QStyle::State_Selected) { @@ -1256,15 +1194,13 @@ SequenceItemDelegate::paint(QPainter * painter, } painter->drawText(geom, Qt::TextSingleLine | Qt::AlignRight, itemSizeText, &r); } else { -#ifdef FILE_DIALOG_DISABLE_ICONS - if ( isDir && !filename.endsWith( QLatin1Char('/') ) ) { - filename.append( QLatin1Char('/') ); + QString filename = item->getUserFriendlyFilename(); + if (isDir) { + StrUtils::ensureLastPathSeparator(filename); } -#endif // FIXME: with the default delegate (QStyledItemDelegate), there is a margin // of a few more pixels between border and icon, and between icon and text, not with this one -#ifdef FILE_DIALOG_DISABLE_ICONS QRect textRect( geom.x() + 5, geom.y(), geom.width() - 5, geom.height() ); QFont f = painter->font(); if (isDir) { @@ -1274,19 +1210,6 @@ SequenceItemDelegate::paint(QPainter * painter, f.setBold(false); } painter->setFont(f); -#else - int iconWidth = option.decorationSize.width(); - int textSize = totalSize - iconWidth; - QFileInfo fileInfo( index.data(FileSystemModel::FilePathRole).toString() ); - QIcon icon = _fd->getFileSystemModel()->iconProvider()->icon(fileInfo); - QRect iconRect( geom.x(), geom.y(), iconWidth, geom.height() ); - QSize iconSize = icon.actualSize( QSize( iconRect.width(), iconRect.height() ) ); - QRect textRect( geom.x() + iconWidth, geom.y(), textSize, geom.height() ); - painter->drawPixmap(iconRect, - icon.pixmap(iconSize), - r); - -#endif painter->drawText(textRect, Qt::TextSingleLine, filename, &r); } } // paint @@ -1294,9 +1217,7 @@ SequenceItemDelegate::paint(QPainter * painter, bool SequenceFileDialog::isDirectory(const QString & name) const { - QDir dir(name); - - return dir.exists(); + return QDir(name).exists(); } QString @@ -1366,26 +1287,19 @@ SequenceFileDialog::parentFolder() QDir dir(rootPath); dir.cdUp(); newDir = dir.absolutePath(); - } + if (!FileSystemModel::startsWithDriveName(newDir)) { + // QDir always provides a trailing slash to drives, but + // leaves it off for network shares. If the new + // directory does not start with a drive name anymore + // assume it just needs a trailing slash appended. + StrUtils::ensureLastPathSeparator(newDir); + } -#ifdef __NATRON_WIN32__ - if ( FileSystemModel::isDriveName(newDir) ) { - _upButton->setEnabled(false); - } else { - _upButton->setEnabled(true); - } -#else - if ( FileSystemModel::isDriveName(newDir) || newDir.isEmpty() ) { - _upButton->setEnabled(false); - - return; - } else { - _upButton->setEnabled(true); + assert(FileSystemModel::startsWithDriveName(newDir)); } -#endif - + updateUpButton(newDir); setDirectory(newDir); } @@ -1455,13 +1369,10 @@ void SequenceFileDialog::addFavorite(const QString & name, const QString & path) { - QDir d(path); - - if ( !d.exists() ) { + if ( !isDirectory(path) ) { return; } - if ( !name.isEmpty() && !path.isEmpty() ) { std::vector list; list.push_back( QUrl::fromLocalFile(path) ); @@ -1682,10 +1593,7 @@ SequenceFileDialog::onLookingComboboxChanged(const QString & /*path*/) } QUrl url = index.data(UrlModel::UrlRole).toUrl(); - url = QtCompat::toLocalFileUrlFixed(url); - - QString urlPath = QtCompat::toLocalFileUrlFixed(url).toLocalFile(); - setDirectory(urlPath); + setDirectory(urlToPathString(url)); } QString @@ -1707,26 +1615,44 @@ SequenceFileDialog::getEnvironmentVariable(const QString &string) void SequenceFileDialog::pathChanged(const QString &newPath) { - if ( newPath.isEmpty() ) { - _upButton->setEnabled(false); - } else { - _upButton->setEnabled(true); - } + updateUpButton(newPath); _favoriteView->selectUrl( QUrl::fromLocalFile(newPath) ); setHistory( _lookInCombobox->history() ); - if ( (_currentHistoryLocation < 0) || ( _history.value(_currentHistoryLocation) != QDir::toNativeSeparators(newPath) ) ) { + const QString nativeNewPath = QDir::toNativeSeparators(newPath); + if ( (_currentHistoryLocation < 0) || ( _history.value(_currentHistoryLocation) != nativeNewPath ) ) { while ( _currentHistoryLocation >= 0 && _currentHistoryLocation + 1 < _history.count() ) { _history.removeLast(); } - _history.append( QDir::toNativeSeparators(newPath) ); + _history.append( nativeNewPath ); ++_currentHistoryLocation; } _nextButton->setEnabled(_history.size() - _currentHistoryLocation > 1); _previousButton->setEnabled(_currentHistoryLocation > 0); } +void +SequenceFileDialog::updateUpButton(const QString &newPath) { + if (newPath.isEmpty()) { + _upButton->setEnabled(false); + return; + } + +#ifndef __NATRON_WIN32__ + // On non-Windows platforms the up button should be disabled for the rootPath (i.e. "/"). + // On Windows we don't want to stop here because the rootPath is typically "C:/" and + // we want to be able to "go up one more" so that the drives and network shares can + // be seen. + if (newPath == QDir::rootPath()) { + _upButton->setEnabled(false); + return; + } +#endif + + _upButton->setEnabled(true); +} + void SequenceFileDialog::setHistory(const QStringList &paths) { @@ -1882,9 +1808,7 @@ SequenceFileDialog::doubleClickOpen(const QModelIndex & /*index*/) void SequenceFileDialog::seekUrl(const QUrl & url) { - QString urlPath = QtCompat::toLocalFileUrlFixed(url).toLocalFile(); - - setDirectory(urlPath); + setDirectory(urlToPathString(url)); } void @@ -1982,7 +1906,7 @@ UrlModel::setData(const QModelIndex &index, { if (value.type() == QVariant::Url) { QUrl url = value.toUrl(); - QModelIndex dirIndex = fileSystemModel->index( QtCompat::toLocalFileUrlFixed(url).toLocalFile() ); + QModelIndex dirIndex = fileSystemModel->index( urlToPathString(url) ); QStandardItemModel::setData(index, QDir::toNativeSeparators( fileSystemModel->data(dirIndex, QFileSystemModel::FilePathRole).toString() ), Qt::ToolTipRole); // QStandardItemModel::setData(index, fileSystemModel->data(dirIndex).toString()); QVariant deco = fileSystemModel->data(dirIndex, Qt::DecorationRole); @@ -2001,26 +1925,18 @@ UrlModel::setUrl(const QModelIndex &index, const QModelIndex &dirIndex) { setData(index, url, UrlRole); - if ( url.path().isEmpty() ) { - setData( index, /*fileSystemModel->myComputer()*/ tr("Computer") ); - setData(index, fileSystemModel->myComputer(Qt::DecorationRole), Qt::DecorationRole); + if ( urlToPathString(url).isEmpty() ) { + const char* myComputer = "Computer"; + setData(index, tr(myComputer)); + setData(index, tr(myComputer), Qt::DecorationRole); } else { - QString newName; - newName = QDir::toNativeSeparators( dirIndex.data(QFileSystemModel::FilePathRole).toString() ); //dirIndex.data().toString(); + QString newName = QDir::toNativeSeparators( dirIndex.data(QFileSystemModel::FilePathRole).toString() ); //dirIndex.data().toString(); QIcon newIcon; if ( !dirIndex.isValid() ) { newIcon = fileSystemModel->iconProvider()->icon(QFileIconProvider::Folder); - newName = QFileInfo( QtCompat::toLocalFileUrlFixed(url).toLocalFile() ).fileName(); - bool invalidUrlFound = false; - for (unsigned int i = 0; i < invalidUrls.size(); ++i) { - if (invalidUrls[i] == url) { - invalidUrlFound = true; - break; - } - } - if (!invalidUrlFound) { - invalidUrls.push_back(url); - } + newName = QFileInfo(urlToPathString(url)).fileName(); + invalidUrls.emplace(url); + //The bookmark is invalid then we set to false the EnabledRole setData(index, false, EnabledRole); } else { @@ -2035,7 +1951,7 @@ UrlModel::setUrl(const QModelIndex &index, QPixmap smallPixmap = newIcon.pixmap( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) ); newIcon.addPixmap( smallPixmap.scaledToWidth(NATRON_MEDIUM_BUTTON_ICON_SIZE, Qt::SmoothTransformation) ); } - newName = mapUrlToDisplayName(newName); + newName = mapPathToDisplayName(newName); if (index.data().toString() != newName) { setData(index, newName); @@ -2075,24 +1991,24 @@ UrlModel::addUrls(const std::vector &list, continue; } - const QString cleanUrl = QDir::cleanPath( QtCompat::toLocalFileUrlFixed(url).toLocalFile() ); - QModelIndex idx = fileSystemModel->index(cleanUrl); - if ( !cleanUrl.isEmpty() && !fileSystemModel->isDir(idx) ) { + const QString cleanUrlPath = FileSystemModel::cleanPath( urlToPathString(url) ); + QModelIndex idx = fileSystemModel->index(cleanUrlPath); + if ( !cleanUrlPath.isEmpty() && !fileSystemModel->isDir(idx) ) { continue; } bool found = false; int rc = rowCount(); for (int j = 0; j < rc; ++j) { - if (index(j, 0).data(UrlRole).toUrl().toLocalFile() == cleanUrl) { + if (urlToPathString(index(j, 0).data(UrlRole).toUrl()) == cleanUrlPath) { if (removeExisting) { if (j < startRow) { --startRow; } removeRow(j); - ///remove it from wacthing too + ///remove it from watching too for (U32 k = 0; k < watching.size(); ++k) { - if (watching[k].second == cleanUrl) { + if (watching[k].second == cleanUrlPath) { watching.erase(watching.begin() + k); break; } @@ -2106,13 +2022,13 @@ UrlModel::addUrls(const std::vector &list, if (!found) { // If not found, make sure it is not already in the realList for (std::size_t k = 0; k < realList.size(); ++k) { - if (realList[k].second == cleanUrl) { + if (realList[k].second == cleanUrlPath) { found = true; break; } } if (!found) { - realList.push_back( std::make_pair(QUrl::fromLocalFile(cleanUrl), cleanUrl) ); + realList.push_back( std::make_pair(QUrl::fromLocalFile(cleanUrlPath), cleanUrlPath) ); } } } @@ -2133,7 +2049,7 @@ UrlModel::addUrls(const std::vector &list, QModelIndex idx = fileSystemModel->index(realList[i].second); setUrl(index(row, 0), realList[i].first, idx); - watching.push_back( make_pair(idx, realList[i].second) ); + watching.push_back( std::make_pair(idx, realList[i].second) ); ++row; } } // UrlModel::addUrls @@ -2218,9 +2134,10 @@ void UrlModel::changed(const QString &path) { for (int i = 0; i < rowCount(); ++i) { - QModelIndex idx = index(i, 0); - if (idx.data(UrlRole).toUrl().toLocalFile() == path) { - setData( idx, idx.data(UrlRole).toUrl() ); + const QModelIndex idx = index(i, 0); + const QUrl url = idx.data(UrlRole).toUrl(); + if (urlToPathString(url) == path) { + setData(idx, url); } } } @@ -2228,7 +2145,7 @@ UrlModel::changed(const QString &path) void UrlModel::removeRowIndex(const QModelIndex& index) { - QString urlPath = index.data(UrlRole).toUrl().path(); + QString urlPath = urlToPathString(index.data(UrlRole).toUrl()); if ( !urlPath.isEmpty() ) { removeRow( index.row() ); @@ -2247,7 +2164,7 @@ FavoriteItemDelegate::FavoriteItemDelegate() } QString -UrlModel::mapUrlToDisplayName(const QString& originalName) +UrlModel::mapPathToDisplayName(const QString& originalName) { QString str = originalName; @@ -2256,39 +2173,29 @@ UrlModel::mapUrlToDisplayName(const QString& originalName) str.replace( QLatin1Char('\\'), QLatin1Char('/') ); #endif - ///if str ends with '/' remove it - if ( (str.size() > 1) && ( str.endsWith( QLatin1Char('/') ) || str.endsWith( QLatin1Char('\\') ) ) ) { - str = str.remove(str.size() - 1, 1); - } + removeTrailingSlash(str); - std::map::const_iterator isEnvVar = envVars.end(); for (std::map::const_iterator it = envVars.begin(); it != envVars.end(); ++it) { ///if it->second ends with '/' remove it std::string stdVar = it->second; Project::expandVariable(envVars, stdVar); QString var = QString::fromUtf8( stdVar.c_str() ); - if ( (var.size() > 1) && ( var.endsWith( QLatin1Char('/') ) || var.endsWith( QLatin1Char('\\') ) ) ) { - var = var.remove(var.size() - 1, 1); - } + removeTrailingSlash(var); if (var == str) { - isEnvVar = it; - break; + str.clear(); + str.append( QLatin1Char('[') ); + str.append( QString::fromUtf8( it->first.c_str() ) ); + str.append( QLatin1Char(']') ); + return str; } } - if ( isEnvVar == envVars.end() ) { - QModelIndex modelIndex = fileSystemModel->index(str); - if ( !modelIndex.isValid() ) { - return originalName; - } - str = modelIndex.data().toString(); - } else { - str.clear(); - str.append( QLatin1Char('[') ); - str.append( QString::fromUtf8( isEnvVar->first.c_str() ) ); - str.append( QLatin1Char(']') ); + + QModelIndex modelIndex = fileSystemModel->index(str); + if ( modelIndex.isValid() ) { + return modelIndex.data().toString(); } - return str; + return originalName; } void @@ -2368,11 +2275,6 @@ FavoriteView::setModelAndUrls(QFileSystemModel *model, setDragDropMode(QAbstractItemView::DragDrop); - // we don't need a context menu here, there are the "+" and "-" buttons - //setContextMenuPolicy(Qt::CustomContextMenu); - //connect( this, SIGNAL(customContextMenuRequested(QPoint)), - // this, SLOT(showMenu(QPoint)) ); - urlModel->setUrls(newUrls); setCurrentIndex( this->model()->index(0, 0) ); connect( selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), @@ -2399,11 +2301,11 @@ FavoriteView::selectUrl(const QUrl &url) selectionModel()->clear(); - QString urlPath = QtCompat::toLocalFileUrlFixed(url).toLocalFile(); + QString urlPath = urlToPathString(url); for (int i = 0; i < model()->rowCount(); ++i) { QUrl otherUrl = model()->index(i, 0).data(UrlModel::UrlRole).toUrl(); - QString otherUrlPath = QtCompat::toLocalFileUrlFixed(otherUrl).toLocalFile(); + QString otherUrlPath = urlToPathString(otherUrl); if (otherUrlPath == urlPath) { selectionModel()->select(model()->index(i, 0), QItemSelectionModel::Select); @@ -2429,88 +2331,6 @@ FavoriteView::removeEntry() } } -// we don't need a favorite editor: just remove and add a new one -/* -void -FavoriteView::rename() -{ - QModelIndex index; - - QList idxs = selectionModel()->selectedIndexes(); - QList indexes; - for (int i = 0; i < idxs.count(); ++i) { - indexes.append( idxs.at(i) ); - } - for (int i = 0; i < indexes.count(); ++i) { - if ( !indexes.at(i).data(UrlModel::UrlRole).toUrl().path().isEmpty() ) { - index = indexes.at(i); - break; - } - } - QString newName; - #warning "TODO: use NATRON_PYTHON_NAMESPACE::PyModalDialog" - QInputDialog dialog(this); - dialog.setLabelText( tr("Favorite Name:") ); - dialog.setWindowTitle( tr("Rename Favorite") ); - dialog.setAttribute(Qt::WA_MacShowFocusRect, 0); - if ( dialog.exec() ) { - newName = dialog.textValue(); - } - rename(index, newName); -} - -void -FavoriteView::rename(const QModelIndex & index, - const QString & name) -{ - model()->setData(index, name, Qt::EditRole); -} -*/ - -// we don't need an editor: just romove favorite and add a new one -/* -void -FavoriteView::editUrl() -{ - QModelIndex index; - - QList idxs = selectionModel()->selectedIndexes(); - QList indexes; - for (int i = 0; i < idxs.count(); ++i) { - indexes.append( idxs.at(i) ); - } - for (int i = 0; i < indexes.count(); ++i) { - if ( !indexes.at(i).data(UrlModel::UrlRole).toUrl().path().isEmpty() ) { - index = indexes.at(i); - break; - } - } - QString newName; - #warning "TODO: use NATRON_PYTHON_NAMESPACE::PyModalDialog" - QInputDialog dialog(this); - dialog.setLabelText( tr("Folder Path:") ); - dialog.setWindowTitle( tr("Change Folder Path") ); - dialog.setAttribute(Qt::WA_MacShowFocusRect, 0); - if ( dialog.exec() ) { - newName = dialog.textValue(); - } - QString cleanpath = QDir::cleanPath(newName); - QUrl url = QUrl::fromLocalFile(newName); - UrlModel *myurlModel = dynamic_cast( model() ); - assert(myurlModel); - if (!myurlModel) { - return; - } - QFileSystemModel* fileSystemModel = myurlModel->getFileSystemModel(); - assert(fileSystemModel); - QModelIndex idx = fileSystemModel->index(cleanpath); - if ( !fileSystemModel->isDir(idx) ) { - return; - } - myurlModel->setUrl(index, url, idx); -} - */ - void FavoriteView::clicked(const QModelIndex &index) { @@ -2520,36 +2340,6 @@ FavoriteView::clicked(const QModelIndex &index) selectUrl(url); } -// we don't need a context menu, there are the "+" and "-" buttons -/* -void -FavoriteView::showMenu(const QPoint &position) -{ - QList actions; - if ( indexAt(position).isValid() ) { - QAction *removeAction = new QAction(tr("Remove"), this); - if ( indexAt(position).data(UrlModel::UrlRole).toUrl().path().isEmpty() ) { - removeAction->setEnabled(false); - } - connect( removeAction, SIGNAL(triggered()), this, SLOT(removeEntry()) ); - actions.append(removeAction); - - QAction *editAction = new QAction(tr("Edit path"), this); - if ( indexAt(position).data(UrlModel::UrlRole).toUrl().path().isEmpty() ) { - editAction->setEnabled(false); - } - connect( editAction, SIGNAL(triggered()), this, SLOT(editUrl()) ); - actions.append(editAction); - } - if (actions.count() > 0) { - Menu menu(this); - //menu.setFont(QFont(appFont,appFontSize)); - menu.addActions(actions); - menu.exec( mapToGlobal(position) ); - } -} -*/ - void FavoriteView::keyPressEvent(QKeyEvent* e) { @@ -2606,8 +2396,8 @@ UrlModel::canDrop(QDragEnterEvent* e) } const QList list = e->mimeData()->urls(); - for (int i = 0; i < list.count(); ++i) { - QModelIndex idx = fileSystemModel->index( QtCompat::toLocalFileUrlFixed( list.at(i) ).toLocalFile() ); + for (const QUrl& url : list) { + QModelIndex idx = fileSystemModel->index( urlToPathString(url) ); if ( !fileSystemModel->isDir(idx) ) { return false; } @@ -2840,13 +2630,7 @@ SequenceFileDialog::onSelectionLineEditing(const QString & text) return; } QString textCpy = text; - QString extension = QtCompat::removeFileExtension(textCpy); - for (int i = 0; i < _fileExtensionCombo->count(); ++i) { - if (_fileExtensionCombo->itemText(i) == extension) { - _fileExtensionCombo->setCurrentIndex_no_emit(i); - break; - } - } + updateFileExtensionCombo(QtCompat::removeFileExtension(textCpy)); } void diff --git a/Gui/SequenceFileDialog.h b/Gui/SequenceFileDialog.h index 46b0388966..eecdc64379 100644 --- a/Gui/SequenceFileDialog.h +++ b/Gui/SequenceFileDialog.h @@ -120,11 +120,11 @@ public Q_SLOTS: void changed(const QString &path); void addIndexToWatch(const QString &path, const QModelIndex &index); - QString mapUrlToDisplayName(const QString& originalName); + QString mapPathToDisplayName(const QString& originalName); QFileSystemModel *fileSystemModel; std::vector > watching; - std::vector invalidUrls; + std::set invalidUrls; std::map envVars; }; @@ -542,6 +542,9 @@ public Q_SLOTS: void getSequenceFromFilesForFole(const QString & file, SequenceParsing::SequenceFromFiles* sequence) const; + void updateFileExtensionCombo(const QString& extension); + void updateUpButton(const QString &newPath); + private: // FIXME: PIMPL @@ -565,7 +568,6 @@ public Q_SLOTS: Button* _openButton; Button* _cancelButton; Button* _addFavoriteButton; - Button* _editFavoriteButton; Button* _removeFavoriteButton; FileDialogLineEdit* _selectionLineEdit; Label* _relativeLabel; diff --git a/Gui/ViewerGL.cpp b/Gui/ViewerGL.cpp index ebc5a30ab5..234906da8c 100644 --- a/Gui/ViewerGL.cpp +++ b/Gui/ViewerGL.cpp @@ -490,8 +490,7 @@ ViewerGL::paintGL() const TextureRect &r = _imp->partialUpdateTextures[i].texture->getTextureRect(); RectI texRect(r.x1, r.y1, r.x2, r.y2); const double par = r.par; - RectD canonicalTexRect; - texRect.toCanonical_noClipping(_imp->partialUpdateTextures[i].mipMapLevel, par /*, rod*/, &canonicalTexRect); + const RectD canonicalTexRect = texRect.toCanonical_noClipping(_imp->partialUpdateTextures[i].mipMapLevel, par); glActiveTexture(GL_TEXTURE0); glBindTexture( GL_TEXTURE_2D, _imp->partialUpdateTextures[i].texture->getTexID() ); @@ -1316,7 +1315,7 @@ ViewerGL::getImageRectangleDisplayed(const RectI & imageRoDPixel, // in pixel co if (mipMapLevel != 0) { // for the viewer, we need the smallest enclosing rectangle at the mipmap level, in order to avoid black borders - visibleArea.toPixelEnclosing(mipMapLevel, par, &ret); + ret = visibleArea.toPixelEnclosing(mipMapLevel, par); } else { ret.x1 = std::floor(visibleArea.x1 / par); ret.x2 = std::ceil(visibleArea.x2 / par); @@ -1324,11 +1323,8 @@ ViewerGL::getImageRectangleDisplayed(const RectI & imageRoDPixel, // in pixel co ret.y2 = std::ceil(visibleArea.y2); } - ///If the roi doesn't intersect the image's Region of Definition just return an empty rectangle - if ( !ret.intersect(imageRoDPixel, &ret) ) { - ret.clear(); - } - + /// Clip the roi to the image's Region of Definition or return an empty rectangle if they don't intersect. + ret = ret.intersect(imageRoDPixel); } ///to clip against the user roi however clip it against the mipmaplevel of the zoomFactor+proxy @@ -1341,15 +1337,11 @@ ViewerGL::getImageRectangleDisplayed(const RectI & imageRoDPixel, // in pixel co userRoI = _imp->userRoI; } if (userRoiEnabled) { - RectI userRoIpixel; - ///If the user roi is enabled, we want to render the smallest enclosing rectangle in order to avoid black borders. - userRoI.toPixelEnclosing(mipMapLevel, par, &userRoIpixel); + const RectI userRoIpixel = userRoI.toPixelEnclosing(mipMapLevel, par); ///If the user roi doesn't intersect the actually visible portion on the viewer, return an empty rectangle. - if ( !ret.intersect(userRoIpixel, &ret) ) { - ret.clear(); - } + ret = ret.intersect(userRoIpixel); } return ret; @@ -1362,19 +1354,9 @@ ViewerGL::getExactImageRectangleDisplayed(int texIndex, unsigned int mipMapLevel) { bool clipToFormat = isClippingImageToFormat(); - RectD clippedRod; - - if (clipToFormat) { - rod.intersect(_imp->displayTextures[texIndex].format, &clippedRod); - } else { - clippedRod = rod; - } - - RectI bounds; - clippedRod.toPixelEnclosing(mipMapLevel, par, &bounds); - RectI roi = getImageRectangleDisplayed(bounds, par, mipMapLevel); - - return roi; + const RectD clippedRod = clipToFormat ? rod.intersect(_imp->displayTextures[texIndex].format) : rod; + const RectI bounds = clippedRod.toPixelEnclosing(mipMapLevel, par); + return getImageRectangleDisplayed(bounds, par, mipMapLevel); } RectI @@ -1388,17 +1370,9 @@ ViewerGL::getImageRectangleDisplayedRoundedToTileSize(int texIndex, RectI* roiNotRounded) { bool clipToProject = isClippingImageToFormat(); - RectD clippedRod; - - if (clipToProject) { - rod.intersect(_imp->displayTextures[texIndex].format, &clippedRod); - } else { - clippedRod = rod; - } - - RectI bounds; - clippedRod.toPixelEnclosing(mipMapLevel, par, &bounds); - RectI roi = getImageRectangleDisplayed(bounds, par, mipMapLevel); + const RectD clippedRod = clipToProject ? rod.intersect(_imp->displayTextures[texIndex].format) : rod; + const RectI bounds = clippedRod.toPixelEnclosing(mipMapLevel, par); + const RectI roi = getImageRectangleDisplayed(bounds, par, mipMapLevel); ////Texrect is the coordinates of the 4 corners of the texture in the bounds with the current zoom ////factor taken into account. @@ -1425,9 +1399,7 @@ ViewerGL::getImageRectangleDisplayedRoundedToTileSize(int texIndex, tile.y2 = y2; if (tiles) { - RectI tileRectRounded; - tile.intersect(bounds, &tileRectRounded); - tiles->push_back(tileRectRounded); + tiles->push_back(tile.intersect(bounds)); // tileRectRounded } assert( texRect.contains(tile) ); } @@ -2567,7 +2539,7 @@ ViewerGL::penMotionInternal(int x, void ViewerGL::mouseDoubleClickEvent(QMouseEvent* e) { - unsigned int mipMapLevel = getInternalNode()->getMipMapLevel(); + unsigned int mipMapLevel = getCurrentRenderScale(); QPointF pos_opengl; { QMutexLocker l(&_imp->zoomCtxMutex); @@ -3077,20 +3049,18 @@ ViewerGL::setRegionOfDefinition(const RectD & rod, return; } - RectI pixelRoD; - rod.toPixelEnclosing(0, par, &pixelRoD); + const RectI pixelRoD = rod.toPixelEnclosing(0, par); _imp->displayTextures[textureIndex].rod = rod; if ( _imp->infoViewer[textureIndex] && !_imp->viewerTab->getGui()->isGUIFrozen() ) { _imp->infoViewer[textureIndex]->setDataWindow(pixelRoD); } - const RectI& r = pixelRoD; QString x1, y1, x2, y2; - x1.setNum(r.x1); - y1.setNum(r.y1); - x2.setNum(r.x2); - y2.setNum(r.y2); + x1.setNum(pixelRoD.x1); + y1.setNum(pixelRoD.y1); + x2.setNum(pixelRoD.x2); + y2.setNum(pixelRoD.y2); _imp->currentViewerInfo_btmLeftBBOXoverlay[textureIndex] = x1 + QLatin1Char(',') + y1; @@ -3794,7 +3764,7 @@ ViewerGL::pickColorInternal(double x, bool /*pickInput*/) { -#pragma message WARN("Todo: use pickInput") +//#pragma message WARN("Todo: use pickInput") float r, g, b, a; QPointF imgPos; { diff --git a/Gui/ViewerGLPrivate.cpp b/Gui/ViewerGLPrivate.cpp index 95ea9ff19f..6ec3d5b9a6 100644 --- a/Gui/ViewerGLPrivate.cpp +++ b/Gui/ViewerGLPrivate.cpp @@ -250,11 +250,8 @@ ViewerGL::Implementation::drawRenderingVAO(unsigned int mipMapLevel, ///This is the coordinates in the image being rendered where datas are valid, this is in pixel coordinates ///at the time we initialize it but we will convert it later to canonical coordinates. See 1) const double par = roiRounded.par; - RectD canonicalRoIRoundedToTileSize; - roiRounded.toCanonical_noClipping(mipMapLevel, par /*, rod*/, &canonicalRoIRoundedToTileSize); - - RectD canonicalRoINotRounded; - roiNotRounded.toCanonical_noClipping(mipMapLevel, par, &canonicalRoINotRounded); + const RectD canonicalRoIRoundedToTileSize = roiRounded.toCanonical_noClipping(mipMapLevel, par); + const RectD canonicalRoINotRounded = roiNotRounded.toCanonical_noClipping(mipMapLevel, par); ///the RoD of the image in canonical coords. RectD rod = _this->getRoD(textureIndex); @@ -265,12 +262,12 @@ ViewerGL::Implementation::drawRenderingVAO(unsigned int mipMapLevel, clipToDisplayWindow = this->clipToDisplayWindow; } RectD rectClippedToRoI(canonicalRoIRoundedToTileSize); - rectClippedToRoI.intersect(rod, &rectClippedToRoI); + rectClippedToRoI.clipIfOverlaps(rod); if (clipToDisplayWindow) { - rod.intersect(this->displayTextures[textureIndex].format, &rod); - rectClippedToRoI.intersect(this->displayTextures[textureIndex].format, &rectClippedToRoI); + rod.clipIfOverlaps(this->displayTextures[textureIndex].format); + rectClippedToRoI.clipIfOverlaps(this->displayTextures[textureIndex].format); } @@ -297,11 +294,11 @@ ViewerGL::Implementation::drawRenderingVAO(unsigned int mipMapLevel, { QMutexLocker l(&this->userRoIMutex); //if the userRoI isn't intersecting the rod, just don't render anything - if ( !rod.intersect(this->userRoI, &rod) ) { + if ( !rod.clipIfOverlaps(this->userRoI) ) { return; } } - rectClippedToRoI.intersect(rod, &rectClippedToRoI); + rectClippedToRoI.clipIfOverlaps(rod); //clipTexCoords(canonicalTexRect,rectClippedToRoI,texBottom,texTop,texLeft,texRight); } diff --git a/Gui/ViewerTab30.cpp b/Gui/ViewerTab30.cpp index c24054c29f..f60c6a4bcb 100644 --- a/Gui/ViewerTab30.cpp +++ b/Gui/ViewerTab30.cpp @@ -1219,9 +1219,8 @@ ViewerTab::onClipPreferencesChanged() setInfoBarAndViewerResolution(format, canonicalFormat, format.getPixelAspectRatio(), i); } else { RectI inputFormat = input->getOutputFormat(); - RectD inputCanonicalFormat; double inputPar = input->getAspectRatio(-1); - inputFormat.toCanonical_noClipping(0, inputPar, &inputCanonicalFormat); + RectD inputCanonicalFormat = inputFormat.toCanonical_noClipping(0, inputPar); setInfoBarAndViewerResolution(inputFormat, inputCanonicalFormat, inputPar, i); diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8c65f2e33c..333e6038d3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -22,14 +22,14 @@ set(Tests_SOURCES google-test/src/gtest-all.cc google-mock/src/gmock-all.cc BaseTest.cpp + Curve_Test.cpp + FileSystemModel_Test.cpp Hash64_Test.cpp Image_Test.cpp + KnobFile_Test.cpp Lut_Test.cpp OSGLContext_Test.cpp - KnobFile_Test.cpp - Curve_Test.cpp Tracker_Test.cpp - OSGLContext_Test.cpp wmain.cpp ) add_executable(Tests ${Tests_HEADERS} ${Tests_SOURCES}) diff --git a/Tests/FileSystemModel_Test.cpp b/Tests/FileSystemModel_Test.cpp new file mode 100644 index 0000000000..9ea83ab404 --- /dev/null +++ b/Tests/FileSystemModel_Test.cpp @@ -0,0 +1,258 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * This file is part of Natron , + * (C) 2018-2023 The Natron developers + * (C) 2013-2018 INRIA and Alexandre Gauthier-Foichat + * + * Natron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Natron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Natron. If not, see + * ***** END LICENSE BLOCK ***** */ + +#include "Global/Macros.h" + +#include + +#include "Engine/FileSystemModel.h" + +NATRON_NAMESPACE_USING + +namespace { + +class MockSortableView : public SortableViewI { + public: + MockSortableView() = default; + ~MockSortableView() override {} + + // SortableViewI methods + Qt::SortOrder sortIndicatorOrder() const override { return _sortOrder; } + + int sortIndicatorSection() const override { return _sortSection; } + + void onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order) override { + _sortSection = logicalIndex; + _sortOrder = order; + } + + private: + int _sortSection = 0; + Qt::SortOrder _sortOrder = Qt::AscendingOrder; +}; + +} // namespace + +TEST(FileSystemModelTest, DriveName) { + MockSortableView sortableView; + auto model = std::make_shared(); + model->initialize(&sortableView); + + struct DriveNameTestCase { + const char* input; + bool isWindowsDriveName; + bool startsWithWindowsDriveName; + bool isUnixDriveName; + bool startsWithUnixDriveName; + }; + std::vector testCases({ + {"", false, false, false, false}, + {"filename.txt", false, false, false, false}, + {"somedir/", false, false, false, false}, + {"somedir/filename.txt", false, false, false, false}, + {"/", false, false, true, true}, + {"/filename.txt", false, false, false, true}, + {"/somedir/", false, false, false, true}, + {"/somedir/filename.txt", false, false, false, true}, + {"c:", false, false, false, false}, + {"c:/", true, true, false, false}, + {"c:\\", true, true, false, false}, + {"c:/filename.txt", false, true, false, false}, + {"c:\\filename.txt", false, true, false, false}, + {"c:/somedir/", false, true, false, false}, + {"c:/somedir/filename.txt", false, true, false, false}, + {"c:\\somedir\\", false, true, false, false}, + {"c:\\somedir\\filename.txt", false, true, false, false}, + {"//", false, false, false, true}, + {"//somehost", false, false, false, true}, + {"//somehost/", true, true, false, true}, + {"//somehost/somedir/", false, true, false, true}, + {"//somehost/somedir/filename.txt", false, true, false, true}, + }); + + for (const auto& testCase : testCases) { + const QString input = QString::fromUtf8(testCase.input); +#ifdef __NATRON_WIN32__ + const bool expectedIsDriveName = testCase.isWindowsDriveName; + const bool expectedStartsWithDriveName = + testCase.startsWithWindowsDriveName; +#else + const bool expectedIsDriveName = testCase.isUnixDriveName; + const bool expectedStartsWithDriveName = testCase.startsWithUnixDriveName; +#endif + + EXPECT_EQ(expectedIsDriveName, FileSystemModel::isDriveName(input)) + << " input '" << testCase.input << "'"; + EXPECT_EQ(expectedStartsWithDriveName, + FileSystemModel::startsWithDriveName(input)) + << " input '" << testCase.input << "'"; + } +} + +TEST(FileSystemModelTest, GetSplitPath) { + MockSortableView sortableView; + auto model = std::make_shared(); + model->initialize(&sortableView); + + struct SplitPathTestCase { + const char* input; + std::vector expectedWindowsOutput; + std::vector expectedUnixOutput; + }; + std::vector testCases({ + {"", {}, {}}, + {"filename.txt", {"filename.txt"}, {"filename.txt"}}, + {"somedir/", {"somedir"}, {"somedir"}}, + {"somedir/filename.txt", + {"somedir", "filename.txt"}, + {"somedir", "filename.txt"}}, + {"/", {""}, {"/", ""}}, + {"/filename.txt", {"", "filename.txt"}, {"/", "filename.txt"}}, + {"/somedir/", {"", "somedir"}, {"/", "somedir"}}, + {"/somedir/filename.txt", + {"", "somedir", "filename.txt"}, + {"/", "somedir", "filename.txt"}}, + {"c:", {"c:"}, {"c:"}}, + {"c:/", {"c:/", ""}, {"c:"}}, + {"c:\\", {"c:\\", ""}, {"c:\\"}}, + {"c:/filename.txt", {"c:/", "filename.txt"}, {"c:", "filename.txt"}}, + {"c:\\filename.txt", {"c:\\", "filename.txt"}, {"c:\\filename.txt"}}, + {"c:/somedir/", {"c:/", "somedir"}, {"c:", "somedir"}}, + {"c:/somedir/filename.txt", + {"c:/", "somedir", "filename.txt"}, + {"c:", "somedir", "filename.txt"}}, + {"c:\\somedir\\", {"c:\\", "somedir\\"}, {"c:\\somedir\\"}}, + {"c:\\somedir\\filename.txt", + {"c:\\", "somedir\\filename.txt"}, + {"c:\\somedir\\filename.txt"}}, + {"//", {"", ""}, {"/", ""}}, + {"//somehost", + {"", "", "somehost"}, // Not considered a network path because + // of missing slash after hostname. + {"/", "", "somehost"}}, + {"//somehost/", {"//somehost/", ""}, {"/", "", "somehost"}}, + {"//somehost/somedir/", + {"//somehost/", "somedir"}, + {"/", "", "somehost", "somedir"}}, + {"//somehost/somedir/filename.txt", + {"//somehost/", "somedir", "filename.txt"}, + {"/", "", "somehost", "somedir", "filename.txt"}}, + }); + + for (const auto& testCase : testCases) { + const QString input = QString::fromUtf8(testCase.input); + +#ifdef __NATRON_WIN32__ + const auto& expectedOutput = testCase.expectedWindowsOutput; +#else + const auto& expectedOutput = testCase.expectedUnixOutput; +#endif + + const int expectedSize = static_cast(expectedOutput.size()); + const auto output = FileSystemModel::getSplitPath(input); + EXPECT_EQ(expectedSize, output.size()) << "input '" << testCase.input + << "'"; + + for (int i = 0; i < expectedSize && i < output.size(); ++i) { + EXPECT_EQ(expectedOutput[i], output[i].toStdString()) + << "input '" << testCase.input << "' i " << i; + } + } +} + +TEST(FileSystemModelTest, CleanPath) { + MockSortableView sortableView; + auto model = std::make_shared(); + model->initialize(&sortableView); + + struct CleanPathTestCase { + const char* input; + const char* expectedWindowsOutput; // nullptr if the expectation is the + // same as input. + const char* expectedUnixOutput; // nullptr if the expectation is the same + // as expectedWindowsOutput. + }; + + std::vector testCases({ + // Paths that behave the same on all platforms. + // - Verify trailing slashes are removed. + {"", nullptr, nullptr}, + {"filename.txt", nullptr, nullptr}, + {"somedir/", "somedir", nullptr}, + {"somedir/filename.txt", nullptr, nullptr}, + {"/", nullptr, nullptr}, + {"/filename.txt", nullptr, nullptr}, + {"/somedir/", "/somedir", nullptr}, + {"/somedir/filename.txt", nullptr, nullptr}, + {"c:", nullptr, nullptr}, + // Platform specific path behaviors. + // Paths with Windows drive letters and backslashes. + // - Verify drive letters become capitalized on Windows + // - Verify drives keep their trailing slash. + // - Verify backslashes are converted to forward slashes on Windows. + // - Verify Unix platforms do not treat forward slashes and drive + // letters in special way. + {"c:/", "C:/", "c:"}, + {"c:\\", "C:/", "c:\\"}, + {"c:/filename.txt", "C:/filename.txt", "c:/filename.txt"}, + {"c:\\filename.txt", "C:/filename.txt", "c:\\filename.txt"}, + {"c:/somedir/", "C:/somedir", "c:/somedir"}, + {"c:/somedir/filename.txt", "C:/somedir/filename.txt", "c:/somedir/filename.txt"}, + {"c:\\somedir\\", "C:/somedir", "c:\\somedir\\"}, + {"c:\\somedir\\filename.txt", "C:/somedir/filename.txt", + "c:\\somedir\\filename.txt"}, + // Windows Network Shares + // - Verify that hostname is capitalized on Windows as long as it + // is followed by a /. + // - Verify Unix just collapses the '//' to a single slash. + {"//", "/", nullptr}, + {"//somehost", "//somehost", "/somehost"}, + {"//somehost/", "//SOMEHOST/", "/somehost"}, + {"//somehost/somedir/", "//SOMEHOST/somedir", "/somehost/somedir"}, + {"//somehost/somedir/filename.txt", + "//SOMEHOST/somedir/filename.txt", + "/somehost/somedir/filename.txt"}, + }); + + for (const auto& testCase : testCases) { + const QString input = QString::fromUtf8(testCase.input); + std::string expectedOutput; + +#ifdef __NATRON_WIN32__ + if (testCase.expectedWindowsOutput != nullptr) { + expectedOutput = testCase.expectedWindowsOutput; + } else { + expectedOutput = testCase.input; + } +#else + if (testCase.expectedUnixOutput != nullptr) { + expectedOutput = testCase.expectedUnixOutput; + } else if (testCase.expectedWindowsOutput != nullptr) { + expectedOutput = testCase.expectedWindowsOutput; + } else { + expectedOutput = testCase.input; + } +#endif + // Make sure the expectation was actually set to something. + assert(!expectedOutput.isNull()); + + const auto output = FileSystemModel::cleanPath(input).toStdString(); + EXPECT_EQ(expectedOutput, output) << " input '" << testCase.input << "'"; + } +} \ No newline at end of file diff --git a/Tests/Tests.pro b/Tests/Tests.pro index 41cf49ea1b..af421fc5c0 100644 --- a/Tests/Tests.pro +++ b/Tests/Tests.pro @@ -44,13 +44,14 @@ SOURCES += \ google-test/src/gtest-all.cc \ google-mock/src/gmock-all.cc \ BaseTest.cpp \ + Curve_Test.cpp \ + FileSystemModel_Test.cpp \ Hash64_Test.cpp \ Image_Test.cpp \ - Lut_Test.cpp \ KnobFile_Test.cpp \ - Curve_Test.cpp \ - Tracker_Test.cpp \ + Lut_Test.cpp \ OSGLContext_Test.cpp \ + Tracker_Test.cpp \ wmain.cpp HEADERS += \ diff --git a/libs/glog/CMakeLists.txt b/libs/glog/CMakeLists.txt index bd825c4543..95dc6fe65d 100644 --- a/libs/glog/CMakeLists.txt +++ b/libs/glog/CMakeLists.txt @@ -36,7 +36,7 @@ set(glog_SOURCES src/utilities.cc src/vlog_is_on.cc ) -if(WINDOWS) +if(WIN32) set(glog_HEADERS ${glog_HEADERS} src/windows/config.h @@ -74,9 +74,10 @@ endif() add_library(glog STATIC ${glog_HEADERS} ${glog_SOURCES}) target_include_directories(glog PRIVATE src) target_compile_definitions(glog PRIVATE GOOGLE_GLOG_DLL_DECL=) -if(WINDOWS) - target_include_directories(APPEND glog src/windows) - target_compile_definitions(APPEND glog GLOG_NO_ABBREVIATED_SEVERITIES) +if(WIN32) + target_include_directories(glog AFTER PRIVATE src/windows) + target_compile_definitions(glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES GOOGLE_GLOG_DLL_DECL= ) + target_compile_definitions(glog PRIVATE HAVE_PTHREAD _POSIX_THREAD_SAFE_FUNCTIONS ) endif() target_link_libraries(glog PUBLIC gflags) set_target_properties(glog PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD b/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD index 875db9d885..a2cea2497e 100644 --- a/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-ffmpeg-gpl2/PKGBUILD @@ -46,11 +46,16 @@ depends=("${MINGW_PACKAGE_PREFIX}-bzip2" makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-nasm") -source=(https://ffmpeg.org/releases/${_realname}-${pkgver}.tar.xz) -sha256sums=('6c5b6c195e61534766a0b5fe16acc919170c883362612816d0a1c7f4f947006e') +source=(https://ffmpeg.org/releases/${_realname}-${pkgver}.tar.xz + https://github.com/FFmpeg/FFmpeg/commit/effadce6c756247ea8bae32dc13bb3e6f464f0eb.patch) +sha256sums=('6c5b6c195e61534766a0b5fe16acc919170c883362612816d0a1c7f4f947006e' + '206f4d8437b21f6197ffc444c86d0504892a5c2137cb227b4af1c1e8bf2c426c') prepare() { cd "${srcdir}/${_realname}-${pkgver}" + + # https://github.com/msys2/MINGW-packages/issues/17946 + patch -Nbp1 -i "${srcdir}"/effadce6c756247ea8bae32dc13bb3e6f464f0eb.patch } build() { diff --git a/tools/MINGW-packages/mingw-w64-imath/PKGBUILD b/tools/MINGW-packages/mingw-w64-imath/PKGBUILD index f64a912040..adc25be926 100644 --- a/tools/MINGW-packages/mingw-w64-imath/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-imath/PKGBUILD @@ -3,7 +3,7 @@ _realname=imath pkgbase=mingw-w64-natron_${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-natron_${_realname}") -pkgver=3.1.7 +pkgver=3.1.9 pkgrel=99.1 pkgdesc='A C++ and python library of 2D and 3D vector, matrix, and math operations for computer graphics (mingw-w64)' url='https://www.openexr.com/' @@ -22,7 +22,7 @@ optdepends=("${MINGW_PACKAGE_PREFIX}-python: python bindings" source=("https://github.com/AcademySoftwareFoundation/Imath/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz" 0001-cmake-libs-name.patch 0002-fix-openexr-clang-build.patch) -sha256sums=('bff1fa140f4af0e7f02c6cb78d41b9a7d5508e6bcdfda3a583e35460eb6d4b47' +sha256sums=('f1d8aacd46afed958babfced3190d2d3c8209b66da451f556abd6da94c165cf3' '2dc2de52e2475cc9d725ff443466d3ac247a405018f1d9b0caeb03a9d5116d9b' '0eea3c7b57d5b59887f963d696c2afdcfb1976a3913f161995e19b13d6a65086') diff --git a/tools/MINGW-packages/mingw-w64-opencolorio2-git/Findyaml-cpp.patch b/tools/MINGW-packages/mingw-w64-opencolorio2-git/Findyaml-cpp.patch new file mode 100644 index 0000000000..3ac10cdb81 --- /dev/null +++ b/tools/MINGW-packages/mingw-w64-opencolorio2-git/Findyaml-cpp.patch @@ -0,0 +1,22 @@ +diff --git a/share/cmake/modules/Findyaml-cpp.cmake b/share/cmake/modules/Findyaml-cpp.cmake +index 1dd81055..13f58c54 100644 +--- a/share/cmake/modules/Findyaml-cpp.cmake ++++ b/share/cmake/modules/Findyaml-cpp.cmake +@@ -34,7 +34,7 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL) + endif() + + if(yaml-cpp_FOUND) +- get_target_property(yaml-cpp_LIBRARY yaml-cpp LOCATION) ++ get_target_property(yaml-cpp_LIBRARY yaml-cpp::yaml-cpp LOCATION) + else() + + # As yaml-cpp-config.cmake search fails, search an installed library +@@ -114,7 +114,7 @@ endif() + ############################################################################### + ### Create target (if previous 'find_package' call hasn't) ### + +-if(NOT TARGET yaml-cpp) ++if(NOT TARGET yaml-cpp::yaml-cpp) + add_library(yaml-cpp UNKNOWN IMPORTED GLOBAL) + set(_yaml-cpp_TARGET_CREATE TRUE) + endif() diff --git a/tools/MINGW-packages/mingw-w64-opencolorio2-git/PKGBUILD b/tools/MINGW-packages/mingw-w64-opencolorio2-git/PKGBUILD index 4e7ff3a023..7ac4a73bd0 100644 --- a/tools/MINGW-packages/mingw-w64-opencolorio2-git/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-opencolorio2-git/PKGBUILD @@ -26,10 +26,12 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" options=('strip') source=("${_realname}"::"git+https://github.com/imageworks/OpenColorIO.git#commit=${gitcommit}" OpenColorIO.pc - ocio-2.1.1.patch) + ocio-2.1.1.patch + Findyaml-cpp.patch) sha256sums=('SKIP' '1e825196e03f26f30d426f84c01ad408ab6cbaaae5b7a06faa7571c2733d6936' - '8047d94b5b940c9686b2df34f441ff53947877bcdaae82072180d68c9d547138') + '8047d94b5b940c9686b2df34f441ff53947877bcdaae82072180d68c9d547138' + 'bb8a10566c3f105d7e9323bf84f7c943a9085d74660316b354c3b506da880101') pkgver() { cd "${srcdir}/${_realname}" @@ -39,6 +41,7 @@ pkgver() { prepare() { cd ${_realname} #patch -p1 -i ${srcdir}/ocio-2.1.1.patch + patch -p1 -i ${srcdir}/Findyaml-cpp.patch } build() { diff --git a/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD b/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD index a0e242e4bb..e06f3be48a 100644 --- a/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-openexr/PKGBUILD @@ -3,7 +3,7 @@ _realname=openexr pkgbase=mingw-w64-natron_${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-natron_${_realname}") -pkgver=3.1.7 +pkgver=3.1.8 pkgrel=99.1 pkgdesc='A high dynamic-range image file format library (mingw-w64)' arch=('any') @@ -27,7 +27,7 @@ replaces=( ) source=("https://github.com/openexr/openexr/archive/v${pkgver}/${_realname}-${pkgver}.tar.gz" 0006-cmake-soversion.patch) -sha256sums=('78dbca39115a1c526e6728588753955ee75fa7f5bb1a6e238bed5b6d66f91fd7' +sha256sums=('3ff47111ef7e5da6f69330e66e1e90ae620b79df1cedf2512bb9bffe86c2c617' 'e65852ac2e5545472ad90830c97e964aa2c71e1795979a8b9867155d578d45ed') # Helper macros to help make tasks easier # diff --git a/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD b/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD index 64c5a4b67b..3a7cc69c86 100644 --- a/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-openimageio/PKGBUILD @@ -3,7 +3,7 @@ _realname=openimageio pkgbase=mingw-w64-natron_${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-natron_${_realname}" -pkgver=2.4.10.0 +pkgver=2.4.13.0 pkgrel=99.1 pkgdesc="A library for reading and writing images, including classes, utilities, and applications (mingw-w64)" arch=('any') @@ -33,12 +33,14 @@ source=(${_realname}-${pkgver}.tar.gz::https://github.com/OpenImageIO/oiio/archi oiio-2.1.10-boost.diff oiio-2.0.8-invalidatespec.patch oiio-2.2.14-libraw.diff + oiio-2.4.13.0-thread-shutdown.patch # Remove when updating to a future 2.5 release that has these changes. ) -sha256sums=('59f523a0b9a1014993bedcf7752993af43b348761165f52ea6eb84787f57aed5' +sha256sums=('72b7d2d5edd1049bb7fc09becad4d8be64a9918cdf79bae98b4b32e1fda762cd' 'SKIP' 'e8aec185fd20a6e5cdf77a7155fcaedb301c07bd806f73bd30dfc75af721ac83' 'd9c2e066ce0e94404d31fd649341cc0ee03faf9b4023dfcdf5cf59fbbf466127' '89e21326d6445304293bcedc3a52bfa1dfec9b769b397f6a312ca27d1de93423' + '3847eba62ac7a689c4c70b814461583d9c6e921259dd0343b17509d8b35d6f0f' ) prepare() { @@ -46,6 +48,7 @@ prepare() { #patch -p0 -i ${srcdir}/oiio-2.1.10-boost.diff patch -p1 -i ${srcdir}/oiio-2.0.8-invalidatespec.patch patch -p0 -i ${srcdir}/oiio-2.2.14-libraw.diff + patch -p1 -i ${srcdir}/oiio-2.4.13.0-thread-shutdown.patch } build() { diff --git a/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.4.13.0-thread-shutdown.patch b/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.4.13.0-thread-shutdown.patch new file mode 100644 index 0000000000..85f6065ee4 --- /dev/null +++ b/tools/MINGW-packages/mingw-w64-openimageio/oiio-2.4.13.0-thread-shutdown.patch @@ -0,0 +1,157 @@ +diff --git a/src/include/OpenImageIO/thread.h b/src/include/OpenImageIO/thread.h +index fa66f06de..c6f1b6c38 100644 +--- a/src/include/OpenImageIO/thread.h ++++ b/src/include/OpenImageIO/thread.h +@@ -31,6 +31,7 @@ + #include + + ++#define NATRON_OIIO_HAS_DEFAULT_THREAD_POOL_SHUTDOWN 1 + + // OIIO_THREAD_ALLOW_DCLP, if set to 0, prevents us from using a dodgy + // "double checked lock pattern" (DCLP). We are very careful to construct +@@ -112,11 +113,19 @@ pause(int delay) noexcept + + #elif defined(_MSC_VER) + for (int i = 0; i < delay; ++i) { +-# if defined(_WIN64) +- YieldProcessor(); +-# else ++ // A reimplementation of winnt.h YieldProcessor, ++ // to avoid including windows headers. ++ #if defined(_M_AMD64) ++ _mm_pause(); ++ #elif defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64) ++ __dmb(_ARM64_BARRIER_ISHST); ++ __yield(); ++ #elif defined(_M_ARM) ++ __dmb(_ARM_BARRIER_ISHST); ++ __yield(); ++ #else + _asm pause +-# endif /* _WIN64 */ ++ #endif + } + + #else +@@ -762,10 +771,18 @@ private: + + + /// Return a reference to the "default" shared thread pool. In almost all +-/// ordinary circumstances, you should use this exclusively to get a +-/// single shared thread pool, since creating multiple thread pools +-/// could result in hilariously over-threading your application. +-OIIO_UTIL_API thread_pool* default_thread_pool (); ++/// ordinary circumstances, you should use this exclusively to get a single ++/// shared thread pool, since creating multiple thread pools could result in ++/// hilariously over-threading your application. Note that this call may ++/// (safely, and only once) trigger creation of the thread pool and its ++/// worker threads if it has not yet been created. ++OIIO_UTIL_API thread_pool* default_thread_pool(); ++ ++/// If a thread pool has been created, this call will safely terminate its ++/// worker threads. This should presumably be called by an application ++/// immediately before it exists, when it is confident the thread pool will ++/// no longer be needed. ++OIIO_UTIL_API void default_thread_pool_shutdown(); + + + +diff --git a/src/libutil/thread.cpp b/src/libutil/thread.cpp +index 234e4ceb5..84ce66d32 100644 +--- a/src/libutil/thread.cpp ++++ b/src/libutil/thread.cpp +@@ -35,6 +35,13 @@ + + #include + ++#ifdef _WIN32 ++# define WIN32_LEAN_AND_MEAN ++# define VC_EXTRALEAN ++# define NOMINMAX ++# include ++#endif ++ + #if 0 + + // Use boost::lockfree::queue for the task queue +@@ -151,10 +158,10 @@ public: + this->set_thread(i); + } + } else { // the number of threads is decreased ++ std::vector> terminating_threads; + for (int i = oldNThreads - 1; i >= nThreads; --i) { + *this->flags[i] = true; // this thread will finish +- this->terminating_threads.push_back( +- std::move(this->threads[i])); ++ terminating_threads.push_back(std::move(this->threads[i])); + this->threads.erase(this->threads.begin() + i); + } + { +@@ -162,6 +169,11 @@ public: + std::unique_lock lock(this->mutex); + this->cv.notify_all(); + } ++ // wait for the terminated threads to finish ++ for (auto& thread : terminating_threads) { ++ if (thread->joinable()) ++ thread->join(); ++ } + this->threads.resize( + nThreads); // safe to delete because the threads are detached + this->flags.resize( +@@ -238,16 +250,10 @@ public: + if (thread->joinable()) + thread->join(); + } +- // wait for the terminated threads to finish +- for (auto& thread : this->terminating_threads) { +- if (thread->joinable()) +- thread->join(); +- } + // if there were no threads in the pool but some functors in the queue, the functors are not deleted by the threads + // therefore delete them here + this->clear_queue(); + this->threads.clear(); +- this->terminating_threads.clear(); + this->flags.clear(); + } + +@@ -349,7 +355,6 @@ private: + } + + std::vector> threads; +- std::vector> terminating_threads; + std::vector>> flags; + mutable pvt::ThreadsafeQueue*> q; + std::atomic isDone; +@@ -471,15 +476,29 @@ thread_pool::very_busy() const + + + ++static atomic_int default_thread_pool_created(0); ++ ++ ++ + thread_pool* + default_thread_pool() + { + static std::unique_ptr shared_pool(new thread_pool); ++ default_thread_pool_created = 1; + return shared_pool.get(); + } + + + ++void ++default_thread_pool_shutdown() ++{ ++ if (default_thread_pool_created) ++ default_thread_pool()->resize(0); ++} ++ ++ ++ + void + task_set::wait_for_task(size_t taskindex, bool block) + { diff --git a/tools/MINGW-packages/mingw-w64-sox/PKGBUILD b/tools/MINGW-packages/mingw-w64-sox/PKGBUILD index 67e78c56fe..45ae3f7bfd 100644 --- a/tools/MINGW-packages/mingw-w64-sox/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-sox/PKGBUILD @@ -11,11 +11,21 @@ url="https://sourceforge.net/projects/sox" license=("LGPL") makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" - #"${MINGW_PACKAGE_PREFIX}-cmake" + "${MINGW_PACKAGE_PREFIX}-autotools" ) depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-libmad") -source=("https://downloads.sourceforge.net/sourceforge/${_realname}/${_realname}-$pkgver.tar.bz2") -sha256sums=('81a6956d4330e75b5827316e44ae381e6f1e8928003c6aa45896da9041ea149c') +source=("https://downloads.sourceforge.net/sourceforge/${_realname}/${_realname}-$pkgver.tar.bz2" + "remove-libssp-detection.patch") +sha256sums=('81a6956d4330e75b5827316e44ae381e6f1e8928003c6aa45896da9041ea149c' + '57d8fe423a97b554d4f34a9952a9827974ecc5f706ac602c4dd77d32bae2afd6') + +prepare() { + cd "${srcdir}/${_realname}-${pkgver}" + + patch -Np1 -i "${srcdir}/remove-libssp-detection.patch" + + autoreconf -fiv +} build() { [[ -d "build-${MINGW_CHOST}" ]] && rm -rf "build-${MINGW_CHOST}" diff --git a/tools/MINGW-packages/mingw-w64-sox/remove-libssp-detection.patch b/tools/MINGW-packages/mingw-w64-sox/remove-libssp-detection.patch new file mode 100644 index 0000000000..fead996d37 --- /dev/null +++ b/tools/MINGW-packages/mingw-w64-sox/remove-libssp-detection.patch @@ -0,0 +1,12 @@ +diff -ur a/configure.ac b/configure.ac +--- a/configure.ac 2023-05-24 12:03:25.035127900 -0700 ++++ b/configure.ac 2023-05-24 13:30:49.809646400 -0700 +@@ -114,7 +114,7 @@ + # break here) + + # Get -lssp if it exists +- GCC_STACK_PROTECT_LIB ++ #GCC_STACK_PROTECT_LIB + + AC_MSG_CHECKING([whether stack-smashing protection is available]) + ssp_old_cflags="$CFLAGS" diff --git a/tools/MacPorts/devel/gnutls/Portfile b/tools/MacPorts/devel/gnutls/Portfile index 3341c83710..3467702d77 100644 --- a/tools/MacPorts/devel/gnutls/Portfile +++ b/tools/MacPorts/devel/gnutls/Portfile @@ -9,8 +9,8 @@ PortGroup legacysupport 1.0 PortGroup muniversal 1.0 name gnutls -version 3.7.9 -revision 2 +version 3.7.10 +revision 0 categories devel security # yes, some of the libs are GPL only license LGPL-2.1+ GPL-3+ @@ -23,23 +23,27 @@ long_description \ Lesser General Public License (LGPL). homepage http://www.gnutls.org/ -checksums rmd160 0869a8d906afff9e3b28ceb9241cb7b53b464998 \ - sha256 aaa03416cdbd54eb155187b359e3ec3ed52ec73df4df35a0edd49429ff64d844 \ - size 6377212 +checksums rmd160 e221dc4200d30b8644cfe1f2c8d5e7bccac8aca0 \ + sha256 b6e4e8bac3a950a3a1b7bdb0904979d4ab420a81e74de8636dd50b467d36f5a9 \ + size 6407852 subport ${name} { conflicts ${name}-devel + + patchfiles patch-lib-system-certs.c.old.diff } subport ${name}-devel { conflicts ${name} - version 3.8.0 + version 3.8.1 revision 0 - checksums rmd160 927aa3762946bcb3ef825832d7895f041e66a314 \ - sha256 0ea0d11a1660a1e63f960f157b197abe6d0c8cb3255be24e1fb3815930b9bdc5 \ - size 6378480 + checksums rmd160 d9a09dec344ec897e7abaf408ba93e25e91ca2ad \ + sha256 ba8b9e15ae20aba88f44661978f5b5863494316fe7e722ede9d069fe6294829c \ + size 6447056 + + patchfiles patch-lib-system-certs.c.diff } if {${build_arch} ne "ppc" || ${build_arch} ne "ppc64"} { @@ -65,7 +69,6 @@ conflicts_build autogen depends_build-append \ port:gettext \ - port:gtk-doc \ port:pkgconfig depends_lib-append \ @@ -78,7 +81,7 @@ depends_lib-append \ port:nettle \ port:zlib -patchfiles patch-lib-system-certs.c.diff \ +patchfiles-append \ implicit.patch post-patch { @@ -89,11 +92,13 @@ post-patch { # Note: configure script detects zstd, but flags it as missing anyway configure.args-append \ --disable-dependency-tracking \ + --disable-doc \ --disable-guile \ --disable-heartbeat-support \ --disable-libdane \ --disable-silent-rules \ --disable-static \ + --enable-manpages \ --enable-openssl-compatibility \ --with-p11-kit \ --with-system-priority-file="${prefix}/etc/gnutls/default-priorities" \ @@ -102,6 +107,9 @@ configure.args-append \ --without-zstd \ ac_cv_prog_AWK=/usr/bin/awk +# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr +configure.checks.implicit_function_declaration.whitelist-append strchr + compiler.thread_local_storage yes # Undefined symbols for architecture x86_64: "___get_cpuid_count" @@ -132,6 +140,14 @@ variant dane description {Build libdane using unbound libraries} { configure.args-delete --disable-libdane } +variant docs description {Install supplemental developer documentation} { + depends_build-append \ + port:gtk-doc + + configure.args-delete \ + --disable-doc +} + # as of r120660 (#43881) unbound installs its root key file at ${prefix}/var/run/unbound/root.key # the following may be superfluous diff --git a/tools/MacPorts/devel/gnutls/Portfile.orig b/tools/MacPorts/devel/gnutls/Portfile.orig index 9b060debfb..b9b1c28c14 100644 --- a/tools/MacPorts/devel/gnutls/Portfile.orig +++ b/tools/MacPorts/devel/gnutls/Portfile.orig @@ -9,8 +9,8 @@ PortGroup legacysupport 1.0 PortGroup muniversal 1.0 name gnutls -version 3.7.9 -revision 2 +version 3.7.10 +revision 0 categories devel security # yes, some of the libs are GPL only license LGPL-2.1+ GPL-3+ @@ -23,23 +23,27 @@ long_description \ Lesser General Public License (LGPL). homepage http://www.gnutls.org/ -checksums rmd160 0869a8d906afff9e3b28ceb9241cb7b53b464998 \ - sha256 aaa03416cdbd54eb155187b359e3ec3ed52ec73df4df35a0edd49429ff64d844 \ - size 6377212 +checksums rmd160 e221dc4200d30b8644cfe1f2c8d5e7bccac8aca0 \ + sha256 b6e4e8bac3a950a3a1b7bdb0904979d4ab420a81e74de8636dd50b467d36f5a9 \ + size 6407852 subport ${name} { conflicts ${name}-devel + + patchfiles patch-lib-system-certs.c.old.diff } subport ${name}-devel { conflicts ${name} - version 3.8.0 + version 3.8.1 revision 0 - checksums rmd160 927aa3762946bcb3ef825832d7895f041e66a314 \ - sha256 0ea0d11a1660a1e63f960f157b197abe6d0c8cb3255be24e1fb3815930b9bdc5 \ - size 6378480 + checksums rmd160 d9a09dec344ec897e7abaf408ba93e25e91ca2ad \ + sha256 ba8b9e15ae20aba88f44661978f5b5863494316fe7e722ede9d069fe6294829c \ + size 6447056 + + patchfiles patch-lib-system-certs.c.diff } if {${build_arch} ne "ppc" || ${build_arch} ne "ppc64"} { @@ -65,7 +69,6 @@ conflicts_build autogen depends_build-append \ port:gettext \ - port:gtk-doc \ port:pkgconfig depends_lib-append \ @@ -78,7 +81,7 @@ depends_lib-append \ port:nettle \ port:zlib -patchfiles patch-lib-system-certs.c.diff \ +patchfiles-append \ implicit.patch post-patch { @@ -89,11 +92,13 @@ post-patch { # Note: configure script detects zstd, but flags it as missing anyway configure.args-append \ --disable-dependency-tracking \ + --disable-doc \ --disable-guile \ --disable-heartbeat-support \ --disable-libdane \ --disable-silent-rules \ --disable-static \ + --enable-manpages \ --enable-openssl-compatibility \ --with-p11-kit \ --with-system-priority-file="${prefix}/etc/gnutls/default-priorities" \ @@ -102,6 +107,9 @@ configure.args-append \ --without-zstd \ ac_cv_prog_AWK=/usr/bin/awk +# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr +configure.checks.implicit_function_declaration.whitelist-append strchr + compiler.thread_local_storage yes # Undefined symbols for architecture x86_64: "___get_cpuid_count" @@ -132,6 +140,14 @@ variant dane description {Build libdane using unbound libraries} { configure.args-delete --disable-libdane } +variant docs description {Install supplemental developer documentation} { + depends_build-append \ + port:gtk-doc + + configure.args-delete \ + --disable-doc +} + # as of r120660 (#43881) unbound installs its root key file at ${prefix}/var/run/unbound/root.key # the following may be superfluous diff --git a/tools/MacPorts/devel/gnutls/files/patch-lib-system-certs.c.diff b/tools/MacPorts/devel/gnutls/files/patch-lib-system-certs.c.diff index 923857c83d..7986926347 100644 --- a/tools/MacPorts/devel/gnutls/files/patch-lib-system-certs.c.diff +++ b/tools/MacPorts/devel/gnutls/files/patch-lib-system-certs.c.diff @@ -1,18 +1,16 @@ ---- ./lib/system/certs.c.old 2017-04-14 10:36:27.000000000 -0700 -+++ ./lib/system/certs.c 2017-04-14 10:37:10.000000000 -0700 -@@ -47,8 +47,15 @@ +--- lib/system/certs.c.orig 2023-08-04 01:20:32 ++++ lib/system/certs.c 2023-08-11 05:05:09 +@@ -47,7 +47,13 @@ #ifdef __APPLE__ - # include - # include + #include + #include +#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 - # include + #include +#else +# include +#endif - #endif +#endif -+ + #endif /* System specific function wrappers for certificate stores. - */ diff --git a/tools/MacPorts/devel/gnutls/files/patch-lib-system-certs.c.old.diff b/tools/MacPorts/devel/gnutls/files/patch-lib-system-certs.c.old.diff new file mode 100644 index 0000000000..923857c83d --- /dev/null +++ b/tools/MacPorts/devel/gnutls/files/patch-lib-system-certs.c.old.diff @@ -0,0 +1,18 @@ +--- ./lib/system/certs.c.old 2017-04-14 10:36:27.000000000 -0700 ++++ ./lib/system/certs.c 2017-04-14 10:37:10.000000000 -0700 +@@ -47,8 +47,15 @@ + #ifdef __APPLE__ + # include + # include ++#ifndef __MAC_OS_X_VERSION_MIN_REQUIRED ++#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 + # include ++#else ++# include ++#endif + #endif ++#endif ++ + + /* System specific function wrappers for certificate stores. + */ diff --git a/tools/MacPorts/graphics/ImageMagick/Portfile b/tools/MacPorts/graphics/ImageMagick/Portfile index 95e80553aa..4fcfe2d9cc 100644 --- a/tools/MacPorts/graphics/ImageMagick/Portfile +++ b/tools/MacPorts/graphics/ImageMagick/Portfile @@ -13,7 +13,7 @@ name ImageMagick # 6.9.11-61 changes the major version of libMagickCore which will # require increasing the revision of all ports that link with it. version 6.9.11-60 -revision 7 +revision 10 checksums rmd160 1c293ba06fd43833be35efb4476e559bf137ccef \ sha256 ba0fa683b0721d1f22b0ccb364e4092e9a7a34ffd3bd6348c82b50fd93b1d7ba \ size 9167220 diff --git a/tools/MacPorts/graphics/ImageMagick/Portfile.orig b/tools/MacPorts/graphics/ImageMagick/Portfile.orig index 300cbc5bad..2659c68888 100644 --- a/tools/MacPorts/graphics/ImageMagick/Portfile.orig +++ b/tools/MacPorts/graphics/ImageMagick/Portfile.orig @@ -12,7 +12,7 @@ name ImageMagick # 6.9.11-61 changes the major version of libMagickCore which will # require increasing the revision of all ports that link with it. version 6.9.11-60 -revision 7 +revision 10 checksums rmd160 1c293ba06fd43833be35efb4476e559bf137ccef \ sha256 ba0fa683b0721d1f22b0ccb364e4092e9a7a34ffd3bd6348c82b50fd93b1d7ba \ size 9167220 diff --git a/tools/MacPorts/graphics/opencolorio/Portfile b/tools/MacPorts/graphics/opencolorio/Portfile index 4dbbf1da8b..d39a5c3622 100644 --- a/tools/MacPorts/graphics/opencolorio/Portfile +++ b/tools/MacPorts/graphics/opencolorio/Portfile @@ -7,7 +7,7 @@ PortGroup boost 1.0 boost.depends_type build -github.setup AcademySoftwareFoundation OpenColorIO 2.2.0 v +github.setup AcademySoftwareFoundation OpenColorIO 2.2.1 v name opencolorio categories graphics maintainers {mcalhoun @MarcusCalhoun-Lopez} openmaintainer @@ -19,29 +19,44 @@ long_description OpenColorIO (OCIO) is a complete color management solution \ geared towards motion picture production with an emphasis on \ visual effects and computer animation. -checksums rmd160 3f2ab794c6f4df2e8cec24f8d04478f2fe590c73 \ - sha256 646171b8c9d3941da2bf59fcab99f979626f908b6c6fa4d8fe95bda9eec0407b \ - size 11314927 +# please remove "stealth update" workaround on next version update +dist_subdir ${name}/${version}_1 +checksums rmd160 f9369157eeeca1bbce00594b82d00118924816bc \ + sha256 daf215acddf1c3ed443e6c159e369f2c623b015fa07f11fcc76aae9ede665084 \ + size 11342273 # Exclude pre-releases from livecheck github.livecheck.regex {([0-9.]+)} -patchfiles-append missing-CGDisplayCreateUUIDFromDisplayID.diff -patchfiles-append pystring-cmake.diff - -# source assumes at least C++11 compiler -# OpenImageIO requires C++14 -compiler.cxx_standard 2014 configure.args-append \ - -DCMAKE_CXX_STANDARD=14 + -DCMAKE_CONFIGURATION_TYPES=MacPorts -# Add MacPorts to the set of authorized configurations (see CMakeLists.txt:88) -configure.args-append \ - -DCMAKE_CONFIGURATION_TYPES=\"Debug\;Release\;MinSizeRel\;RelWithDebInfo\;MacPorts\" +patchfiles-append \ + patch-OCIOZArchive.diff + +# source assumes C++11 compiler +compiler.cxx_standard 2011 +configure.cxxflags-append \ + -std=c++11 # see https://github.com/imageworks/OpenColorIO/issues/563 +# https://trac.macports.org/ticket/67904 +if {[string match *clang* ${configure.compiler}]} { + configure.cxxflags-append \ + -Wno-error=self-assign-field +} + +# src/core/ExponentOps.cpp: error: 'OpenColorIO::v1::{anonymous}::ExponentOp::~ExponentOp()' +# defined but not used [-Werror=unused-function] +# pyglue/PyAllocationTransform.cpp: error: cast between incompatible function types from 'PyObject* (*)(PyObject*)' \ +# {aka '_object* (*)(_object*)'} to 'PyCFunction' {aka '_object* (*)(_object*, _object*)'} [-Werror=cast-function-type] +if {[string match *gcc* ${configure.compiler}]} { + configure.cxxflags-append \ + -Wno-unused-function -Wno-cast-function-type +} + configure.cxxflags-append \ - -Wno-error=self-assign-field + -Wno-deprecated-declarations depends_build-append \ port:pkgconfig @@ -56,30 +71,27 @@ depends_lib-append \ port:tinyxml configure.args-append \ - -DUSE_EXTERNAL_YAML=ON \ - -DUSE_EXTERNAL_TINYXML=ON \ - -DUSE_EXTERNAL_LCMS=ON \ -DOCIO_BUILD_OPENFX=OFF \ -DOCIO_BUILD_TESTS=OFF \ - -DOCIO_BUILD_GPU_TESTS=OFF - -# Use OpenEXR <= 2.5 Half. -# When OpenEXR is upgraded to 3.0, depend on openexr instead, and remove the define. -#depends_lib-append \ -# port:ilmbase -#configure.args-append \ -# -DOCIO_USE_OPENEXR_HALF=ON -depends_lib-append \ - port:imath + -DOCIO_BUILD_GPU_TESTS=OFF \ + -DUSE_EXTERNAL_YAML=ON \ + -DUSE_EXTERNAL_TINYXML=ON \ + -DUSE_EXTERNAL_LCMS=ON + +if {${configure.build_arch} in [list ppc ppc64]} { + # This option is ON by default: + configure.args-append \ + -DOCIO_USE_SSE=OFF +} # OpenColorIO intentially installs Python module in lib # see https://github.com/imageworks/OpenColorIO/blob/15e96c1f579d3640947a5fcb5ec831383cc3956e/src/pyglue/CMakeLists.txt#L85 -variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 { +variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 python311 { depends_lib-append port:python27 port:py27-pybind11 configure.args-append \ - -DPYTHON=${prefix}/bin/python2.7 \ - -DOCIO_PYTHON_VERSION=2.7 + -DOCIO_PYTHON_VERSION=2.7 \ + -DPYTHON=${prefix}/bin/python2.7 post-destroot { xinstall -d -m 0755 \ ${destroot}${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages @@ -89,11 +101,11 @@ variant python27 description {Build the Python 2.7 bindings} conflicts python36 } } -variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 { +variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 python311 { depends_lib-append port:python36 port:py36-pybind11 configure.args-append \ - -DPYTHON=${prefix}/bin/python3.6\ - -DOCIO_PYTHON_VERSION=3.6 + -DOCIO_PYTHON_VERSION=3.6 \ + -DPYTHON=${prefix}/bin/python3.6 post-destroot { xinstall -d -m 0755 \ ${destroot}${frameworks_dir}/Python.framework/Versions/3.6/lib/python3.6/site-packages @@ -103,11 +115,11 @@ variant python36 description {Build the Python 3.6 bindings} conflicts python27 } } -variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 { +variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 python311 { depends_lib-append port:python37 port:py37-pybind11 configure.args-append \ - -DPYTHON=${prefix}/bin/python3.7\ - -DOCIO_PYTHON_VERSION=3.7 + -DOCIO_PYTHON_VERSION=3.7 \ + -DPYTHON=${prefix}/bin/python3.7 post-destroot { xinstall -d -m 0755 \ ${destroot}${frameworks_dir}/Python.framework/Versions/3.7/lib/python3.7/site-packages @@ -117,11 +129,11 @@ variant python37 description {Build the Python 3.7 bindings} conflicts python27 } } -variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 { +variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 python311 { depends_lib-append port:python38 port:py38-pybind11 configure.args-append \ - -DPYTHON=${prefix}/bin/python3.8\ - -DOCIO_PYTHON_VERSION=3.8 + -DOCIO_PYTHON_VERSION=3.8 \ + -DPYTHON=${prefix}/bin/python3.8 post-destroot { xinstall -d -m 0755 \ ${destroot}${frameworks_dir}/Python.framework/Versions/3.8/lib/python3.8/site-packages @@ -131,11 +143,11 @@ variant python38 description {Build the Python 3.8 bindings} conflicts python27 } } -variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 { +variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 python311 { depends_lib-append port:python39 port:py39-pybind11 configure.args-append \ - -DPYTHON=${prefix}/bin/python3.9\ - -DOCIO_PYTHON_VERSION=3.9 + -DOCIO_PYTHON_VERSION=3.9 \ + -DPYTHON=${prefix}/bin/python3.9 post-destroot { xinstall -d -m 0755 \ ${destroot}${frameworks_dir}/Python.framework/Versions/3.9/lib/python3.9/site-packages @@ -145,28 +157,43 @@ variant python39 description {Build the Python 3.9 bindings} conflicts python27 } } -variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 { +variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 python311 { depends_lib-append port:python310 port:py310-pybind11 configure.args-append \ - -DPYTHON=${prefix}/bin/python3.10\ - -DOCIO_PYTHON_VERSION=3.10 + -DOCIO_PYTHON_VERSION=3.10 \ + -DPYTHON=${prefix}/bin/python3.10 post-destroot { xinstall -d -m 0755 \ ${destroot}${frameworks_dir}/Python.framework/Versions/3.10/lib/python3.10/site-packages ln -s \ - ${prefix}/lib/python3.10/site-packages/PyOpenColorIO.so \ + ${prefix}/lib/python3.9/site-packages/PyOpenColorIO.so \ ${destroot}${frameworks_dir}/Python.framework/Versions/3.10/lib/python3.10/site-packages/ } } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310]} { - default_variants +python310 + +variant python311 description {Build the Python 3.11 bindings} conflicts python27 python36 python37 python38 python39 python310 { + depends_lib-append port:python311 port:py311-pybind11 + configure.args-append \ + -DOCIO_PYTHON_VERSION=3.11 \ + -DPYTHON=${prefix}/bin/python3.11 + post-destroot { + xinstall -d -m 0755 \ + ${destroot}${frameworks_dir}/Python.framework/Versions/3.11/lib/python3.11/site-packages + ln -s \ + ${prefix}/lib/python3.9/site-packages/PyOpenColorIO.so \ + ${destroot}${frameworks_dir}/Python.framework/Versions/3.11/lib/python3.11/site-packages/ + } +} + +if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { + default_variants +python311 } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310]} { +if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { configure.args-append \ - -DOCIO_BUILD_PYGLUE=OFF \ - -DOCIO_BUILD_PYTHON=OFF + -DOCIO_BUILD_PYTHON=OFF \ + -DOCIO_BUILD_PYGLUE=OFF } # make neither x11 nor quartz default since openimageio depends on opencolorio @@ -204,3 +231,17 @@ if {![variant_isset x11] && ![variant_isset quartz]} { configure.args-append \ -DOCIO_BUILD_APPS=OFF } + +# Notice that on PowerPC tests will report a failure, however if you look into the actual output, +# almost all tests pass (with the fix for endianness above). What still fails is a result of OpenColorIO +# being incapable of properly handling rounding: FAILED: osvec[i] == PROFILE_OUTvec[i] +# values were 'luma: [0.212599993, 0.715200007, 0.0722000003]' and 'luma: [0.2126, 0.7152, 0.0722]' +variant tests description "Enable testing" { + configure.pre_args-replace \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF + configure.args-append \ + -DOCIO_BUILD_TESTS=ON + + test.run yes +} diff --git a/tools/MacPorts/graphics/opencolorio/Portfile.orig b/tools/MacPorts/graphics/opencolorio/Portfile.orig index 06fe428fa8..da0f81d923 100644 --- a/tools/MacPorts/graphics/opencolorio/Portfile.orig +++ b/tools/MacPorts/graphics/opencolorio/Portfile.orig @@ -7,8 +7,7 @@ PortGroup boost 1.0 boost.depends_type build -github.setup AcademySoftwareFoundation OpenColorIO 1.1.1 v -revision 3 +github.setup AcademySoftwareFoundation OpenColorIO 2.2.0 v name opencolorio categories graphics maintainers {mcalhoun @MarcusCalhoun-Lopez} openmaintainer @@ -22,22 +21,40 @@ long_description OpenColorIO (OCIO) is a complete color management solution \ # please remove "stealth update" workaround on next version update dist_subdir ${name}/${version}_1 -checksums rmd160 81534822cb8350e1b7ba171c91226de996494d02 \ - sha256 b7def3b5383c9b35dc9c0bdd26da74e2199c2b283d52bb84847aa307f70a0bc4 \ - size 13830493 +checksums rmd160 3f2ab794c6f4df2e8cec24f8d04478f2fe590c73 \ + sha256 646171b8c9d3941da2bf59fcab99f979626f908b6c6fa4d8fe95bda9eec0407b \ + size 11314927 # Exclude pre-releases from livecheck github.livecheck.regex {([0-9.]+)} -# see https://github.com/imageworks/OpenColorIO/commit/c43cc918c3e79e324f11ca47e95bfe36e9e0dd15 -patchfiles-append patch-upstream.diff +configure.args-append \ + -DCMAKE_CONFIGURATION_TYPES=MacPorts + +# pin the used version before macOS 11 +# keep in mind that openimageio had the same pin +if {${os.platform} eq "darwin" && ${os.major} < 20} { + github.setup AcademySoftwareFoundation OpenColorIO 1.1.1 v + revision 3 + + checksums rmd160 81534822cb8350e1b7ba171c91226de996494d02 \ + sha256 b7def3b5383c9b35dc9c0bdd26da74e2199c2b283d52bb84847aa307f70a0bc4 \ + size 13830493 + + # see https://github.com/imageworks/OpenColorIO/commit/c43cc918c3e79e324f11ca47e95bfe36e9e0dd15 + patchfiles-append patch-upstream.diff + + # see https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/opencolorio/files/opencolorio-1.1.0-yaml-cpp-0.6.patch + patchfiles-append patch-yaml-cpp.diff -# see https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/opencolorio/files/opencolorio-1.1.0-yaml-cpp-0.6.patch -patchfiles-append patch-yaml-cpp.diff + patchfiles-append patch-yaml-cpp-0.7.diff -patchfiles-append patch-yaml-cpp-0.7.diff + patchfiles-append patch-fix-endianness.diff -patchfiles-append patch-CMakeLists.txt.diff + patchfiles-append patch-CMakeLists.txt.diff + + livecheck.type none +} # source assumes C++11 compiler compiler.cxx_standard 2011 @@ -45,8 +62,23 @@ configure.cxxflags-append \ -std=c++11 # see https://github.com/imageworks/OpenColorIO/issues/563 +# https://trac.macports.org/ticket/67904 +if {[string match *clang* ${configure.compiler}]} { + configure.cxxflags-append \ + -Wno-error=self-assign-field +} + +# src/core/ExponentOps.cpp: error: 'OpenColorIO::v1::{anonymous}::ExponentOp::~ExponentOp()' +# defined but not used [-Werror=unused-function] +# pyglue/PyAllocationTransform.cpp: error: cast between incompatible function types from 'PyObject* (*)(PyObject*)' \ +# {aka '_object* (*)(_object*)'} to 'PyCFunction' {aka '_object* (*)(_object*, _object*)'} [-Werror=cast-function-type] +if {[string match *gcc* ${configure.compiler}]} { + configure.cxxflags-append \ + -Wno-unused-function -Wno-cast-function-type +} + configure.cxxflags-append \ - -Wno-error=self-assign-field + -Wno-deprecated-declarations depends_build-append \ port:pkgconfig @@ -65,10 +97,16 @@ configure.args-append \ -DUSE_EXTERNAL_TINYXML=ON \ -DUSE_EXTERNAL_LCMS=ON +if {${configure.build_arch} in [list ppc ppc64]} { + # This option is ON by default: + configure.args-append \ + -DOCIO_USE_SSE=OFF +} + # OpenColorIO intentially installs Python module in lib # see https://github.com/imageworks/OpenColorIO/blob/15e96c1f579d3640947a5fcb5ec831383cc3956e/src/pyglue/CMakeLists.txt#L85 -variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 { +variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 python311 { depends_lib-append port:python27 configure.args-append \ -DPYTHON=${prefix}/bin/python2.7 @@ -81,7 +119,7 @@ variant python27 description {Build the Python 2.7 bindings} conflicts python36 } } -variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 { +variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 python311 { depends_lib-append port:python36 configure.args-append \ -DPYTHON=${prefix}/bin/python3.6 @@ -94,7 +132,7 @@ variant python36 description {Build the Python 3.6 bindings} conflicts python27 } } -variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 { +variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 python311 { depends_lib-append port:python37 configure.args-append \ -DPYTHON=${prefix}/bin/python3.7 @@ -107,7 +145,7 @@ variant python37 description {Build the Python 3.7 bindings} conflicts python27 } } -variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 { +variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 python311 { depends_lib-append port:python38 configure.args-append \ -DPYTHON=${prefix}/bin/python3.8 @@ -120,7 +158,7 @@ variant python38 description {Build the Python 3.8 bindings} conflicts python27 } } -variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 { +variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 python311 { depends_lib-append port:python39 configure.args-append \ -DPYTHON=${prefix}/bin/python3.9 @@ -133,11 +171,38 @@ variant python39 description {Build the Python 3.9 bindings} conflicts python27 } } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39]} { - default_variants +python39 +variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 python311 { + depends_lib-append port:python310 + configure.args-append \ + -DPYTHON=${prefix}/bin/python3.10 + post-destroot { + xinstall -d -m 0755 \ + ${destroot}${frameworks_dir}/Python.framework/Versions/3.10/lib/python3.10/site-packages + ln -s \ + ${prefix}/lib/python3.9/site-packages/PyOpenColorIO.so \ + ${destroot}${frameworks_dir}/Python.framework/Versions/3.10/lib/python3.10/site-packages/ + } } -if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39]} { + +variant python311 description {Build the Python 3.11 bindings} conflicts python27 python36 python37 python38 python39 python310 { + depends_lib-append port:python311 + configure.args-append \ + -DPYTHON=${prefix}/bin/python3.11 + post-destroot { + xinstall -d -m 0755 \ + ${destroot}${frameworks_dir}/Python.framework/Versions/3.11/lib/python3.11/site-packages + ln -s \ + ${prefix}/lib/python3.9/site-packages/PyOpenColorIO.so \ + ${destroot}${frameworks_dir}/Python.framework/Versions/3.11/lib/python3.11/site-packages/ + } +} + +if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { + default_variants +python311 +} + +if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { configure.args-append \ -DOCIO_BUILD_PYGLUE=OFF } @@ -177,3 +242,17 @@ if {![variant_isset x11] && ![variant_isset quartz]} { configure.args-append \ -DOCIO_BUILD_APPS=OFF } + +# Notice that on PowerPC tests will report a failure, however if you look into the actual output, +# almost all tests pass (with the fix for endianness above). What still fails is a result of OpenColorIO +# being incapable of properly handling rounding: FAILED: osvec[i] == PROFILE_OUTvec[i] +# values were 'luma: [0.212599993, 0.715200007, 0.0722000003]' and 'luma: [0.2126, 0.7152, 0.0722]' +variant tests description "Enable testing" { + configure.pre_args-replace \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF + configure.args-append \ + -DOCIO_BUILD_TESTS=ON + + test.run yes +} diff --git a/tools/MacPorts/graphics/opencolorio/Portfile.patch b/tools/MacPorts/graphics/opencolorio/Portfile.patch index c3bbb4711a..7222366f9b 100644 --- a/tools/MacPorts/graphics/opencolorio/Portfile.patch +++ b/tools/MacPorts/graphics/opencolorio/Portfile.patch @@ -1,181 +1,153 @@ ---- Portfile.orig 2022-11-07 09:08:04.000000000 -0800 -+++ Portfile 2022-11-07 09:21:43.000000000 -0800 -@@ -7,8 +7,7 @@ +--- Portfile.orig 2023-08-29 21:57:17 ++++ Portfile 2023-08-29 21:58:24 +@@ -7,7 +7,7 @@ boost.depends_type build --github.setup AcademySoftwareFoundation OpenColorIO 1.1.1 v --revision 3 -+github.setup AcademySoftwareFoundation OpenColorIO 2.2.0 v +-github.setup AcademySoftwareFoundation OpenColorIO 2.2.0 v ++github.setup AcademySoftwareFoundation OpenColorIO 2.2.1 v name opencolorio categories graphics maintainers {mcalhoun @MarcusCalhoun-Lopez} openmaintainer -@@ -20,29 +19,25 @@ - geared towards motion picture production with an emphasis on \ - visual effects and computer animation. - --# please remove "stealth update" workaround on next version update --dist_subdir ${name}/${version}_1 --checksums rmd160 81534822cb8350e1b7ba171c91226de996494d02 \ -- sha256 b7def3b5383c9b35dc9c0bdd26da74e2199c2b283d52bb84847aa307f70a0bc4 \ -- size 13830493 -+checksums rmd160 3f2ab794c6f4df2e8cec24f8d04478f2fe590c73 \ -+ sha256 646171b8c9d3941da2bf59fcab99f979626f908b6c6fa4d8fe95bda9eec0407b \ -+ size 11314927 +@@ -21,9 +21,9 @@ + + # please remove "stealth update" workaround on next version update + dist_subdir ${name}/${version}_1 +-checksums rmd160 3f2ab794c6f4df2e8cec24f8d04478f2fe590c73 \ +- sha256 646171b8c9d3941da2bf59fcab99f979626f908b6c6fa4d8fe95bda9eec0407b \ +- size 11314927 ++checksums rmd160 f9369157eeeca1bbce00594b82d00118924816bc \ ++ sha256 daf215acddf1c3ed443e6c159e369f2c623b015fa07f11fcc76aae9ede665084 \ ++ size 11342273 # Exclude pre-releases from livecheck github.livecheck.regex {([0-9.]+)} - --# see https://github.com/imageworks/OpenColorIO/commit/c43cc918c3e79e324f11ca47e95bfe36e9e0dd15 --patchfiles-append patch-upstream.diff -+patchfiles-append missing-CGDisplayCreateUUIDFromDisplayID.diff -+patchfiles-append pystring-cmake.diff - --# see https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/opencolorio/files/opencolorio-1.1.0-yaml-cpp-0.6.patch --patchfiles-append patch-yaml-cpp.diff +@@ -31,31 +31,9 @@ + configure.args-append \ + -DCMAKE_CONFIGURATION_TYPES=MacPorts + +-# pin the used version before macOS 11 +-# keep in mind that openimageio had the same pin +-if {${os.platform} eq "darwin" && ${os.major} < 20} { +- github.setup AcademySoftwareFoundation OpenColorIO 1.1.1 v +- revision 3 ++patchfiles-append \ ++ patch-OCIOZArchive.diff + +- checksums rmd160 81534822cb8350e1b7ba171c91226de996494d02 \ +- sha256 b7def3b5383c9b35dc9c0bdd26da74e2199c2b283d52bb84847aa307f70a0bc4 \ +- size 13830493 +- +- # see https://github.com/imageworks/OpenColorIO/commit/c43cc918c3e79e324f11ca47e95bfe36e9e0dd15 +- patchfiles-append patch-upstream.diff +- +- # see https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/opencolorio/files/opencolorio-1.1.0-yaml-cpp-0.6.patch +- patchfiles-append patch-yaml-cpp.diff - --patchfiles-append patch-yaml-cpp-0.7.diff +- patchfiles-append patch-yaml-cpp-0.7.diff - --patchfiles-append patch-CMakeLists.txt.diff -+# source assumes at least C++11 compiler -+# OpenImageIO requires C++14 -+compiler.cxx_standard 2014 -+configure.args-append \ -+ -DCMAKE_CXX_STANDARD=14 - --# source assumes C++11 compiler --compiler.cxx_standard 2011 --configure.cxxflags-append \ -- -std=c++11 -+# Add MacPorts to the set of authorized configurations (see CMakeLists.txt:88) -+configure.args-append \ -+ -DCMAKE_CONFIGURATION_TYPES=\"Debug\;Release\;MinSizeRel\;RelWithDebInfo\;MacPorts\" - - # see https://github.com/imageworks/OpenColorIO/issues/563 +- patchfiles-append patch-fix-endianness.diff +- +- patchfiles-append patch-CMakeLists.txt.diff +- +- livecheck.type none +-} +- + # source assumes C++11 compiler + compiler.cxx_standard 2011 configure.cxxflags-append \ -@@ -63,15 +58,28 @@ +@@ -93,6 +71,9 @@ + port:tinyxml + configure.args-append \ - -DUSE_EXTERNAL_YAML=ON \ - -DUSE_EXTERNAL_TINYXML=ON \ -- -DUSE_EXTERNAL_LCMS=ON -+ -DUSE_EXTERNAL_LCMS=ON \ + -DOCIO_BUILD_OPENFX=OFF \ + -DOCIO_BUILD_TESTS=OFF \ -+ -DOCIO_BUILD_GPU_TESTS=OFF -+ -+# Use OpenEXR <= 2.5 Half. -+# When OpenEXR is upgraded to 3.0, depend on openexr instead, and remove the define. -+#depends_lib-append \ -+# port:ilmbase -+#configure.args-append \ -+# -DOCIO_USE_OPENEXR_HALF=ON -+depends_lib-append \ -+ port:imath - - # OpenColorIO intentially installs Python module in lib ++ -DOCIO_BUILD_GPU_TESTS=OFF \ + -DUSE_EXTERNAL_YAML=ON \ + -DUSE_EXTERNAL_TINYXML=ON \ + -DUSE_EXTERNAL_LCMS=ON +@@ -107,8 +88,9 @@ # see https://github.com/imageworks/OpenColorIO/blob/15e96c1f579d3640947a5fcb5ec831383cc3956e/src/pyglue/CMakeLists.txt#L85 --variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 { + variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 python311 { - depends_lib-append port:python27 -+variant python27 description {Build the Python 2.7 bindings} conflicts python36 python37 python38 python39 python310 { + depends_lib-append port:python27 port:py27-pybind11 configure.args-append \ -- -DPYTHON=${prefix}/bin/python2.7 -+ -DPYTHON=${prefix}/bin/python2.7 \ -+ -DOCIO_PYTHON_VERSION=2.7 ++ -DOCIO_PYTHON_VERSION=2.7 \ + -DPYTHON=${prefix}/bin/python2.7 post-destroot { xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages -@@ -81,10 +89,11 @@ - } +@@ -120,8 +102,9 @@ } --variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 { + variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 python311 { - depends_lib-append port:python36 -+variant python36 description {Build the Python 3.6 bindings} conflicts python27 python37 python38 python39 python310 { + depends_lib-append port:python36 port:py36-pybind11 configure.args-append \ -- -DPYTHON=${prefix}/bin/python3.6 -+ -DPYTHON=${prefix}/bin/python3.6\ -+ -DOCIO_PYTHON_VERSION=3.6 ++ -DOCIO_PYTHON_VERSION=3.6 \ + -DPYTHON=${prefix}/bin/python3.6 post-destroot { xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.6/lib/python3.6/site-packages -@@ -94,10 +103,11 @@ - } +@@ -133,8 +116,9 @@ } --variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 { + variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 python311 { - depends_lib-append port:python37 -+variant python37 description {Build the Python 3.7 bindings} conflicts python27 python36 python38 python39 python310 { + depends_lib-append port:python37 port:py37-pybind11 configure.args-append \ -- -DPYTHON=${prefix}/bin/python3.7 -+ -DPYTHON=${prefix}/bin/python3.7\ -+ -DOCIO_PYTHON_VERSION=3.7 ++ -DOCIO_PYTHON_VERSION=3.7 \ + -DPYTHON=${prefix}/bin/python3.7 post-destroot { xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.7/lib/python3.7/site-packages -@@ -107,10 +117,11 @@ - } +@@ -146,8 +130,9 @@ } --variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 { + variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 python311 { - depends_lib-append port:python38 -+variant python38 description {Build the Python 3.8 bindings} conflicts python27 python36 python37 python39 python310 { + depends_lib-append port:python38 port:py38-pybind11 configure.args-append \ -- -DPYTHON=${prefix}/bin/python3.8 -+ -DPYTHON=${prefix}/bin/python3.8\ -+ -DOCIO_PYTHON_VERSION=3.8 ++ -DOCIO_PYTHON_VERSION=3.8 \ + -DPYTHON=${prefix}/bin/python3.8 post-destroot { xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.8/lib/python3.8/site-packages -@@ -120,10 +131,11 @@ - } +@@ -159,8 +144,9 @@ } --variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 { + variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 python311 { - depends_lib-append port:python39 -+variant python39 description {Build the Python 3.9 bindings} conflicts python27 python36 python37 python38 python310 { + depends_lib-append port:python39 port:py39-pybind11 configure.args-append \ -- -DPYTHON=${prefix}/bin/python3.9 -+ -DPYTHON=${prefix}/bin/python3.9\ -+ -DOCIO_PYTHON_VERSION=3.9 ++ -DOCIO_PYTHON_VERSION=3.9 \ + -DPYTHON=${prefix}/bin/python3.9 post-destroot { xinstall -d -m 0755 \ - ${destroot}${frameworks_dir}/Python.framework/Versions/3.9/lib/python3.9/site-packages -@@ -133,13 +145,28 @@ - } +@@ -172,8 +158,9 @@ } --if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39]} { -- default_variants +python39 -+variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 { + variant python310 description {Build the Python 3.10 bindings} conflicts python27 python36 python37 python38 python39 python311 { +- depends_lib-append port:python310 + depends_lib-append port:python310 port:py310-pybind11 -+ configure.args-append \ -+ -DPYTHON=${prefix}/bin/python3.10\ -+ -DOCIO_PYTHON_VERSION=3.10 -+ post-destroot { -+ xinstall -d -m 0755 \ -+ ${destroot}${frameworks_dir}/Python.framework/Versions/3.10/lib/python3.10/site-packages -+ ln -s \ -+ ${prefix}/lib/python3.10/site-packages/PyOpenColorIO.so \ -+ ${destroot}${frameworks_dir}/Python.framework/Versions/3.10/lib/python3.10/site-packages/ -+ } -+} -+ -+if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310]} { -+ default_variants +python310 - } + configure.args-append \ ++ -DOCIO_PYTHON_VERSION=3.10 \ + -DPYTHON=${prefix}/bin/python3.10 + post-destroot { + xinstall -d -m 0755 \ +@@ -186,8 +173,9 @@ + + + variant python311 description {Build the Python 3.11 bindings} conflicts python27 python36 python37 python38 python39 python310 { +- depends_lib-append port:python311 ++ depends_lib-append port:python311 port:py311-pybind11 + configure.args-append \ ++ -DOCIO_PYTHON_VERSION=3.11 \ + -DPYTHON=${prefix}/bin/python3.11 + post-destroot { + xinstall -d -m 0755 \ +@@ -204,6 +192,7 @@ --if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39]} { -+if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310]} { + if {![variant_isset python27] && ![variant_isset python36] && ![variant_isset python37] && ![variant_isset python38] && ![variant_isset python39] && ![variant_isset python310] && ![variant_isset python311]} { configure.args-append \ -- -DOCIO_BUILD_PYGLUE=OFF -+ -DOCIO_BUILD_PYGLUE=OFF \ -+ -DOCIO_BUILD_PYTHON=OFF ++ -DOCIO_BUILD_PYTHON=OFF \ + -DOCIO_BUILD_PYGLUE=OFF } - # make neither x11 nor quartz default since openimageio depends on opencolorio diff --git a/tools/MacPorts/graphics/opencolorio/files/patch-OCIOZArchive.diff b/tools/MacPorts/graphics/opencolorio/files/patch-OCIOZArchive.diff new file mode 100644 index 0000000000..a34361459f --- /dev/null +++ b/tools/MacPorts/graphics/opencolorio/files/patch-OCIOZArchive.diff @@ -0,0 +1,17 @@ +--- src/OpenColorIO/OCIOZArchive.cpp.orig 2023-08-10 19:00:47.000000000 +0200 ++++ src/OpenColorIO/OCIOZArchive.cpp 2023-08-10 19:00:58.000000000 +0200 +@@ -24,7 +24,6 @@ + #include "mz_strm_mem.h" + #include "mz_strm_os.h" + #include "mz_strm_split.h" +-#include "mz_strm_zlib.h" + #include "mz_zip.h" + #include "mz_zip_rw.h" + +@@ -630,4 +629,4 @@ + getEntriesMappingFromArchiveFile(m_archiveAbsPath, m_entries); + } + +-} // namespace OCIO_NAMESPACE +\ No newline at end of file ++} // namespace OCIO_NAMESPACE diff --git a/tools/MacPorts/graphics/opencolorio/files/patch-fix-endianness.diff b/tools/MacPorts/graphics/opencolorio/files/patch-fix-endianness.diff new file mode 100644 index 0000000000..de1695c284 --- /dev/null +++ b/tools/MacPorts/graphics/opencolorio/files/patch-fix-endianness.diff @@ -0,0 +1,45 @@ +--- src/core/Platform.h 2019-03-28 13:12:57.000000000 +0800 ++++ src/core/Platform.h 2023-08-04 22:13:55.000000000 +0800 +@@ -122,7 +122,12 @@ + + // TODO: Add proper endian detection using architecture / compiler mojo + // In the meantime, hardcode to x86 +-#define OCIO_LITTLE_ENDIAN 1 // This is correct on x86 ++#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \ ++ __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++ #define OCIO_BIG_ENDIAN ++#else ++ #define OCIO_LITTLE_ENDIAN // This is correct on x86 ++#endif + + /* + * Mutex classes + + +--- src/core/FileFormatIridasLook.cpp 2019-03-28 13:12:57.000000000 +0800 ++++ src/core/FileFormatIridasLook.cpp 2023-08-04 22:15:26.000000000 +0800 +@@ -132,20 +132,22 @@ + + unsigned char * fvalbytes = reinterpret_cast(&fval); + +-#if OCIO_LITTLE_ENDIAN ++#if defined(OCIO_LITTLE_ENDIAN) + // Since incoming values are little endian, and we're on little endian + // preserve the byte order + fvalbytes[0] = (unsigned char) (asciinums[1] | (asciinums[0] << 4)); + fvalbytes[1] = (unsigned char) (asciinums[3] | (asciinums[2] << 4)); + fvalbytes[2] = (unsigned char) (asciinums[5] | (asciinums[4] << 4)); + fvalbytes[3] = (unsigned char) (asciinums[7] | (asciinums[6] << 4)); +-#else ++#elif defined(OCIO_BIG_ENDIAN) + // Since incoming values are little endian, and we're on big endian + // flip the byte order + fvalbytes[3] = (unsigned char) (asciinums[1] | (asciinums[0] << 4)); + fvalbytes[2] = (unsigned char) (asciinums[3] | (asciinums[2] << 4)); + fvalbytes[1] = (unsigned char) (asciinums[5] | (asciinums[4] << 4)); + fvalbytes[0] = (unsigned char) (asciinums[7] | (asciinums[6] << 4)); ++#else ++ #error "Endianness is unknown." + #endif + return true; + } diff --git a/tools/MacPorts/graphics/openimageio/Portfile b/tools/MacPorts/graphics/openimageio/Portfile index 9f0380b874..c999f44d4d 100644 --- a/tools/MacPorts/graphics/openimageio/Portfile +++ b/tools/MacPorts/graphics/openimageio/Portfile @@ -2,15 +2,11 @@ PortSystem 1.0 PortGroup github 1.0 -#PortGroup qt5 1.0 PortGroup cmake 1.1 PortGroup active_variants 1.1 PortGroup compiler_blacklist_versions 1.0 PortGroup boost 1.0 -github.setup OpenImageIO oiio 2.4.8.0 v -revision 100 - name openimageio categories graphics license BSD @@ -20,55 +16,64 @@ long_description OpenImageIO is a library for reading and writing images, related classes, utilities, and applications. platforms darwin -checksums rmd160 856beebc7dd3d26567a4dd8efcd032038c9ee74e \ - sha256 cc91905f862c402ec18d3992e09c7ed34816cf48b1147465ffafda8ce9c1318c \ - size 32130754 +github.setup OpenImageIO oiio 2.4.14.0 v +revision 100 +checksums rmd160 f0c51d041627f1867b3de2b322edaef21ba8ca0e \ + sha256 92ad4b107394b273397baa1abe90207e1f8ef9fd52ffbfc23b46e3b0005d4439 \ + size 47890322 + +github.tarball_from archive + +depends_lib-append port:imath \ + port:openexr + +patchfiles-append oiio-2.0.8-invalidatespec.patch +patchfiles-append oiio-2.0.8-atomic-load.patch +patchfiles-append oiio-2.3.20-strnlen.patch +patchfiles-append oiio-2.4.6-sysutil.patch +patchfiles-append oiio-2.4.6-filesystem.patch -compiler.cxx_standard 2014 # error: multiple overloads of 'address' instantiate to the same signature 'const_pointer (const_reference) const noexcept' # http://lists.llvm.org/pipermail/llvm-bugs/2013-November/031552.html # Seen on OSX 10.9 and older. compiler.blacklist-append {clang < 700} -# OpenVDB header files use C++14 features -configure.args-append -DCMAKE_CXX_STANDARD=14 -compiler.thread_local_storage yes +# OpenVDB header files use C++17 features +compiler.cxx_standard 2017 +configure.args-append -DCMAKE_CXX_STANDARD=17 -worksrcdir oiio-${version} +compiler.thread_local_storage yes -patch.pre_args -p1 -patchfiles \ - oiio-2.0.8-invalidatespec.patch \ - oiio-2.0.8-atomic-load.patch \ - oiio-2.3.20-strnlen.patch \ - oiio-2.4.6-sysutil.patch \ - oiio-2.4.6-filesystem.patch +configure.cxxflags-append \ + -Wno-deprecated-declarations \ + -Wno-error=unknown-warning-option \ + -Wno-unknown-warning-option +# NOTE: Ensure we prepend 'libfmt9', to include it before 'openexr2' set port_libfmt libfmt9 -cmake.module_path-append \ +cmake.module_path-prepend \ ${prefix}/lib/${port_libfmt}/cmake configure.args-append -DFMT_INCLUDE_DIR=${prefix}/include/${port_libfmt} +# Don't treat clang warnings as errors +configure.args-append -DSTOP_ON_WARNINGS=OFF + # avoid # ccache: error: Failed to create directory ${prefix}/var/macports/build/.ccache/tmp: Operation not permitted configure.args-append -DUSE_CCACHE=OFF # do not "Try to download and build any missing dependencies" configure.args-append -DBUILD_MISSING_DEPS=OFF \ - -DBUILD_MISSING_FMT=OFF \ - -DJPEG_INCLUDE_DIR=${prefix}/include \ + -DBUILD_MISSING_FMT=OFF depends_lib-append port:robin-map \ port:zlib \ port:bzip2 \ port:libpng \ port:tiff \ - port:openexr \ port:squish \ port:${port_libfmt} -# optional components - # we need gcc atomics (clang >= 3.5 maybe?, gcc >= 4.8 works) # tested with openimageio 1.4.6rc1: # macports-clang-3.3 and later work @@ -144,7 +149,7 @@ variant natron conflicts ffmpeg qt5 dicom openvdb ptex dicom requires opencolori configure.args-append -DUSE_PYTHON=OFF -set pythons_suffixes {27 36 37 38 39 310} +set pythons_suffixes {27 36 37 38 39 310 311} set pythons_ports {} foreach s ${pythons_suffixes} { @@ -153,7 +158,7 @@ foreach s ${pythons_suffixes} { foreach s ${pythons_suffixes} { set p python${s} - set v [string index ${s} 0].[string index ${s} 1] + set v [string index ${s} 0].[string range ${s} 1 end] set i [lsearch -exact ${pythons_ports} ${p}] set c [lreplace ${pythons_ports} ${i} ${i}] variant ${p} description "Build the Python ${v} bindings" conflicts {*}${c} " @@ -177,15 +182,8 @@ foreach s ${pythons_suffixes} { } # this default version should stay synchronized with python_get_default_version # in the python PortGroup -#if {${set_python_default}} { -# default_variants +python310 -#} - -#configure.args-append -DUSE_FIELD3D=OFF -variant field3d description {Use Field3D.} { -depends_lib-append port:field3d - configure.args-delete -DUSE_FIELD3D:BOOL=FALSE - configure.args-append -DUSE_FIELD3D:BOOL=TRUE +if {${set_python_default}} { + default_variants +python311 } #configure.args-append -DUSE_FFMPEG=OFF @@ -257,6 +255,8 @@ depends_lib-append port:tbb \ configure.args-append -DUSE_OPENVDB:BOOL=TRUE } +configure.args-append -DTBB_ROOT=${prefix}/libexec/tbb + # not in MacPorts configure.args-append -DUSE_NUKE=OFF @@ -269,3 +269,5 @@ depends_lib-append port:dcmtk #configure.args-append -DUSE_WEBP=OFF depends_lib-append port:webp + +github.livecheck.regex {([0-9.]+)} diff --git a/tools/MacPorts/graphics/openimageio/Portfile.orig b/tools/MacPorts/graphics/openimageio/Portfile.orig index ca025ea70e..a1266c038f 100644 --- a/tools/MacPorts/graphics/openimageio/Portfile.orig +++ b/tools/MacPorts/graphics/openimageio/Portfile.orig @@ -8,12 +8,6 @@ PortGroup active_variants 1.1 PortGroup compiler_blacklist_versions 1.0 PortGroup boost 1.0 -github.setup OpenImageIO oiio 2.1.20.0 v -revision 6 -checksums rmd160 d10c488b93ab2335d53545d8a1b35ba4c1babb98 \ - sha256 75222543286d3a12473aa03fdb4e6c9f98760c5ad1ad89d3cf82a5da41385ae0 \ - size 29115990 - name openimageio categories graphics license BSD @@ -22,25 +16,75 @@ description a library for reading and writing images long_description OpenImageIO is a library for reading and writing images, and a bunch of \ related classes, utilities, and applications. -compiler.cxx_standard 2014 +# Pin the used version before macOS 11, which is required by pinned versions +# of opencolorio and osl. +if {${os.platform} eq "darwin" && ${os.major} >= 20} { + set port_latest yes +} else { + set port_latest no +} + +if {${port_latest}} { + github.setup OpenImageIO oiio 2.4.5.0 v + revision 7 + checksums rmd160 32b2b0f0b01268a91fc98cfca948a71e89d8e54b \ + sha256 21177a9665021a99123885cd8383116d15013b6610b4b09bcf209612423fedc5 \ + size 31938357 +} else { + github.setup OpenImageIO oiio 2.1.20.0 v + revision 12 + checksums rmd160 d10c488b93ab2335d53545d8a1b35ba4c1babb98 \ + sha256 75222543286d3a12473aa03fdb4e6c9f98760c5ad1ad89d3cf82a5da41385ae0 \ + size 29115990 + + livecheck.type none +} + +github.tarball_from archive + +if {${port_latest}} { + patchfiles-append patch-enforce-clang14.diff + patchfiles-append patch-2.4.5-cmake-disable-wall-werror.diff + + depends_lib-append port:imath \ + port:openexr +} else { + patchfiles-append patch-FindOpenJpeg.cmake.diff + patchfiles-append patch-libraw-0.21.0.diff + patchfiles-append patch-2.1.20-cmake-disable-wall-werror.diff + + depends_lib-append port:field3d \ + port:openexr2 + + configure.pkg_config_path-prepend \ + ${prefix}/libexec/openexr2/lib/pkgconfig +} + # error: multiple overloads of 'address' instantiate to the same signature 'const_pointer (const_reference) const noexcept' # http://lists.llvm.org/pipermail/llvm-bugs/2013-November/031552.html # Seen on OSX 10.9 and older. compiler.blacklist-append {clang < 700} -# OpenVDB header files use C++14 features -configure.args-append -DCMAKE_CXX_STANDARD=14 -compiler.thread_local_storage yes +# OpenVDB header files use C++17 features +compiler.cxx_standard 2017 +configure.args-append -DCMAKE_CXX_STANDARD=17 -github.tarball_from archive +compiler.thread_local_storage yes -patchfiles-append patch-FindOpenJpeg.cmake.diff +configure.cxxflags-append \ + -Wno-deprecated-declarations \ + -Wno-error=unknown-warning-option \ + -Wno-unknown-warning-option +# NOTE: Ensure we prepend 'libfmt9', to include it before 'openexr2' set port_libfmt libfmt9 -cmake.module_path-append \ +cmake.module_path-prepend \ ${prefix}/lib/${port_libfmt}/cmake configure.args-append -DFMT_INCLUDE_DIR=${prefix}/include/${port_libfmt} +# Don't treat clang warnings as errors +configure.args-append -DSTOP_ON_WARNINGS=OFF + # avoid # ccache: error: Failed to create directory ${prefix}/var/macports/build/.ccache/tmp: Operation not permitted configure.args-append -DUSE_CCACHE=OFF @@ -54,8 +98,6 @@ depends_lib-append port:robin-map \ port:bzip2 \ port:libpng \ port:tiff \ - port:ilmbase \ - port:openexr \ port:squish \ port:${port_libfmt} @@ -67,7 +109,7 @@ qt5.min_version 5.6 configure.args-append -DUSE_PYTHON=OFF -set pythons_suffixes {27 36 37 38 39} +set pythons_suffixes {27 36 37 38 39 310 311} set pythons_ports {} foreach s ${pythons_suffixes} { @@ -76,7 +118,7 @@ foreach s ${pythons_suffixes} { foreach s ${pythons_suffixes} { set p python${s} - set v [string index ${s} 0].[string index ${s} 1] + set v [string index ${s} 0].[string range ${s} 1 end] set i [lsearch -exact ${pythons_ports} ${p}] set c [lreplace ${pythons_ports} ${i} ${i}] variant ${p} description "Build the Python ${v} bindings" conflicts {*}${c} " @@ -101,12 +143,9 @@ foreach s ${pythons_suffixes} { # this default version should stay synchronized with python_get_default_version # in the python PortGroup if {${set_python_default}} { - default_variants +python39 + default_variants +python311 } -#configure.args-append -DUSE_FIELD3D=OFF -depends_lib-append port:field3d - #configure.args-append -DUSE_FFMPEG=OFF depends_lib-append path:lib/libavcodec.dylib:ffmpeg @@ -146,6 +185,8 @@ depends_lib-append port:libraw depends_lib-append port:tbb \ port:openvdb +configure.args-append -DTBB_ROOT=${prefix}/libexec/tbb + # not in MacPorts configure.args-append -DUSE_NUKE=OFF @@ -154,3 +195,5 @@ depends_lib-append port:dcmtk #configure.args-append -DUSE_WEBP=OFF depends_lib-append port:webp + +github.livecheck.regex {([0-9.]+)} diff --git a/tools/MacPorts/graphics/openimageio/Portfile.patch b/tools/MacPorts/graphics/openimageio/Portfile.patch index 1d7631b43c..d3699d10d2 100644 --- a/tools/MacPorts/graphics/openimageio/Portfile.patch +++ b/tools/MacPorts/graphics/openimageio/Portfile.patch @@ -1,79 +1,81 @@ ---- Portfile.orig 2023-05-10 16:09:40.000000000 -0700 -+++ Portfile 2023-05-21 19:27:37.000000000 -0700 -@@ -2,17 +2,14 @@ +--- Portfile.orig 2023-08-10 19:07:00.000000000 +0200 ++++ Portfile 2023-08-10 19:51:16.000000000 +0200 +@@ -2,7 +2,6 @@ PortSystem 1.0 PortGroup github 1.0 -PortGroup qt5 1.0 -+#PortGroup qt5 1.0 PortGroup cmake 1.1 PortGroup active_variants 1.1 PortGroup compiler_blacklist_versions 1.0 - PortGroup boost 1.0 - --github.setup OpenImageIO oiio 2.1.20.0 v --revision 6 --checksums rmd160 d10c488b93ab2335d53545d8a1b35ba4c1babb98 \ -- sha256 75222543286d3a12473aa03fdb4e6c9f98760c5ad1ad89d3cf82a5da41385ae0 \ -- size 29115990 -+github.setup OpenImageIO oiio 2.4.8.0 v -+revision 100 - - name openimageio - categories graphics -@@ -21,6 +18,11 @@ +@@ -15,50 +14,24 @@ description a library for reading and writing images long_description OpenImageIO is a library for reading and writing images, and a bunch of \ related classes, utilities, and applications. +platforms darwin -+ -+checksums rmd160 856beebc7dd3d26567a4dd8efcd032038c9ee74e \ -+ sha256 cc91905f862c402ec18d3992e09c7ed34816cf48b1147465ffafda8ce9c1318c \ -+ size 32130754 - compiler.cxx_standard 2014 +-# Pin the used version before macOS 11, which is required by pinned versions +-# of opencolorio and osl. +-if {${os.platform} eq "darwin" && ${os.major} >= 20} { +- set port_latest yes +-} else { +- set port_latest no +-} +- +-if {${port_latest}} { +- github.setup OpenImageIO oiio 2.4.5.0 v +- revision 7 +- checksums rmd160 32b2b0f0b01268a91fc98cfca948a71e89d8e54b \ +- sha256 21177a9665021a99123885cd8383116d15013b6610b4b09bcf209612423fedc5 \ +- size 31938357 +-} else { +- github.setup OpenImageIO oiio 2.1.20.0 v +- revision 12 +- checksums rmd160 d10c488b93ab2335d53545d8a1b35ba4c1babb98 \ +- sha256 75222543286d3a12473aa03fdb4e6c9f98760c5ad1ad89d3cf82a5da41385ae0 \ +- size 29115990 +- +- livecheck.type none +-} ++github.setup OpenImageIO oiio 2.4.14.0 v ++revision 100 ++checksums rmd160 f0c51d041627f1867b3de2b322edaef21ba8ca0e \ ++ sha256 92ad4b107394b273397baa1abe90207e1f8ef9fd52ffbfc23b46e3b0005d4439 \ ++ size 47890322 + + github.tarball_from archive + +-if {${port_latest}} { +- patchfiles-append patch-enforce-clang14.diff +- patchfiles-append patch-2.4.5-cmake-disable-wall-werror.diff +- +- depends_lib-append port:imath \ +- port:openexr +-} else { +- patchfiles-append patch-FindOpenJpeg.cmake.diff +- patchfiles-append patch-libraw-0.21.0.diff +- patchfiles-append patch-2.1.20-cmake-disable-wall-werror.diff +- +- depends_lib-append port:field3d \ +- port:openexr2 ++depends_lib-append port:imath \ ++ port:openexr + +- configure.pkg_config_path-prepend \ +- ${prefix}/libexec/openexr2/lib/pkgconfig +-} ++patchfiles-append oiio-2.0.8-invalidatespec.patch ++patchfiles-append oiio-2.0.8-atomic-load.patch ++patchfiles-append oiio-2.3.20-strnlen.patch ++patchfiles-append oiio-2.4.6-sysutil.patch ++patchfiles-append oiio-2.4.6-filesystem.patch + # error: multiple overloads of 'address' instantiate to the same signature 'const_pointer (const_reference) const noexcept' -@@ -32,9 +34,15 @@ - - compiler.thread_local_storage yes - --github.tarball_from archive -+worksrcdir oiio-${version} - --patchfiles-append patch-FindOpenJpeg.cmake.diff -+patch.pre_args -p1 -+patchfiles \ -+ oiio-2.0.8-invalidatespec.patch \ -+ oiio-2.0.8-atomic-load.patch \ -+ oiio-2.3.20-strnlen.patch \ -+ oiio-2.4.6-sysutil.patch \ -+ oiio-2.4.6-filesystem.patch - - set port_libfmt libfmt9 - cmake.module_path-append \ -@@ -47,27 +55,96 @@ - - # do not "Try to download and build any missing dependencies" - configure.args-append -DBUILD_MISSING_DEPS=OFF \ -- -DBUILD_MISSING_FMT=OFF -+ -DBUILD_MISSING_FMT=OFF \ -+ -DJPEG_INCLUDE_DIR=${prefix}/include \ - - depends_lib-append port:robin-map \ - port:zlib \ - port:bzip2 \ - port:libpng \ - port:tiff \ -- port:ilmbase \ - port:openexr \ + # http://lists.llvm.org/pipermail/llvm-bugs/2013-November/031552.html +@@ -101,11 +74,78 @@ port:squish \ port:${port_libfmt} - # optional components - --#configure.args-append -DUSE_OPENGL=OFF \ --# -DUSE_QT=OFF --qt5.min_version 5.6 +# we need gcc atomics (clang >= 3.5 maybe?, gcc >= 4.8 works) +# tested with openimageio 1.4.6rc1: +# macports-clang-3.3 and later work @@ -138,8 +140,11 @@ + -DBUILD_FMT_FORCE:BOOL=TRUE \ + -DSTOP_ON_WARNING:BOOL=FALSE + -+# optional components -+ + # optional components + +-#configure.args-append -DUSE_OPENGL=OFF \ +-# -DUSE_QT=OFF +-qt5.min_version 5.6 +default_variants +opencolorio +openjpeg +freetype + +variant natron conflicts ffmpeg qt5 dicom openvdb ptex dicom requires opencolorio openjpeg freetype description {Natron version} { @@ -149,28 +154,8 @@ configure.args-append -DUSE_PYTHON=OFF --set pythons_suffixes {27 36 37 38 39} -+set pythons_suffixes {27 36 37 38 39 310} - - set pythons_ports {} - foreach s ${pythons_suffixes} { -@@ -100,34 +177,58 @@ +@@ -147,26 +187,46 @@ } - # this default version should stay synchronized with python_get_default_version - # in the python PortGroup --if {${set_python_default}} { -- default_variants +python39 --} -+#if {${set_python_default}} { -+# default_variants +python310 -+#} - - #configure.args-append -DUSE_FIELD3D=OFF -+variant field3d description {Use Field3D.} { - depends_lib-append port:field3d -+ configure.args-delete -DUSE_FIELD3D:BOOL=FALSE -+ configure.args-append -DUSE_FIELD3D:BOOL=TRUE -+} #configure.args-append -DUSE_FFMPEG=OFF +variant ffmpeg description {Add FFmpeg support.} { @@ -216,7 +201,7 @@ #configure.args-append -DUSE_GIF=OFF depends_lib-append port:giflib -@@ -136,21 +237,35 @@ +@@ -175,15 +235,25 @@ depends_lib-append port:libheif #configure.args-append -DUSE_PTEX=OFF @@ -240,7 +225,9 @@ + configure.args-append -DUSE_OPENVDB:BOOL=TRUE +} - # not in MacPorts + configure.args-append -DTBB_ROOT=${prefix}/libexec/tbb + +@@ -191,7 +261,11 @@ configure.args-append -DUSE_NUKE=OFF #configure.args-append -DUSE_DICOM=OFF diff --git a/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-atomic-load.patch b/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-atomic-load.patch index bf4e33a90c..3335d82d5e 100644 --- a/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-atomic-load.patch +++ b/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-atomic-load.patch @@ -1,5 +1,5 @@ ---- oiio-Release-2.0.8/src/libtexture/imagecache.cpp.orig 2019-07-09 09:14:23.000000000 +0200 -+++ oiio-Release-2.0.8/src/libtexture/imagecache.cpp 2019-07-09 09:14:54.000000000 +0200 +--- src/libtexture/imagecache.cpp.orig 2019-07-09 09:14:23.000000000 +0200 ++++ src/libtexture/imagecache.cpp 2019-07-09 09:14:54.000000000 +0200 @@ -350,7 +350,7 @@ std::shared_ptr ImageCacheFile::get_imageinput(ImageCachePerThreadInfo* thread_info) diff --git a/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-invalidatespec.patch b/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-invalidatespec.patch index 94901954ad..7df3228917 100644 --- a/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-invalidatespec.patch +++ b/tools/MacPorts/graphics/openimageio/files/oiio-2.0.8-invalidatespec.patch @@ -1,5 +1,5 @@ ---- oiio-Release-2.0.8/src/libtexture/imagecache_pvt.h.orig 2019-05-03 17:56:26.000000000 -0700 -+++ oiio-Release-2.0.8/src/libtexture/imagecache_pvt.h 2019-05-23 20:53:57.000000000 -0700 +--- src/libtexture/imagecache_pvt.h.orig 2019-05-03 17:56:26.000000000 -0700 ++++ src/libtexture/imagecache_pvt.h 2019-05-23 20:53:57.000000000 -0700 @@ -337,7 +337,8 @@ void invalidate_spec() { diff --git a/tools/MacPorts/graphics/openimageio/files/oiio-2.3.20-strnlen.patch b/tools/MacPorts/graphics/openimageio/files/oiio-2.3.20-strnlen.patch index 2186d84e5d..ea9801caee 100644 --- a/tools/MacPorts/graphics/openimageio/files/oiio-2.3.20-strnlen.patch +++ b/tools/MacPorts/graphics/openimageio/files/oiio-2.3.20-strnlen.patch @@ -1,5 +1,5 @@ ---- oiio-Release-2.3.20.0/src/libutil/strutil.cpp.orig 2022-10-13 23:22:41.000000000 -0700 -+++ oiio-Release-2.3.20.0/src/libutil/strutil.cpp 2022-10-13 23:23:32.000000000 -0700 +--- src/libutil/strutil.cpp.orig 2022-10-13 23:22:41.000000000 -0700 ++++ src/libutil/strutil.cpp 2022-10-13 23:23:32.000000000 -0700 @@ -48,6 +48,20 @@ #include "stb_sprintf.h" diff --git a/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-filesystem.patch b/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-filesystem.patch index f55261cb5a..a629878a80 100644 --- a/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-filesystem.patch +++ b/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-filesystem.patch @@ -1,5 +1,5 @@ ---- oiio-Release-2.4.6.0/src/libutil/filesystem.cpp.orig 2022-12-07 22:42:34.000000000 -0800 -+++ oiio-Release-2.4.6.0/src/libutil/filesystem.cpp 2022-12-07 23:07:36.000000000 -0800 +--- src/libutil/filesystem.cpp.orig 2022-12-07 22:42:34.000000000 -0800 ++++ src/libutil/filesystem.cpp 2022-12-07 23:07:36.000000000 -0800 @@ -45,6 +45,224 @@ diff --git a/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-sysutil.patch b/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-sysutil.patch index 3ea54759b6..2d11b1bc82 100644 --- a/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-sysutil.patch +++ b/tools/MacPorts/graphics/openimageio/files/oiio-2.4.6-sysutil.patch @@ -1,5 +1,5 @@ ---- oiio-Release-2.4.6.0/src/libutil/sysutil.cpp.orig 2022-12-07 22:37:33.000000000 -0800 -+++ oiio-Release-2.4.6.0/src/libutil/sysutil.cpp 2022-12-07 22:38:56.000000000 -0800 +--- src/libutil/sysutil.cpp.orig 2022-12-07 22:37:33.000000000 -0800 ++++ src/libutil/sysutil.cpp 2022-12-07 22:38:56.000000000 -0800 @@ -571,7 +571,7 @@ return daemon(1, 1) == 0; #endif diff --git a/tools/MacPorts/graphics/openimageio/files/patch-2.1.20-cmake-disable-wall-werror.diff b/tools/MacPorts/graphics/openimageio/files/patch-2.1.20-cmake-disable-wall-werror.diff new file mode 100644 index 0000000000..5a516173ce --- /dev/null +++ b/tools/MacPorts/graphics/openimageio/files/patch-2.1.20-cmake-disable-wall-werror.diff @@ -0,0 +1,23 @@ +--- src/cmake/compiler.cmake.orig 2023-06-26 09:36:34.000000000 -0400 ++++ src/cmake/compiler.cmake 2023-06-26 09:37:53.000000000 -0400 +@@ -82,9 +82,9 @@ + # + option (STOP_ON_WARNING "Stop building if there are any compiler warnings" OFF) + if (NOT MSVC) +- add_compile_options ("-Wall") ++# add_compile_options ("-Wall") + if (STOP_ON_WARNING OR DEFINED ENV{CI}) +- add_compile_options ("-Werror") ++# add_compile_options ("-Werror") + # N.B. Force CI builds (Travis defines $CI) to use -Werror, even if + # STOP_ON_WARNING has been switched off by default, which we may do + # in release branches. +@@ -133,7 +133,7 @@ + # disable warning about unused command line arguments + add_compile_options ("-Qunused-arguments") + # Don't warn if we ask it not to warn about warnings it doesn't know +- add_compile_options ("-Wunknown-warning-option") ++ add_compile_options ("-Wno-unknown-warning-option") + if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.6 OR + APPLECLANG_VERSION_STRING VERSION_GREATER 6.1) + add_compile_options ("-Wno-unused-local-typedefs") diff --git a/tools/MacPorts/graphics/openimageio/files/patch-2.4.5-cmake-disable-wall-werror.diff b/tools/MacPorts/graphics/openimageio/files/patch-2.4.5-cmake-disable-wall-werror.diff new file mode 100644 index 0000000000..2fc2d0948e --- /dev/null +++ b/tools/MacPorts/graphics/openimageio/files/patch-2.4.5-cmake-disable-wall-werror.diff @@ -0,0 +1,26 @@ +--- src/cmake/compiler.cmake.orig 2023-06-26 09:39:08.000000000 -0400 ++++ src/cmake/compiler.cmake 2023-06-26 09:39:45.000000000 -0400 +@@ -100,12 +100,12 @@ + endif() + option (EXTRA_WARNINGS "Enable lots of extra pedantic warnings" OFF) + if (NOT MSVC) +- add_compile_options ("-Wall") ++# add_compile_options ("-Wall") + if (EXTRA_WARNINGS) + add_compile_options ("-Wextra") + endif () + if (STOP_ON_WARNING) +- add_compile_options ("-Werror") ++# add_compile_options ("-Werror") + endif () + endif () + +@@ -151,7 +151,7 @@ + # disable warning about unused command line arguments + add_compile_options ("-Qunused-arguments") + # Don't warn if we ask it not to warn about warnings it doesn't know +- add_compile_options ("-Wunknown-warning-option") ++ add_compile_options ("-Wno-unknown-warning-option") + if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.6 OR + APPLECLANG_VERSION_STRING VERSION_GREATER 6.1) + add_compile_options ("-Wno-unused-local-typedefs") diff --git a/tools/MacPorts/graphics/openimageio/files/patch-enforce-clang14.diff b/tools/MacPorts/graphics/openimageio/files/patch-enforce-clang14.diff new file mode 100644 index 0000000000..e503aa8fd5 --- /dev/null +++ b/tools/MacPorts/graphics/openimageio/files/patch-enforce-clang14.diff @@ -0,0 +1,14 @@ +diff --git src/libtexture/texturesys.cpp src/libtexture/texturesys.cpp +index d2d64dbdb..c0d4fc0e4 100644 +--- src/libtexture/texturesys.cpp ++++ src/libtexture/texturesys.cpp +@@ -2299,9 +2299,7 @@ TextureSystemImpl::sample_bilinear( + else + tile_st %= tilewh; + OIIO_PRAGMA_WARNING_PUSH +-#if OIIO_CLANG_VERSION >= 140000 || OIIO_INTEL_CLANG_VERSION >= 140000 + OIIO_CLANG_PRAGMA(GCC diagnostic ignored "-Wbitwise-instead-of-logical") +-#endif + bool s_onetile = (tile_st[S0] != tilewhmask[S0]) + & (sttex[S0] + 1 == sttex[S1]); + bool t_onetile = (tile_st[T0] != tilewhmask[T0]) diff --git a/tools/MacPorts/graphics/openimageio/files/patch-libraw-0.21.0.diff b/tools/MacPorts/graphics/openimageio/files/patch-libraw-0.21.0.diff new file mode 100644 index 0000000000..1ed16b084a --- /dev/null +++ b/tools/MacPorts/graphics/openimageio/files/patch-libraw-0.21.0.diff @@ -0,0 +1,113 @@ +Backport of: + - https://github.com/OpenImageIO/oiio/commit/3e74eae539bcd3662106009baa64ab23a3e48a75 + - https://github.com/OpenImageIO/oiio/commit/650772433010b5889e6d2694137cace2567ad487 + +diff --git src/raw.imageio/rawinput.cpp src/raw.imageio/rawinput.cpp +index 5c1b96b526..1f19f0c447 100644 +--- src/raw.imageio/rawinput.cpp ++++ src/raw.imageio/rawinput.cpp +@@ -790,8 +790,9 @@ RawInput::get_makernotes_canon() + MAKERF(FlashExposureLock); + MAKERF(ExposureMode); + MAKERF(AESetting); +- MAKERF(HighlightTonePriority); + MAKERF(ImageStabilization); ++# if LIBRAW_VERSION < LIBRAW_MAKE_VERSION(0, 21, 0) ++ MAKERF(HighlightTonePriority); + MAKERF(FocusMode); + MAKER(AFPoint, 0); + MAKERF(FocusContinuous); +@@ -812,6 +813,7 @@ RawInput::get_makernotes_canon() + // short AFPointsSelected[4]; + // ushort PrimaryAFPoint; + } ++# endif + MAKERF(FlashMode); + MAKERF(FlashActivity); + MAKER(FlashBits, 0); +@@ -851,6 +853,7 @@ RawInput::get_makernotes_nikon() + MAKERF(ImageStabilization); + MAKER(VibrationReduction, 0); + MAKERF(VRMode); ++# if LIBRAW_VERSION < LIBRAW_MAKE_VERSION(0, 21, 0) + MAKER(FocusMode, 0); + MAKERF(AFPoint); + MAKER(AFPointsInFocus, 0); +@@ -870,6 +873,7 @@ RawInput::get_makernotes_nikon() + MAKER(AFAreaHeight, 0); + MAKER(ContrastDetectAFInFocus, 0); + } ++# endif + MAKER(FlashSetting, 0); + MAKER(FlashType, 0); + MAKERF(FlashExposureCompensation); +@@ -1016,9 +1020,11 @@ RawInput::get_makernotes_fuji() + MAKERF(ExrMode); + MAKERF(Macro); + MAKERF(Rating); ++# if LIBRAW_VERSION < LIBRAW_MAKE_VERSION(0, 21, 0) + MAKERF(FrameRate); + MAKERF(FrameWidth); + MAKERF(FrameHeight); ++# endif + #endif + } + +diff --git src/raw.imageio/rawinput.cpp src/raw.imageio/rawinput.cpp +index 816dd10c9e..dd41eb6732 100644 +--- src/raw.imageio/rawinput.cpp ++++ src/raw.imageio/rawinput.cpp +@@ -29,9 +29,6 @@ template using auto_ptr = unique_ptr; + } + #endif + +-#include +-#include +- + + // This plugin utilises LibRaw: + // http://www.libraw.org/ +@@ -40,6 +37,18 @@ template using auto_ptr = unique_ptr; + // Example raw images from many camera models: + // https://www.rawsamples.ch + ++#include ++#include ++ ++#if LIBRAW_VERSION < LIBRAW_MAKE_VERSION(0, 15, 0) ++# error "OpenImageIO does not support such an old LibRaw" ++#endif ++ ++// Some structure layouts changed mid-release on this snapshot ++#define LIBRAW_VERSION_AT_LEAST_SNAPSHOT_202110 \ ++ (LIBRAW_VERSION >= LIBRAW_MAKE_VERSION(0, 21, 0) \ ++ && LIBRAW_SHLIB_CURRENT >= 22) ++ + + OIIO_PLUGIN_NAMESPACE_BEGIN + +@@ -1016,6 +1025,16 @@ RawInput::get_makernotes_canon() + MAKERF(ContinuousDrive); + MAKER(SensorWidth, 0); + MAKER(SensorHeight, 0); ++# if LIBRAW_VERSION_AT_LEAST_SNAPSHOT_202110 ++ add(m_make, "SensorLeftBorder", mn.DefaultCropAbsolute.l, false, 0); ++ add(m_make, "SensorTopBorder", mn.DefaultCropAbsolute.t, false, 0); ++ add(m_make, "SensorRightBorder", mn.DefaultCropAbsolute.r, false, 0); ++ add(m_make, "SensorBottomBorder", mn.DefaultCropAbsolute.b, false, 0); ++ add(m_make, "BlackMaskLeftBorder", mn.LeftOpticalBlack.l, false, 0); ++ add(m_make, "BlackMaskTopBorder", mn.LeftOpticalBlack.t, false, 0); ++ add(m_make, "BlackMaskRightBorder", mn.LeftOpticalBlack.r, false, 0); ++ add(m_make, "BlackMaskBottomBorder", mn.LeftOpticalBlack.b, false, 0); ++# else + MAKER(SensorLeftBorder, 0); + MAKER(SensorTopBorder, 0); + MAKER(SensorRightBorder, 0); +@@ -1024,6 +1043,7 @@ RawInput::get_makernotes_canon() + MAKER(BlackMaskTopBorder, 0); + MAKER(BlackMaskRightBorder, 0); + MAKER(BlackMaskBottomBorder, 0); ++# endif + #endif + #if LIBRAW_VERSION >= LIBRAW_MAKE_VERSION(0, 19, 0) + // Extra added with libraw 0.19: diff --git a/tools/MacPorts/graphics/tiff/files/dont-find-x11-opengl.patch b/tools/MacPorts/graphics/tiff/files/dont-find-x11-opengl.patch new file mode 100644 index 0000000000..2fb8850ea9 --- /dev/null +++ b/tools/MacPorts/graphics/tiff/files/dont-find-x11-opengl.patch @@ -0,0 +1,30 @@ +Prevent configure script from finding X11 OpenGL (e.g. mesa & freeglut). +--- configure.orig 2023-06-09 08:27:09.000000000 -0500 ++++ configure 2023-06-19 08:50:55.000000000 -0500 +@@ -20596,7 +20596,7 @@ + CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}" + ax_save_LIBS="${LIBS}" + LIBS="" +-ax_check_libs="-lopengl32 -lGL" ++ax_check_libs="-lopengl32" + for ax_lib in ${ax_check_libs}; do + if test X$ax_compiler_ms = Xyes; then : + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` +@@ -20811,7 +20811,7 @@ + ax_cv_check_glu_libglu=yes + else + LIBS="" +-ax_check_libs="-lglu32 -lGLU" ++ax_check_libs="-lglu32" + for ax_lib in ${ax_check_libs}; do + if test X$ax_compiler_ms = Xyes; then : + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` +@@ -20966,7 +20966,7 @@ + CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}" + ax_save_LIBS="${LIBS}" + LIBS="" +-ax_check_libs="-lglut32 -lglut" ++ax_check_libs="-lglut32" + for ax_lib in ${ax_check_libs}; do + if test X$ax_compiler_ms = Xyes; then : + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` diff --git a/tools/MacPorts/lang/libomp/Portfile.orig b/tools/MacPorts/lang/libomp/Portfile.orig index 187f27752f..a417389801 100644 --- a/tools/MacPorts/lang/libomp/Portfile.orig +++ b/tools/MacPorts/lang/libomp/Portfile.orig @@ -30,7 +30,7 @@ subport libomp-devel {} if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libstdc++"} { - version 16.0.3 + version 16.0.6 revision 0 if { ${subport} eq "libomp-devel" } { @@ -46,13 +46,13 @@ if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libstdc++"} { checksums \ openmp-${version}.src.tar.xz \ - rmd160 e62aa3e855e692554dfdf946daffe6606848241c \ - sha256 6ff2bb78c95d9b430203dcba50e41433e1f72696af7b2196c8056ac4bc9f2516 \ - size 1278080 \ + rmd160 de7bc41e8207077aee79e3ff45c782f489f8f383 \ + sha256 a2536f06373774f2829d892b72eea5f97bab20e69b26b03042d947f992eb8e38 \ + size 1278072 \ cmake-${version}.src.tar.xz \ - rmd160 e12f24f24ed8ad6b2adb5973a2db5fd107e237f9 \ - sha256 b6d83c91f12757030d8361dedc5dd84357b3edb8da406b5d0850df8b6f7798b1 \ - size 9004 + rmd160 94ead500d749de031894e9a14c51ed17951c8fd7 \ + sha256 39d342a4161095d2f28fb1253e4585978ac50521117da666e2b1f6f28b62f514 \ + size 9008 if {${os.major} <= 12} { # kmp_alloc.c includes but libc++ is not the default on diff --git a/tools/MacPorts/lang/libomp/Portfile.patch b/tools/MacPorts/lang/libomp/Portfile.patch index 0f8fb46643..83df784f52 100644 --- a/tools/MacPorts/lang/libomp/Portfile.patch +++ b/tools/MacPorts/lang/libomp/Portfile.patch @@ -1,4 +1,4 @@ ---- Portfile.orig 2023-05-10 16:10:39.000000000 -0700 +--- Portfile.orig 2023-07-03 17:37:19.000000000 -0700 +++ Portfile 2023-04-04 12:02:53.000000000 -0700 @@ -1,7 +1,7 @@ # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 @@ -23,7 +23,7 @@ if {${os.platform} eq "darwin" && ${configure.cxx_stdlib} ne "libstdc++"} { - -- version 16.0.3 +- version 16.0.6 - revision 0 - if { ${subport} eq "libomp-devel" } { @@ -48,13 +48,13 @@ - - checksums \ - openmp-${version}.src.tar.xz \ -- rmd160 e62aa3e855e692554dfdf946daffe6606848241c \ -- sha256 6ff2bb78c95d9b430203dcba50e41433e1f72696af7b2196c8056ac4bc9f2516 \ -- size 1278080 \ +- rmd160 de7bc41e8207077aee79e3ff45c782f489f8f383 \ +- sha256 a2536f06373774f2829d892b72eea5f97bab20e69b26b03042d947f992eb8e38 \ +- size 1278072 \ - cmake-${version}.src.tar.xz \ -- rmd160 e12f24f24ed8ad6b2adb5973a2db5fd107e237f9 \ -- sha256 b6d83c91f12757030d8361dedc5dd84357b3edb8da406b5d0850df8b6f7798b1 \ -- size 9004 +- rmd160 94ead500d749de031894e9a14c51ed17951c8fd7 \ +- sha256 39d342a4161095d2f28fb1253e4585978ac50521117da666e2b1f6f28b62f514 \ +- size 9008 + revision 0 if {${os.major} <= 12} { diff --git a/tools/MacPorts/multimedia/ffmpeg/Portfile b/tools/MacPorts/multimedia/ffmpeg/Portfile index 2ac3d6b512..6270de8f0c 100644 --- a/tools/MacPorts/multimedia/ffmpeg/Portfile +++ b/tools/MacPorts/multimedia/ffmpeg/Portfile @@ -18,8 +18,8 @@ set my_name ffmpeg conflicts ffmpeg-devel # Please increase the revision of mpv whenever ffmpeg's version is updated. -version 4.4.2 -revision 7 +version 4.4.4 +revision 1 epoch 1 license LGPL-2.1+ @@ -28,7 +28,6 @@ maintainers {mascguy @mascguy} {devans @dbevans} {jeremyhu @jeremyhu} op description FFmpeg is a complete solution to play, record, convert and \ stream audio and video. - long_description FFmpeg is a complete solution to record, convert and \ stream audio and video. It includes libavcodec, the \ leading audio/video codec library. \ @@ -56,50 +55,51 @@ long_description FFmpeg is a complete solution to record, convert and \ \ libavformat is a library containing parsers and \ generators for all common audio/video formats. - homepage https://ffmpeg.org/ + master_sites ${homepage}releases/ distname ${my_name}-${version} dist_subdir ${my_name} use_xz yes -checksums rmd160 22a690edfad74f25de0d24557f8edf4b2366b1a0 \ - sha256 af419a7f88adbc56c758ab19b4c708afbcae15ef09606b82b855291f6a6faa93 \ - size 9562968 +checksums rmd160 ac9916e0915cfe3952993644d0a26d9e7c70e1b7 \ + sha256 e80b380d595c809060f66f96a5d849511ef4a76a26b76eacf5778b94c3570309 \ + size 9565584 depends_build-append \ - port:pkgconfig \ - port:gmake \ port:cctools \ + port:gmake \ + port:pkgconfig \ port:texinfo depends_lib-append \ + port:bzip2 \ + port:dav1d \ + port:fontconfig \ + port:freetype \ + port:fribidi \ + path:lib/pkgconfig/gnutls.pc:gnutls \ + path:lib/pkgconfig/harfbuzz.pc:harfbuzz \ port:lame \ + port:libass \ + port:libbluray \ port:libiconv \ - port:libvorbis \ - port:libopus \ + port:libmodplug \ port:libogg \ + port:libopus \ path:lib/pkgconfig/librsvg-2.0.pc:librsvg \ port:libtheora \ - port:libmodplug \ - port:libass \ - port:libbluray \ + port:libvorbis \ path:lib/pkgconfig/vpx.pc:libvpx \ - path:lib/pkgconfig/gnutls.pc:gnutls \ + port:openjpeg \ port:openh264 \ port:snappy \ - port:openjpeg \ - port:zvbi \ - port:fontconfig \ - port:freetype \ - port:fribidi \ - path:lib/libspeex.dylib:speex \ port:soxr \ - port:dav1d \ - port:bzip2 \ + path:lib/libspeex.dylib:speex \ port:xz \ port:zimg \ - port:zlib + port:zlib \ + port:zvbi patchfiles-append patch-libavcodec-audiotoolboxenc.c.diff @@ -113,11 +113,6 @@ patchfiles-append patch-libavcodec-videotoolboxenc.c.diff # Fixed via upstream commit: b786bc7433dfe082441a57c1ba9ae9ea47904b78 patchfiles-append patch-issue-9439-non-b-frame-encoding.diff -# Patch for libsdl2; support newer versions -# https://trac.macports.org/ticket/65703 -# Fixed via upstream commit: e5163b1d34381a3319214a902ef1df923dd2eeba -patchfiles-append patch-libsdl2-version.diff - # Patch for upstream issue: # libavcodec/libsvtav1.c:124:53: error: no member named 'compressed_ten_bit_format' in 'struct EbSvtAv1EncConfiguration' # (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0; @@ -148,36 +143,31 @@ compiler.blacklist-append \ # Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473) default_variants-append +gpl2 +if {[tbool configure.ccache]} { + set ccache_path ${prefix}/bin/ccache + + configure.cc-prepend \ + ${ccache_path} + configure.cxx-prepend \ + ${ccache_path} +} + configure.cflags-append \ - -DHAVE_LRINTF ${configure.cppflags} + -DHAVE_LRINTF \ + -Wno-deprecated-declarations \ + ${configure.cppflags} + +set port_sharedir ${prefix}/share +set port_docdir ${port_sharedir}/doc + +configure.pre_args-append \ + --cxx="${configure.cxx}" \ + --cc="${configure.cc}" \ + --mandir=${prefix}/share/man configure.args-append \ - --enable-swscale \ - --enable-avfilter \ - --enable-avresample \ - --enable-libmp3lame \ - --enable-libvorbis \ - --enable-libopus \ - --enable-librsvg \ - --enable-libtheora \ - --enable-libopenjpeg \ - --enable-libopenh264 \ - --enable-libsnappy \ - --enable-libmodplug \ - --enable-libvpx \ - --enable-libsoxr \ - --enable-libspeex \ - --enable-libass \ - --enable-libbluray \ - --enable-libzimg \ - --enable-libzvbi \ - --enable-lzma \ - --enable-gnutls \ - --enable-fontconfig \ - --enable-libfreetype \ - --enable-libfribidi \ - --enable-libdav1d \ - --enable-zlib \ + --disable-audiotoolbox \ + --disable-indev=jack \ --disable-libaom \ --disable-libjack \ --disable-libopencore-amrnb \ @@ -185,139 +175,156 @@ configure.args-append \ --disable-libxcb \ --disable-libxcb-shm \ --disable-libxcb-xfixes \ - --disable-xlib \ - --disable-indev=jack \ --disable-opencl \ --disable-outdev=xv \ - --disable-audiotoolbox \ - --disable-videotoolbox \ --disable-sdl2 \ --disable-securetransport \ - --mandir=${prefix}/share/man \ - --enable-shared \ + --disable-videotoolbox \ + --disable-xlib \ + --enable-avfilter \ + --enable-avresample \ + --enable-fontconfig \ + --enable-gnutls \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfreetype \ + --enable-libfribidi \ + --enable-libmodplug \ + --enable-libmp3lame \ + --enable-libopenjpeg \ + --enable-libopenh264 \ + --enable-libsnappy \ + --enable-libopus \ + --enable-librsvg \ + --enable-libsoxr \ + --enable-libspeex \ + --enable-libtheora \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libzimg \ + --enable-libzvbi \ + --enable-lzma \ --enable-pthreads \ - --cxx=${configure.cxx} \ - --cc=${configure.cc} + --enable-shared \ + --enable-swscale \ + --enable-zlib + +post-extract { + # fix file perms; tarball contents deny group and world read + system "find ${worksrcpath} -type d -print0 | xargs -0 chmod a+rx" + system "find ${worksrcpath} -type f -print0 | xargs -0 chmod a+r" +} + +platform darwin 8 { + post-patch { + reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure + } +} platform darwin { # disable asm on Tiger # libblueray doesn't build on Tiger so disable for now (#39442) if {${os.major} < 9} { - depends_lib-delete port:libbluray - configure.args-replace --enable-libbluray --disable-libbluray - configure.args-append --disable-asm + depends_lib-delete \ + port:libbluray + configure.args-replace \ + --enable-libbluray \ + --disable-libbluray + configure.args-append \ + --disable-asm } # as of 1.6.0 libvpx only supports darwin 10 or later if {${os.major} < 10} { - depends_lib-delete path:lib/pkgconfig/vpx.pc:libvpx - configure.args-replace --enable-libvpx --disable-libvpx + depends_lib-delete \ + path:lib/pkgconfig/vpx.pc:libvpx + configure.args-replace \ + --enable-libvpx \ + --disable-libvpx } # filters coreimage and coreimagesrc don't build on 10.6 # and earlier due to use of bridged casts in Objective C (#51823) if {${os.major} < 11} { - configure.args-append --disable-filter=coreimage \ - --disable-filter=coreimagesrc + configure.args-append \ + --disable-filter=coreimage \ + --disable-filter=coreimagesrc } # AudioToolbox support requires CoreMedia Framework available on 10.7+ if {${os.major} > 10} { - configure.args-replace --disable-audiotoolbox --enable-audiotoolbox + configure.args-replace \ + --disable-audiotoolbox \ + --enable-audiotoolbox } if {${os.major} > 9 && ${build_arch} ni [list ppc ppc64]} { # libsdl2 requires minimum Xcode 10.7 SDK to build successfully # but builds on Snow Leopard x86. Exclude ppc until fixed. - configure.args-replace --disable-sdl2 --enable-sdl2 - depends_lib-append port:libsdl2 + configure.args-replace \ + --disable-sdl2 \ + --enable-sdl2 + depends_lib-append \ + port:libsdl2 } # VideoToolbox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay". # It provides support for H265, H264, H263, MPEG1, MPEG2 and MPEG4. if {${os.major} > 11} { - configure.args-replace --disable-videotoolbox --enable-videotoolbox + configure.args-replace \ + --disable-videotoolbox \ + --enable-videotoolbox } # OpenCL support requires version 1.2 available 10.8+ if {${os.major} > 11} { - configure.args-replace --disable-opencl --enable-opencl + configure.args-replace \ + --disable-opencl \ + --enable-opencl } # Apple GCC has problems with SIMD intrinsics and -Werror=no-missing-prototypes. if {${os.major} < 11} { - patchfiles-append patch-configure-no-error-on-missing-prototypes.diff + patchfiles-append \ + patch-configure-no-error-on-missing-prototypes.diff } # avfoundation is only available on 10.7+ # as of ffmpeg 3.4.1 build fails on 10.7 as well # libavdevice/avfoundation.m:207:14: error: expected method to read dictionary element not found on object of type 'NSDictionary *' if {${os.major} < 12} { - configure.args-append --disable-indev=avfoundation + configure.args-append \ + --disable-indev=avfoundation } # av1 codecs, available on 10.5+ if {${os.major} >= 9} { configure.args-append \ - --enable-libaom \ - --enable-libsvtav1 + --enable-libaom \ + --enable-libsvtav1 depends_lib-append \ - port:aom \ - port:svt-av1 - } - - # Available on 10.7+ - if {${os.major} >= 11} { - configure.args-append \ - --enable-librav1e - depends_lib-append \ - port:rav1e - } -} - -build.cmd ${prefix}/bin/gmake -build.env-append V=1 - -test.run yes - -destroot.env-append V=1 - -post-extract { - # fix file perms; tarball contents deny group and world read - system "find ${worksrcpath} -type d -print0 | xargs -0 chmod a+rx" - system "find ${worksrcpath} -type f -print0 | xargs -0 chmod a+r" -} - -post-extract { - if {${configure.cxx_stdlib} eq "libc++"} { - # fix configure, which contains many references to libstdc++ - reinplace -E {s|-lstdc|-lc|g} ${worksrcpath}/configure + port:aom \ + port:svt-av1 } -} -post-configure { - if {[variant_isset universal]} { - # fix *.pc for universal build (i386 version may miss these extra bits on Leopard) - foreach arch ${universal_archs_to_use} { - foreach fixfile [exec find ${worksrcpath}-${arch} -name "*.pc"] { - reinplace -E {s|Libs.private: -l|Libs.private: -framework QTKit -framework Foundation -framework QuartzCore -l|g} ${fixfile} - } + # Available on 10.6+ + if {(${os.major} >= 10) && (${configure.build_arch} ne "ppc")} { + # Only enable 'rav1e', for non-slim installation + if {![variant_isset slim]} { + configure.args-append \ + --enable-librav1e + depends_lib-append \ + port:rav1e } } } -post-destroot { - file mkdir ${destroot}${prefix}/share/doc/ffmpeg - file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg - foreach f [glob ${worksrcpath}/doc/*.txt] { - file copy $f ${destroot}${prefix}/share/doc/ffmpeg - } -} - platform powerpc { # absence of altivec is not automatically detected if {[catch {sysctl hw.vectorunit} result] || $result == 0} { - configure.args-append --disable-altivec + configure.args-append \ + --disable-altivec # as this machine is a G3, force a local build so we don't download a buildbot-built # version possibly built on a G4+ or cross-compiled from an Intel system @@ -328,17 +335,13 @@ platform powerpc { #Undefined symbols: # "___atomic_fetch_sub_8", referenced from: # _fifo_thread_dispatch_message.part.4 in fifo.o - configure.ldflags-append -latomic -} - -platform darwin 8 { - post-patch { - reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure - } + configure.ldflags-append \ + -latomic } # configure isn't autoconf and they do use a dep cache -configure.universal_args-delete --disable-dependency-tracking +configure.universal_args-delete \ + --disable-dependency-tracking if {${universal_possible} && [variant_isset universal]} { # the following is inspired by the icu Portfile @@ -352,31 +355,77 @@ if {${universal_possible} && [variant_isset universal]} { } foreach arch ${configure.universal_archs} { set merger_host($arch) "" - lappend merger_configure_args($arch) --arch=${arch} - lappend merger_configure_env($arch) "ASFLAGS=-arch ${arch}" + lappend merger_configure_args($arch) \ + --arch=${arch} + lappend merger_configure_env($arch) \ + "ASFLAGS=-arch ${arch}" } if {[string match "*86*" ${configure.universal_archs}]} { - depends_build-append port:nasm + depends_build-append \ + port:nasm } - lappend merger_configure_args(i386) --enable-x86asm - lappend merger_configure_args(x86_64) --enable-x86asm + lappend merger_configure_args(i386) \ + --enable-x86asm + lappend merger_configure_args(x86_64) \ + --enable-x86asm } else { - configure.args-append --arch=${configure.build_arch} - configure.env-append ASFLAGS=[get_canonical_archflags] + configure.args-append \ + --arch=${configure.build_arch} + configure.env-append \ + ASFLAGS=[get_canonical_archflags] if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} { - depends_build-append port:nasm - configure.args-append --enable-x86asm + depends_build-append \ + port:nasm + configure.args-append \ + --enable-x86asm + } +} + +build.cmd ${prefix}/bin/gmake +build.env-append V=1 + +test.run yes + +destroot.env-append V=1 + +post-extract { + if {${configure.cxx_stdlib} eq "libc++"} { + # fix configure, which contains many references to libstdc++ + reinplace -E {s|-lstdc|-lc|g} ${worksrcpath}/configure + } +} + +post-configure { + if {[variant_isset universal]} { + # fix *.pc for universal build (i386 version may miss these extra bits on Leopard) + foreach arch ${universal_archs_to_use} { + foreach fixfile [exec find ${worksrcpath}-${arch} -name "*.pc"] { + reinplace -E {s|Libs.private: -l|Libs.private: -framework QTKit -framework Foundation -framework QuartzCore -l|g} ${fixfile} + } + } + } +} + +post-destroot { + # Copy docs + file mkdir ${destroot}${port_docdir} + file copy ${worksrcpath}/doc/APIchanges ${destroot}${port_docdir} + foreach f [glob ${worksrcpath}/doc/*.txt] { + file copy $f ${destroot}${port_docdir} } } variant x11 { # enable x11grab_xcb input device - depends_lib-append port:xorg-libxcb \ - port:xorg-libXext \ - port:xorg-libXfixes - configure.args-delete --disable-libxcb \ - --disable-libxcb-shm \ - --disable-libxcb-xfixes + depends_lib-append \ + port:xorg-libxcb \ + port:xorg-libXext \ + port:xorg-libXfixes + configure.args-delete \ + --disable-xlib \ + --disable-libxcb \ + --disable-libxcb-shm \ + --disable-libxcb-xfixes } variant natronmini requires highbitdepth aom conflicts x11 description {Minimal FFmpeg for Natron, without bluray, subtitles, network, display support.} { @@ -427,8 +476,10 @@ if {[variant_isset x11]} { variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} { - depends_lib-append port:libdc1394 - configure.args-append --enable-libdc1394 + depends_lib-append \ + port:libdc1394 + configure.args-append \ + --enable-libdc1394 } # Allow use of librtmp instead of ffmpeg's internal rtmp implementation @@ -436,23 +487,32 @@ variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 ( # https://trac.macports.org/ticket/32219 # https://groups.google.com/forum/#!topic/c-rtmp-server/ywQPjvciPgc # https://trac.ffmpeg.org/ticket/1700 - variant librtmp description {Use librtmp (from rtmpdump) as rtmp[t][es]:// protocol handler} { - configure.args-append --enable-librtmp - depends_lib-append port:rtmpdump + configure.args-append \ + --enable-librtmp + depends_lib-append \ + port:rtmpdump } variant jack description {Enable jack library and indev support} { # jack will autoconfigure if not disabled - depends_lib-append port:jack - configure.args-replace --disable-libjack --enable-libjack - configure.args-replace --disable-indev=jack --enable-indev=jack + depends_lib-append \ + port:jack + configure.args-replace \ + --disable-libjack \ + --enable-libjack + configure.args-replace \ + --disable-indev=jack \ + --enable-indev=jack } variant darwinssl description {Enable https support using Apple built-in TLS library instead of GNU TLS} { - configure.args-delete --disable-securetransport - configure.args-delete --enable-gnutls - depends_lib-delete path:lib/pkgconfig/gnutls.pc:gnutls + configure.args-delete \ + --disable-securetransport + configure.args-delete \ + --enable-gnutls + depends_lib-delete \ + path:lib/pkgconfig/gnutls.pc:gnutls } variant aom description {Enable Alliance for Open Media AV1 Codec} { @@ -470,26 +530,32 @@ if {[variant_isset highbitdepth]} { } variant gpl2 description {Enable GPL code, license will be GPL-2+} { - configure.args-append --enable-gpl \ - --enable-postproc \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libvidstab - depends_lib-append port:XviD \ - port:x264 \ - port:x265 \ - port:libvidstab - license GPL-2+ + license GPL-2+ + + configure.args-append \ + --enable-gpl \ + --enable-libvidstab \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-postproc + depends_lib-append \ + port:libvidstab \ + port:x264 \ + port:x265 \ + port:XviD } variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} { - configure.args-append --enable-version3 \ - --enable-libsmbclient \ - --enable-libaribb24 - depends_lib-append path:lib/pkgconfig/smbclient.pc:samba3 \ - port:libaribb24 - license GPL-3+ + license GPL-3+ + + configure.args-append \ + --enable-libaribb24 \ + --enable-libsmbclient \ + --enable-version3 + depends_lib-append \ + port:libaribb24 \ + path:lib/pkgconfig/smbclient.pc:samba3 # samba3 cannot be built universal (http://trac.macports.org/ticket/34558) if {[variant_isset universal]} { @@ -500,14 +566,18 @@ variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} # the build server uses the default variants, and we want distributable binaries # nonfree code is disabled by default but can be enabled using the +nonfree variant - variant nonfree description {enable nonfree code, libraries and binaries will not be redistributable} { - configure.args-append --enable-nonfree \ - --enable-libfdk-aac - depends_lib-append port:libfdk-aac - license Restrictive + license Restrictive + + configure.args-append \ + --enable-libfdk-aac \ + --enable-nonfree + depends_lib-append \ + port:libfdk-aac } +variant slim description {Trim dependencies slightly, without significantly impacting overall feature set} {} + if {[variant_isset nonfree]} { notes " This build of ${name} includes nonfree code as follows: @@ -555,4 +625,4 @@ and is therefore licensed under LGPL v2.1 or later. livecheck.type regex livecheck.url ${master_sites} -livecheck.regex "${my_name}-(\\d+(?:\\.\\d+)*)${extract.suffix}" +livecheck.regex "${my_name}-(4(?:\\.\\d+)*)${extract.suffix}" diff --git a/tools/MacPorts/multimedia/ffmpeg/Portfile.orig b/tools/MacPorts/multimedia/ffmpeg/Portfile.orig index 9925fa24d2..d2fbb4aaee 100644 --- a/tools/MacPorts/multimedia/ffmpeg/Portfile.orig +++ b/tools/MacPorts/multimedia/ffmpeg/Portfile.orig @@ -18,8 +18,8 @@ set my_name ffmpeg conflicts ffmpeg-devel # Please increase the revision of mpv whenever ffmpeg's version is updated. -version 4.4.2 -revision 7 +version 4.4.4 +revision 1 epoch 1 license LGPL-2.1+ @@ -28,7 +28,6 @@ maintainers {mascguy @mascguy} {devans @dbevans} {jeremyhu @jeremyhu} op description FFmpeg is a complete solution to play, record, convert and \ stream audio and video. - long_description FFmpeg is a complete solution to record, convert and \ stream audio and video. It includes libavcodec, the \ leading audio/video codec library. \ @@ -56,48 +55,49 @@ long_description FFmpeg is a complete solution to record, convert and \ \ libavformat is a library containing parsers and \ generators for all common audio/video formats. - homepage https://ffmpeg.org/ + master_sites ${homepage}releases/ distname ${my_name}-${version} dist_subdir ${my_name} use_xz yes -checksums rmd160 22a690edfad74f25de0d24557f8edf4b2366b1a0 \ - sha256 af419a7f88adbc56c758ab19b4c708afbcae15ef09606b82b855291f6a6faa93 \ - size 9562968 +checksums rmd160 ac9916e0915cfe3952993644d0a26d9e7c70e1b7 \ + sha256 e80b380d595c809060f66f96a5d849511ef4a76a26b76eacf5778b94c3570309 \ + size 9565584 depends_build-append \ - port:pkgconfig \ - port:gmake \ port:cctools \ + port:gmake \ + port:pkgconfig \ port:texinfo depends_lib-append \ + port:bzip2 \ + port:dav1d \ + port:fontconfig \ + port:freetype \ + port:fribidi \ + path:lib/pkgconfig/gnutls.pc:gnutls \ + path:lib/pkgconfig/harfbuzz.pc:harfbuzz \ port:lame \ + port:libass \ + port:libbluray \ port:libiconv \ - port:libvorbis \ - port:libopus \ + port:libmodplug \ port:libogg \ + port:libopus \ path:lib/pkgconfig/librsvg-2.0.pc:librsvg \ port:libtheora \ - port:libmodplug \ - port:libass \ - port:libbluray \ + port:libvorbis \ path:lib/pkgconfig/vpx.pc:libvpx \ - path:lib/pkgconfig/gnutls.pc:gnutls \ port:openjpeg \ - port:zvbi \ - port:fontconfig \ - port:freetype \ - port:fribidi \ - path:lib/libspeex.dylib:speex \ port:soxr \ - port:dav1d \ - port:bzip2 \ + path:lib/libspeex.dylib:speex \ port:xz \ port:zimg \ - port:zlib + port:zlib \ + port:zvbi patchfiles-append patch-libavcodec-audiotoolboxenc.c.diff @@ -111,11 +111,6 @@ patchfiles-append patch-libavcodec-videotoolboxenc.c.diff # Fixed via upstream commit: b786bc7433dfe082441a57c1ba9ae9ea47904b78 patchfiles-append patch-issue-9439-non-b-frame-encoding.diff -# Patch for libsdl2; support newer versions -# https://trac.macports.org/ticket/65703 -# Fixed via upstream commit: e5163b1d34381a3319214a902ef1df923dd2eeba -patchfiles-append patch-libsdl2-version.diff - # Patch for upstream issue: # libavcodec/libsvtav1.c:124:53: error: no member named 'compressed_ten_bit_format' in 'struct EbSvtAv1EncConfiguration' # (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0; @@ -141,153 +136,183 @@ compiler.blacklist-append {clang < 800} # Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473) default_variants-append +gpl2 +if {[tbool configure.ccache]} { + set ccache_path ${prefix}/bin/ccache + + configure.cc-prepend \ + ${ccache_path} + configure.cxx-prepend \ + ${ccache_path} +} + configure.cflags-append \ - -DHAVE_LRINTF ${configure.cppflags} + -DHAVE_LRINTF \ + -Wno-deprecated-declarations \ + ${configure.cppflags} + +set port_sharedir ${prefix}/share +set port_docdir ${port_sharedir}/doc + +configure.pre_args-append \ + --cc="${configure.cc}" \ + --mandir=${prefix}/share/man configure.args-append \ - --enable-swscale \ - --enable-avfilter \ - --enable-avresample \ - --enable-libmp3lame \ - --enable-libvorbis \ - --enable-libopus \ - --enable-librsvg \ - --enable-libtheora \ - --enable-libopenjpeg \ - --enable-libmodplug \ - --enable-libvpx \ - --enable-libsoxr \ - --enable-libspeex \ - --enable-libass \ - --enable-libbluray \ - --enable-libzimg \ - --enable-libzvbi \ - --enable-lzma \ - --enable-gnutls \ - --enable-fontconfig \ - --enable-libfreetype \ - --enable-libfribidi \ - --enable-libdav1d \ - --enable-zlib \ + --disable-audiotoolbox \ + --disable-indev=jack \ --disable-libjack \ --disable-libopencore-amrnb \ --disable-libopencore-amrwb \ --disable-libxcb \ --disable-libxcb-shm \ --disable-libxcb-xfixes \ - --disable-indev=jack \ --disable-opencl \ --disable-outdev=xv \ - --disable-audiotoolbox \ - --disable-videotoolbox \ --disable-sdl2 \ --disable-securetransport \ - --mandir=${prefix}/share/man \ - --enable-shared \ + --disable-videotoolbox \ + --enable-avfilter \ + --enable-avresample \ + --enable-fontconfig \ + --enable-gnutls \ + --enable-libass \ + --enable-libbluray \ + --enable-libdav1d \ + --enable-libfreetype \ + --enable-libfribidi \ + --enable-libmodplug \ + --enable-libmp3lame \ + --enable-libopenjpeg \ + --enable-libopus \ + --enable-librsvg \ + --enable-libsoxr \ + --enable-libspeex \ + --enable-libtheora \ + --enable-libvorbis \ + --enable-libvpx \ + --enable-libzimg \ + --enable-libzvbi \ + --enable-lzma \ --enable-pthreads \ - --cc=${configure.cc} + --enable-shared \ + --enable-swscale \ + --enable-zlib + +post-extract { + # fix file perms; tarball contents deny group and world read + system "find ${worksrcpath} -type d -print0 | xargs -0 chmod a+rx" + system "find ${worksrcpath} -type f -print0 | xargs -0 chmod a+r" +} + +platform darwin 8 { + post-patch { + reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure + } +} platform darwin { # disable asm on Tiger # libblueray doesn't build on Tiger so disable for now (#39442) if {${os.major} < 9} { - depends_lib-delete port:libbluray - configure.args-replace --enable-libbluray --disable-libbluray - configure.args-append --disable-asm + depends_lib-delete \ + port:libbluray + configure.args-replace \ + --enable-libbluray \ + --disable-libbluray + configure.args-append \ + --disable-asm } # as of 1.6.0 libvpx only supports darwin 10 or later if {${os.major} < 10} { - depends_lib-delete path:lib/pkgconfig/vpx.pc:libvpx - configure.args-replace --enable-libvpx --disable-libvpx + depends_lib-delete \ + path:lib/pkgconfig/vpx.pc:libvpx + configure.args-replace \ + --enable-libvpx \ + --disable-libvpx } # filters coreimage and coreimagesrc don't build on 10.6 # and earlier due to use of bridged casts in Objective C (#51823) if {${os.major} < 11} { - configure.args-append --disable-filter=coreimage \ - --disable-filter=coreimagesrc + configure.args-append \ + --disable-filter=coreimage \ + --disable-filter=coreimagesrc } # AudioToolbox support requires CoreMedia Framework available on 10.7+ if {${os.major} > 10} { - configure.args-replace --disable-audiotoolbox --enable-audiotoolbox + configure.args-replace \ + --disable-audiotoolbox \ + --enable-audiotoolbox } if {${os.major} > 9 && ${build_arch} ni [list ppc ppc64]} { # libsdl2 requires minimum Xcode 10.7 SDK to build successfully # but builds on Snow Leopard x86. Exclude ppc until fixed. - configure.args-replace --disable-sdl2 --enable-sdl2 - depends_lib-append port:libsdl2 + configure.args-replace \ + --disable-sdl2 \ + --enable-sdl2 + depends_lib-append \ + port:libsdl2 } # VideoToolbox, a new hardware acceleration framework, is supported on 10.8+ and "here to stay". # It provides support for H265, H264, H263, MPEG1, MPEG2 and MPEG4. if {${os.major} > 11} { - configure.args-replace --disable-videotoolbox --enable-videotoolbox + configure.args-replace \ + --disable-videotoolbox \ + --enable-videotoolbox } # OpenCL support requires version 1.2 available 10.8+ if {${os.major} > 11} { - configure.args-replace --disable-opencl --enable-opencl + configure.args-replace \ + --disable-opencl \ + --enable-opencl } # Apple GCC has problems with SIMD intrinsics and -Werror=no-missing-prototypes. if {${os.major} < 11} { - patchfiles-append patch-configure-no-error-on-missing-prototypes.diff + patchfiles-append \ + patch-configure-no-error-on-missing-prototypes.diff } # avfoundation is only available on 10.7+ # as of ffmpeg 3.4.1 build fails on 10.7 as well # libavdevice/avfoundation.m:207:14: error: expected method to read dictionary element not found on object of type 'NSDictionary *' if {${os.major} < 12} { - configure.args-append --disable-indev=avfoundation + configure.args-append \ + --disable-indev=avfoundation } # av1 codecs, available on 10.5+ if {${os.major} >= 9} { configure.args-append \ - --enable-libaom \ - --enable-libsvtav1 - depends_lib-append \ - port:aom \ - port:svt-av1 - } - - # Available on 10.7+ - if {${os.major} >= 11} { - configure.args-append \ - --enable-librav1e + --enable-libaom \ + --enable-libsvtav1 depends_lib-append \ - port:rav1e + port:aom \ + port:svt-av1 } -} - -build.cmd ${prefix}/bin/gmake -build.env-append V=1 -test.run yes - -destroot.env-append V=1 - -post-extract { - # fix file perms; tarball contents deny group and world read - system "find ${worksrcpath} -type d -print0 | xargs -0 chmod a+rx" - system "find ${worksrcpath} -type f -print0 | xargs -0 chmod a+r" -} - -post-destroot { - file mkdir ${destroot}${prefix}/share/doc/ffmpeg - file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg - foreach f [glob ${worksrcpath}/doc/*.txt] { - file copy $f ${destroot}${prefix}/share/doc/ffmpeg + # Available on 10.6+ + if {(${os.major} >= 10) && (${configure.build_arch} ne "ppc")} { + # Only enable 'rav1e', for non-slim installation + if {![variant_isset slim]} { + configure.args-append \ + --enable-librav1e + depends_lib-append \ + port:rav1e + } } } platform powerpc { # absence of altivec is not automatically detected if {[catch {sysctl hw.vectorunit} result] || $result == 0} { - configure.args-append --disable-altivec + configure.args-append \ + --disable-altivec # as this machine is a G3, force a local build so we don't download a buildbot-built # version possibly built on a G4+ or cross-compiled from an Intel system @@ -298,46 +323,70 @@ platform powerpc { #Undefined symbols: # "___atomic_fetch_sub_8", referenced from: # _fifo_thread_dispatch_message.part.4 in fifo.o - configure.ldflags-append -latomic -} - -platform darwin 8 { - post-patch { - reinplace "s:,-compatibility_version,$\(LIBMAJOR\)::" ${worksrcpath}/configure - } + configure.ldflags-append \ + -latomic } # configure isn't autoconf and they do use a dep cache -configure.universal_args-delete --disable-dependency-tracking +configure.universal_args-delete \ + --disable-dependency-tracking if {${universal_possible} && [variant_isset universal]} { foreach arch ${configure.universal_archs} { set merger_host($arch) "" - lappend merger_configure_args($arch) --arch=${arch} - lappend merger_configure_env($arch) "ASFLAGS=-arch ${arch}" + lappend merger_configure_args($arch) \ + --arch=${arch} + lappend merger_configure_env($arch) \ + "ASFLAGS=-arch ${arch}" } if {[string match "*86*" ${configure.universal_archs}]} { - depends_build-append port:nasm + depends_build-append \ + port:nasm } - lappend merger_configure_args(i386) --enable-x86asm - lappend merger_configure_args(x86_64) --enable-x86asm + lappend merger_configure_args(i386) \ + --enable-x86asm + lappend merger_configure_args(x86_64) \ + --enable-x86asm } else { - configure.args-append --arch=${configure.build_arch} - configure.env-append ASFLAGS=[get_canonical_archflags] + configure.args-append \ + --arch=${configure.build_arch} + configure.env-append \ + ASFLAGS=[get_canonical_archflags] if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} { - depends_build-append port:nasm - configure.args-append --enable-x86asm + depends_build-append \ + port:nasm + configure.args-append \ + --enable-x86asm + } +} + +build.cmd ${prefix}/bin/gmake +build.env-append V=1 + +test.run yes + +destroot.env-append V=1 + +post-destroot { + # Copy docs + file mkdir ${destroot}${port_docdir} + file copy ${worksrcpath}/doc/APIchanges ${destroot}${port_docdir} + foreach f [glob ${worksrcpath}/doc/*.txt] { + file copy $f ${destroot}${port_docdir} } } variant x11 { # enable x11grab_xcb input device - depends_lib-append port:xorg-libxcb \ - port:xorg-libXext \ - port:xorg-libXfixes - configure.args-delete --disable-libxcb \ - --disable-libxcb-shm \ - --disable-libxcb-xfixes + depends_lib-append \ + port:xorg-libxcb \ + port:xorg-libXext \ + port:xorg-libXfixes + configure.args-delete \ + --disable-xlib \ + --disable-libxcb \ + --disable-libxcb-shm \ + --disable-libxcb-xfixes } if {[variant_isset x11]} { @@ -347,8 +396,10 @@ if {[variant_isset x11]} { } variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} { - depends_lib-append port:libdc1394 - configure.args-append --enable-libdc1394 + depends_lib-append \ + port:libdc1394 + configure.args-append \ + --enable-libdc1394 } # Allow use of librtmp instead of ffmpeg's internal rtmp implementation @@ -356,58 +407,77 @@ variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 ( # https://trac.macports.org/ticket/32219 # https://groups.google.com/forum/#!topic/c-rtmp-server/ywQPjvciPgc # https://trac.ffmpeg.org/ticket/1700 - variant librtmp description {Use librtmp (from rtmpdump) as rtmp[t][es]:// protocol handler} { - configure.args-append --enable-librtmp - depends_lib-append port:rtmpdump + configure.args-append \ + --enable-librtmp + depends_lib-append \ + port:rtmpdump } variant jack description {Enable jack library and indev support} { # jack will autoconfigure if not disabled - depends_lib-append port:jack - configure.args-replace --disable-libjack --enable-libjack - configure.args-replace --disable-indev=jack --enable-indev=jack + depends_lib-append \ + port:jack + configure.args-replace \ + --disable-libjack \ + --enable-libjack + configure.args-replace \ + --disable-indev=jack \ + --enable-indev=jack } variant darwinssl description {Enable https support using Apple built-in TLS library instead of GNU TLS} { - configure.args-delete --disable-securetransport - configure.args-delete --enable-gnutls - depends_lib-delete path:lib/pkgconfig/gnutls.pc:gnutls + configure.args-delete \ + --disable-securetransport + configure.args-delete \ + --enable-gnutls + depends_lib-delete \ + path:lib/pkgconfig/gnutls.pc:gnutls } variant gpl2 description {Enable GPL code, license will be GPL-2+} { - configure.args-append --enable-gpl \ - --enable-postproc \ - --enable-libx264 \ - --enable-libx265 \ - --enable-libxvid \ - --enable-libvidstab - depends_lib-append port:XviD \ - port:x264 \ - port:x265 \ - port:libvidstab - license GPL-2+ + license GPL-2+ + + configure.args-append \ + --enable-gpl \ + --enable-libvidstab \ + --enable-libx264 \ + --enable-libx265 \ + --enable-libxvid \ + --enable-postproc + depends_lib-append \ + port:libvidstab \ + port:x264 \ + port:x265 \ + port:XviD } variant gpl3 requires gpl2 description {Enable GPL code, license will be GPL-3+} { - configure.args-append --enable-version3 \ - --enable-libsmbclient \ - --enable-libaribb24 - depends_lib-append path:lib/pkgconfig/smbclient.pc:samba3 \ - port:libaribb24 - license GPL-3+ + license GPL-3+ + + configure.args-append \ + --enable-libaribb24 \ + --enable-libsmbclient \ + --enable-version3 + depends_lib-append \ + port:libaribb24 \ + path:lib/pkgconfig/smbclient.pc:samba3 } # the build server uses the default variants, and we want distributable binaries # nonfree code is disabled by default but can be enabled using the +nonfree variant - variant nonfree description {enable nonfree code, libraries and binaries will not be redistributable} { - configure.args-append --enable-nonfree \ - --enable-libfdk-aac - depends_lib-append port:libfdk-aac - license Restrictive + license Restrictive + + configure.args-append \ + --enable-libfdk-aac \ + --enable-nonfree + depends_lib-append \ + port:libfdk-aac } +variant slim description {Trim dependencies slightly, without significantly impacting overall feature set} {} + if {[variant_isset nonfree]} { notes " This build of ${name} includes nonfree code as follows: @@ -455,4 +525,4 @@ and is therefore licensed under LGPL v2.1 or later. livecheck.type regex livecheck.url ${master_sites} -livecheck.regex "${my_name}-(\\d+(?:\\.\\d+)*)${extract.suffix}" +livecheck.regex "${my_name}-(4(?:\\.\\d+)*)${extract.suffix}" diff --git a/tools/MacPorts/multimedia/ffmpeg/Portfile.patch b/tools/MacPorts/multimedia/ffmpeg/Portfile.patch index d958afe567..e3b302ba66 100644 --- a/tools/MacPorts/multimedia/ffmpeg/Portfile.patch +++ b/tools/MacPorts/multimedia/ffmpeg/Portfile.patch @@ -1,18 +1,18 @@ ---- Portfile.orig 2022-10-06 08:08:57.000000000 -0700 -+++ Portfile 2022-10-06 08:09:48.000000000 -0700 -@@ -86,6 +86,8 @@ - port:libbluray \ +--- Portfile.orig 2023-07-03 17:31:16.000000000 -0700 ++++ Portfile 2023-07-03 17:35:55.000000000 -0700 +@@ -92,6 +92,8 @@ + port:libvorbis \ path:lib/pkgconfig/vpx.pc:libvpx \ - path:lib/pkgconfig/gnutls.pc:gnutls \ + port:openjpeg \ + port:openh264 \ + port:snappy \ - port:openjpeg \ - port:zvbi \ - port:fontconfig \ -@@ -128,6 +130,11 @@ + port:soxr \ + path:lib/libspeex.dylib:speex \ + port:xz \ +@@ -132,6 +134,11 @@ # warning: unknown warning option '-Wno-bool-operation'; did you mean '-Wno-bool-conversion'? [-Wunknown-warning-option] compiler.blacklist-append {clang < 800} - + +# gcc > 4.2 is required, https://trac.ffmpeg.org/ticket/1464 +# WARNING: gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler. +compiler.blacklist-append \ @@ -21,42 +21,58 @@ # The old ffmpeg port was GPL-2+ as base and had a no_gpl variant, so this keeps us consistent # Also, -gpl2 causes other ports to fail to build due to the missing libpostproc (#35473) default_variants-append +gpl2 -@@ -145,6 +152,8 @@ - --enable-librsvg \ - --enable-libtheora \ - --enable-libopenjpeg \ -+ --enable-libopenh264 \ -+ --enable-libsnappy \ - --enable-libmodplug \ - --enable-libvpx \ - --enable-libsoxr \ -@@ -159,12 +168,14 @@ - --enable-libfreetype \ - --enable-libfribidi \ - --enable-zlib \ +@@ -154,12 +161,14 @@ + set port_docdir ${port_sharedir}/doc + + configure.pre_args-append \ ++ --cxx="${configure.cxx}" \ + --cc="${configure.cc}" \ + --mandir=${prefix}/share/man + + configure.args-append \ + --disable-audiotoolbox \ + --disable-indev=jack \ + --disable-libaom \ --disable-libjack \ --disable-libopencore-amrnb \ --disable-libopencore-amrwb \ - --disable-libxcb \ - --disable-libxcb-shm \ - --disable-libxcb-xfixes \ +@@ -171,6 +180,7 @@ + --disable-sdl2 \ + --disable-securetransport \ + --disable-videotoolbox \ + --disable-xlib \ - --disable-indev=jack \ - --disable-opencl \ - --disable-outdev=xv \ -@@ -175,6 +186,7 @@ - --mandir=${prefix}/share/man \ - --enable-shared \ - --enable-pthreads \ -+ --cxx=${configure.cxx} \ - --cc=${configure.cc} - - platform darwin { -@@ -266,6 +278,24 @@ - system "find ${worksrcpath} -type f -print0 | xargs -0 chmod a+r" - } - + --enable-avfilter \ + --enable-avresample \ + --enable-fontconfig \ +@@ -183,6 +193,8 @@ + --enable-libmodplug \ + --enable-libmp3lame \ + --enable-libopenjpeg \ ++ --enable-libopenh264 \ ++ --enable-libsnappy \ + --enable-libopus \ + --enable-librsvg \ + --enable-libsoxr \ +@@ -329,6 +341,15 @@ + --disable-dependency-tracking + + if {${universal_possible} && [variant_isset universal]} { ++ # the following is inspired by the icu Portfile ++ # if we can't run executables for the target arch, mark it as a cross-compile ++ foreach arch ${configure.universal_archs} { ++ if {((${os.major} < 9 || [sysctl hw.cpu64bit_capable] == 0) && ($arch == "x86_64" || $arch == "ppc64")) ++ || (${os.arch} == "powerpc" && ($arch == "x86_64" || $arch == "i386")) ++ || (${os.arch} == "i386" && ($arch == "ppc" || $arch == "ppc64"))} { ++ set merger_configure_args($arch) "--enable-cross-compile --target-os=${os.platform}" ++ } ++ } + foreach arch ${configure.universal_archs} { + set merger_host($arch) "" + lappend merger_configure_args($arch) \ +@@ -364,6 +385,24 @@ + + destroot.env-append V=1 + +post-extract { + if {${configure.cxx_stdlib} eq "libc++"} { + # fix configure, which contains many references to libstdc++ @@ -76,28 +92,12 @@ +} + post-destroot { - file mkdir ${destroot}${prefix}/share/doc/ffmpeg - file copy ${worksrcpath}/doc/APIchanges ${destroot}${prefix}/share/doc/ffmpeg -@@ -301,6 +331,15 @@ - configure.universal_args-delete --disable-dependency-tracking - - if {${universal_possible} && [variant_isset universal]} { -+ # the following is inspired by the icu Portfile -+ # if we can't run executables for the target arch, mark it as a cross-compile -+ foreach arch ${configure.universal_archs} { -+ if {((${os.major} < 9 || [sysctl hw.cpu64bit_capable] == 0) && ($arch == "x86_64" || $arch == "ppc64")) -+ || (${os.arch} == "powerpc" && ($arch == "x86_64" || $arch == "i386")) -+ || (${os.arch} == "i386" && ($arch == "ppc" || $arch == "ppc64"))} { -+ set merger_configure_args($arch) "--enable-cross-compile --target-os=${os.platform}" -+ } -+ } - foreach arch ${configure.universal_archs} { - set merger_host($arch) "" - lappend merger_configure_args($arch) --arch=${arch} -@@ -330,12 +369,53 @@ - --disable-libxcb-xfixes + # Copy docs + file mkdir ${destroot}${port_docdir} +@@ -386,12 +425,53 @@ + --disable-libxcb-xfixes } - + +variant natronmini requires highbitdepth aom conflicts x11 description {Minimal FFmpeg for Natron, without bluray, subtitles, network, display support.} { + + depends_lib-delete \ @@ -143,15 +143,15 @@ } else { require_active_variants libsdl2 "" x11 } - + + variant libdc1394 description {Enable IIDC-1394 frame grabbing using libdc1394 (experimental)} { - depends_lib-append port:libdc1394 - configure.args-append --enable-libdc1394 -@@ -365,6 +445,20 @@ - depends_lib-delete path:lib/pkgconfig/gnutls.pc:gnutls + depends_lib-append \ + port:libdc1394 +@@ -432,6 +512,20 @@ + path:lib/pkgconfig/gnutls.pc:gnutls } - + +variant aom description {Enable Alliance for Open Media AV1 Codec} { + depends_lib-append port:aom + configure.args-delete --disable-libaom @@ -167,12 +167,12 @@ +} + variant gpl2 description {Enable GPL code, license will be GPL-2+} { - configure.args-append --enable-gpl \ - --enable-postproc \ -@@ -386,6 +480,12 @@ - depends_lib-append path:lib/pkgconfig/smbclient.pc:samba3 \ - port:libaribb24 - license GPL-3+ + license GPL-2+ + +@@ -459,6 +553,12 @@ + depends_lib-append \ + port:libaribb24 \ + path:lib/pkgconfig/smbclient.pc:samba3 + + # samba3 cannot be built universal (http://trac.macports.org/ticket/34558) + if {[variant_isset universal]} { @@ -180,5 +180,5 @@ + configure.args-delete --enable-libsmbclient + } } - + # the build server uses the default variants, and we want distributable binaries diff --git a/tools/MacPorts/multimedia/libvpx/Portfile b/tools/MacPorts/multimedia/libvpx/Portfile index abecb959f2..1b6f8da30a 100644 --- a/tools/MacPorts/multimedia/libvpx/Portfile +++ b/tools/MacPorts/multimedia/libvpx/Portfile @@ -8,7 +8,7 @@ name libvpx conflicts libvpx-devel set my_name libvpx version 1.13.0 -revision 0 +revision 1 categories multimedia license Permissive @@ -23,7 +23,6 @@ long_description The WebM VP8/VP9 codecs are being developed \ codec and includes a number of enhancements and new \ coding tools that have been added to improve coding efficiency. \ The VP9 encoder in this release is not, as yet, feature complete. - homepage http://webmproject.org/tools/ distname ${my_name}-${version} @@ -46,27 +45,29 @@ patchfiles-append patch-configure.sh.diff # requires c++11 https://trac.macports.org/ticket/67038 compiler.cxx_standard 2011 # requires MacPorts c++11 flags explicitly added to ldflags https://trac.macports.org/ticket/67038 -configure.ldflags-append {*}${configure.cxxflags} +configure.ldflags-append \ + {*}${configure.cxxflags} # Uses newer assembly features on Intel. # Also blacklist clang 8, due to issues like: # error: use of undeclared identifier 'abs' -compiler.blacklist-append {*gcc-[3-4].*} {clang < 900} {macports-clang-3.*} +compiler.blacklist-append \ + {*gcc-[3-4].*} {clang < 900} {macports-clang-3.*} # As of 1.7.0: builds both static and shared libraries # doesn't install docs or examples correctly, so disable them. -configure.args --enable-vp8 \ - --enable-vp9 \ - --enable-vp9-highbitdepth \ - --enable-internal-stats \ +configure.args-append \ + --disable-debug-libs \ + --disable-install-docs \ + --enable-examples \ + --enable-experimental \ + --enable-multithread \ --enable-pic \ --enable-postproc \ - --enable-multithread \ - --enable-experimental \ - --enable-examples \ - --disable-install-docs \ - --disable-debug-libs \ - --enable-unit-tests + --enable-unit-tests \ + --enable-vp8 \ + --enable-vp9 \ + --enable-vp9-highbitdepth platform darwin { if {${build_arch} eq "ppc" || ${build_arch} eq "ppc64"} { diff --git a/tools/MacPorts/multimedia/libvpx/Portfile.orig b/tools/MacPorts/multimedia/libvpx/Portfile.orig index c792e018c2..089f19b3cd 100644 --- a/tools/MacPorts/multimedia/libvpx/Portfile.orig +++ b/tools/MacPorts/multimedia/libvpx/Portfile.orig @@ -8,7 +8,7 @@ name libvpx conflicts libvpx-devel set my_name libvpx version 1.13.0 -revision 0 +revision 1 categories multimedia license Permissive @@ -23,7 +23,6 @@ long_description The WebM VP8/VP9 codecs are being developed \ codec and includes a number of enhancements and new \ coding tools that have been added to improve coding efficiency. \ The VP9 encoder in this release is not, as yet, feature complete. - homepage http://webmproject.org/tools/ distname ${my_name}-${version} @@ -46,27 +45,29 @@ patchfiles-append patch-configure.sh.diff # requires c++11 https://trac.macports.org/ticket/67038 compiler.cxx_standard 2011 # requires MacPorts c++11 flags explicitly added to ldflags https://trac.macports.org/ticket/67038 -configure.ldflags-append {*}${configure.cxxflags} +configure.ldflags-append \ + {*}${configure.cxxflags} # Uses newer assembly features on Intel. # Also blacklist clang 8, due to issues like: # error: use of undeclared identifier 'abs' -compiler.blacklist-append {*gcc-[3-4].*} {clang < 900} {macports-clang-3.*} +compiler.blacklist-append \ + {*gcc-[3-4].*} {clang < 900} {macports-clang-3.*} # As of 1.7.0: builds both static and shared libraries # doesn't install docs or examples correctly, so disable them. -configure.args --enable-vp8 \ - --enable-vp9 \ - --enable-vp9-highbitdepth \ - --enable-internal-stats \ +configure.args-append \ + --disable-debug-libs \ + --disable-install-docs \ + --enable-examples \ + --enable-experimental \ + --enable-multithread \ --enable-pic \ --enable-postproc \ - --enable-multithread \ - --enable-experimental \ - --enable-examples \ - --disable-install-docs \ - --disable-debug-libs \ - --enable-unit-tests + --enable-unit-tests \ + --enable-vp8 \ + --enable-vp9 \ + --enable-vp9-highbitdepth platform darwin { if {${build_arch} eq "ppc" || ${build_arch} eq "ppc64"} { diff --git a/tools/MacPorts/net/curl/Portfile b/tools/MacPorts/net/curl/Portfile index 7bbf007716..126b707d8c 100644 --- a/tools/MacPorts/net/curl/Portfile +++ b/tools/MacPorts/net/curl/Portfile @@ -6,10 +6,10 @@ PortGroup clang_dependency 1.0 # Increase the revision of p5-www-curl whenever the version of curl gets updated. name curl -version 8.1.0 -checksums rmd160 0f0da89b92975c54bb4db0e895dd541ca391b582 \ - sha256 6bd80ad4f07187015911216ee7185b90d285ac5162aed1bded144f9f93232a3c \ - size 2612568 +version 8.2.1 +checksums rmd160 b8486b2903708f892bdff05a4f9a593c776a3ec6 \ + sha256 dd322f6bd0a20e6cebdfd388f69e98c3d183bed792cf4713c8a7ef498cba4894 \ + size 2631932 categories net www platforms darwin freebsd @@ -45,9 +45,8 @@ if {${name} eq ${subport}} { port:zlib \ port:zstd - # Prevent curl-config from telling curl's dependents that they have to - # link with all of curl's dependencies as well. patchfiles configure.patch + patchfiles-append SCDynamicStoreCopyProxies.patch configure.args --disable-silent-rules \ --enable-ipv6 \ @@ -213,6 +212,13 @@ if {${name} eq ${subport}} { default_variants-append +http2 } + variant http3 requires gnutls description {Support HTTP/3 with nghttp3 and ngtcp2} { + depends_lib-append port:nghttp3 \ + port:ngtcp2 + configure.args-append --with-nghttp3=${prefix} \ + --with-ngtcp2=${prefix} + } + variant openldap description {Support performing Lightweight Directory Access Protocol queries with OpenLDAP} { depends_lib-append path:lib/libldap.dylib:openldap configure.args-replace --disable-ldap --enable-ldap @@ -276,11 +282,11 @@ subport curl-ca-bundle { # The approximate time (in seconds since the epoch) when the port maintainer # updated the certdata.txt file in this port. (The output of "date +%s".) - set certdata_updated 1676938725 + set certdata_updated 1690233032 # The upstream commit in which certdata.txt was last updated. - set certdata_commit fc546cbeb1cc7a486bc5147bcff3a879374cf213 + set certdata_commit 60b731ed0b92d1f2f7d80dfc54f71fcfecb8ff49 # The date (in YYYYMMDD format) that commit was pushed. - set certdata_date 20221204 + set certdata_date 20230721 set certdata_file certdata.txt # Using tar.bz2 would be preferable because it's smaller but upstream has # disabled the creation of all but zip archives: @@ -301,9 +307,9 @@ subport curl-ca-bundle { distfiles-append ${certdata_distfile}:certdata checksums-append ${certdata_distfile} \ - rmd160 70914b37764956f1ccd907871b4f58d0ee126b23 \ - sha256 56b3095fb443163031bb4941e4e13dd1c703e96172218eb2a0dadb6d22dfe75b \ - size 271958 + rmd160 1102ce76dd1bf44a153cc6cae3a790dcae9e9fda \ + sha256 c4c7820155d24950586d71cdf9a1bdf9ec868116aee5c87c0389d082d0173572 \ + size 286425 extract.only ${curl_distfile} extract.post_args-append ${worksrcdir}/Makefile \ diff --git a/tools/MacPorts/net/curl/Portfile.orig b/tools/MacPorts/net/curl/Portfile.orig index 97b2903aa4..76ee022c9e 100644 --- a/tools/MacPorts/net/curl/Portfile.orig +++ b/tools/MacPorts/net/curl/Portfile.orig @@ -6,10 +6,10 @@ PortGroup clang_dependency 1.0 # Increase the revision of p5-www-curl whenever the version of curl gets updated. name curl -version 8.1.0 -checksums rmd160 0f0da89b92975c54bb4db0e895dd541ca391b582 \ - sha256 6bd80ad4f07187015911216ee7185b90d285ac5162aed1bded144f9f93232a3c \ - size 2612568 +version 8.2.1 +checksums rmd160 b8486b2903708f892bdff05a4f9a593c776a3ec6 \ + sha256 dd322f6bd0a20e6cebdfd388f69e98c3d183bed792cf4713c8a7ef498cba4894 \ + size 2631932 categories net www platforms darwin freebsd @@ -45,9 +45,8 @@ if {${name} eq ${subport}} { port:zlib \ port:zstd - # Prevent curl-config from telling curl's dependents that they have to - # link with all of curl's dependencies as well. patchfiles configure.patch + patchfiles-append SCDynamicStoreCopyProxies.patch configure.args --disable-silent-rules \ --enable-ipv6 \ @@ -209,6 +208,13 @@ if {${name} eq ${subport}} { default_variants-append +http2 } + variant http3 requires gnutls description {Support HTTP/3 with nghttp3 and ngtcp2} { + depends_lib-append port:nghttp3 \ + port:ngtcp2 + configure.args-append --with-nghttp3=${prefix} \ + --with-ngtcp2=${prefix} + } + variant openldap description {Support performing Lightweight Directory Access Protocol queries with OpenLDAP} { depends_lib-append path:lib/libldap.dylib:openldap configure.args-replace --disable-ldap --enable-ldap @@ -272,11 +278,11 @@ subport curl-ca-bundle { # The approximate time (in seconds since the epoch) when the port maintainer # updated the certdata.txt file in this port. (The output of "date +%s".) - set certdata_updated 1676938725 + set certdata_updated 1690233032 # The upstream commit in which certdata.txt was last updated. - set certdata_commit fc546cbeb1cc7a486bc5147bcff3a879374cf213 + set certdata_commit 60b731ed0b92d1f2f7d80dfc54f71fcfecb8ff49 # The date (in YYYYMMDD format) that commit was pushed. - set certdata_date 20221204 + set certdata_date 20230721 set certdata_file certdata.txt # Using tar.bz2 would be preferable because it's smaller but upstream has # disabled the creation of all but zip archives: @@ -297,9 +303,9 @@ subport curl-ca-bundle { distfiles-append ${certdata_distfile}:certdata checksums-append ${certdata_distfile} \ - rmd160 70914b37764956f1ccd907871b4f58d0ee126b23 \ - sha256 56b3095fb443163031bb4941e4e13dd1c703e96172218eb2a0dadb6d22dfe75b \ - size 271958 + rmd160 1102ce76dd1bf44a153cc6cae3a790dcae9e9fda \ + sha256 c4c7820155d24950586d71cdf9a1bdf9ec868116aee5c87c0389d082d0173572 \ + size 286425 extract.only ${curl_distfile} extract.post_args-append ${worksrcdir}/Makefile \ diff --git a/tools/MacPorts/net/curl/files/SCDynamicStoreCopyProxies.patch b/tools/MacPorts/net/curl/files/SCDynamicStoreCopyProxies.patch new file mode 100644 index 0000000000..f01af6320a --- /dev/null +++ b/tools/MacPorts/net/curl/files/SCDynamicStoreCopyProxies.patch @@ -0,0 +1,79 @@ +Temporary fix for: + +dyld: lazy symbol binding failed: Symbol not found: _SCDynamicStoreCopyProxies + Referenced from: /opt/local/lib/libcurl.4.dylib + Expected in: flat namespace + +due to failure to properly identify macOS when using the macOS 10.11 SDK or +earlier. This patch is only tested on macOS and iOS. The upstream fix, which +needs to accommodate iOS, tvOS, watchOS, and every other OS may be different. + +https://github.com/curl/curl/issues/11502 +https://github.com/curl/curl/pull/11516 +--- configure.orig 2023-07-23 16:00:43.000000000 -0500 ++++ configure 2023-07-27 00:57:35.000000000 -0500 +@@ -21707,7 +21707,7 @@ + int main (void) + { + +-#if (TARGET_OS_OSX) ++#if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) + return 0; + #else + #error Not a macOS +--- lib/curl_setup.h.orig 2023-07-23 10:14:56.000000000 -0500 ++++ lib/curl_setup.h 2023-07-27 00:53:49.000000000 -0500 +@@ -258,8 +258,9 @@ + #if defined(__APPLE__) && !defined(USE_ARES) + #include + #define USE_RESOLVE_ON_IPS 1 +-# if !defined(TARGET_OS_OSX) || TARGET_OS_OSX +-# define CURL_OSX_CALL_COPYPROXIES 1 ++# if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && \ ++ defined(ENABLE_IPV6) ++# define CURL_MACOS_CALL_COPYPROXIES 1 + # endif + #endif + +--- lib/macos.c.orig 2023-07-18 04:46:48.000000000 -0500 ++++ lib/macos.c 2023-07-27 00:55:43.000000000 -0500 +@@ -26,19 +26,16 @@ + + #if defined(__APPLE__) + +-#if !defined(TARGET_OS_OSX) || TARGET_OS_OSX ++#ifdef CURL_MACOS_CALL_COPYPROXIES + + #include + + #include "macos.h" + +-#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES) + #include +-#endif + + CURLcode Curl_macos_init(void) + { +-#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES) + { + /* + * The automagic conversion from IPv4 literals to IPv6 literals only +@@ -53,7 +50,6 @@ + if(dict) + CFRelease(dict); + } +-#endif + return CURLE_OK; + } + +--- lib/macos.h.orig 2023-07-18 04:46:48.000000000 -0500 ++++ lib/macos.h 2023-07-27 00:56:07.000000000 -0500 +@@ -25,7 +25,7 @@ + ***************************************************************************/ + #include "curl_setup.h" + +-#if defined(__APPLE__) && (!defined(TARGET_OS_OSX) || TARGET_OS_OSX) ++#ifdef CURL_MACOS_CALL_COPYPROXIES + + CURLcode Curl_macos_init(void); + diff --git a/tools/MacPorts/net/curl/files/configure.patch b/tools/MacPorts/net/curl/files/configure.patch index e9ebc239c7..03887d25a2 100644 --- a/tools/MacPorts/net/curl/files/configure.patch +++ b/tools/MacPorts/net/curl/files/configure.patch @@ -1,6 +1,8 @@ ---- configure.orig 2022-12-21 01:04:49.000000000 -0600 -+++ configure 2023-01-11 21:59:27.000000000 -0600 -@@ -14069,7 +14069,7 @@ +Prevent curl-config from telling curl's dependents that they have to link with +all of curl's dependencies as well. +--- configure.orig 2023-07-23 16:00:43.000000000 -0500 ++++ configure 2023-07-27 00:52:12.000000000 -0500 +@@ -14497,7 +14497,7 @@ else whole_archive_flag_spec='' fi diff --git a/tools/MacPorts/net/curl/files/patch-lib-vquic-curl_ngtcp2.c.diff b/tools/MacPorts/net/curl/files/patch-lib-vquic-curl_ngtcp2.c.diff new file mode 100644 index 0000000000..d7dbc4b49b --- /dev/null +++ b/tools/MacPorts/net/curl/files/patch-lib-vquic-curl_ngtcp2.c.diff @@ -0,0 +1,67 @@ +diff --git livquic/curl_ngtcp2.c livquic/curl_ngtcp2.c +index 7627940ff516b..4f097e3b18b24 100644 +--- lib/vquic/curl_ngtcp2.c ++++ lib/vquic/curl_ngtcp2.c +@@ -327,7 +327,7 @@ static void quic_settings(struct cf_ngtcp2_ctx *ctx, + t->initial_max_streams_uni = QUIC_MAX_STREAMS; + t->max_idle_timeout = QUIC_IDLE_TIMEOUT; + if(ctx->qlogfd != -1) { +- s->qlog.write = qlog_callback; ++ s->qlog_write = qlog_callback; + } + } + +@@ -902,13 +902,13 @@ static int cb_get_new_connection_id(ngtcp2_conn *tconn, ngtcp2_cid *cid, + return 0; + } + +-static int cb_recv_rx_key(ngtcp2_conn *tconn, ngtcp2_crypto_level level, ++static int cb_recv_rx_key(ngtcp2_conn *tconn, ngtcp2_encryption_level level, + void *user_data) + { + struct Curl_cfilter *cf = user_data; + (void)tconn; + +- if(level != NGTCP2_CRYPTO_LEVEL_APPLICATION) { ++ if(level != NGTCP2_ENCRYPTION_LEVEL_1RTT) { + return 0; + } + +@@ -1207,7 +1207,8 @@ static int cb_h3_stop_sending(nghttp3_conn *conn, int64_t stream_id, + (void)conn; + (void)stream_user_data; + +- rv = ngtcp2_conn_shutdown_stream_read(ctx->qconn, stream_id, app_error_code); ++ rv = ngtcp2_conn_shutdown_stream_read(ctx->qconn, 0, stream_id, ++ app_error_code); + if(rv && rv != NGTCP2_ERR_STREAM_NOT_FOUND) { + return NGTCP2_ERR_CALLBACK_FAILURE; + } +@@ -1225,7 +1226,7 @@ static int cb_h3_reset_stream(nghttp3_conn *conn, int64_t stream_id, + (void)conn; + (void)data; + +- rv = ngtcp2_conn_shutdown_stream_write(ctx->qconn, stream_id, ++ rv = ngtcp2_conn_shutdown_stream_write(ctx->qconn, 0, stream_id, + app_error_code); + DEBUGF(LOG_CF(data, cf, "[h3sid=%" PRId64 "] reset -> %d", stream_id, rv)); + if(rv && rv != NGTCP2_ERR_STREAM_NOT_FOUND) { +@@ -1249,7 +1250,8 @@ static nghttp3_callbacks ngh3_callbacks = { + cb_h3_stop_sending, + NULL, /* end_stream */ + cb_h3_reset_stream, +- NULL /* shutdown */ ++ NULL, /* shutdown */ ++ NULL /* recv_settings */ + }; + + static int init_ngh3_conn(struct Curl_cfilter *cf) +@@ -2402,7 +2404,7 @@ static CURLcode cf_ngtcp2_connect(struct Curl_cfilter *cf, + + out: + if(result == CURLE_RECV_ERROR && ctx->qconn && +- ngtcp2_conn_is_in_draining_period(ctx->qconn)) { ++ ngtcp2_conn_in_draining_period(ctx->qconn)) { + /* When a QUIC server instance is shutting down, it may send us a + * CONNECTION_CLOSE right away. Our connection then enters the DRAINING + * state. diff --git a/tools/MacPorts/print/ghostscript/Portfile b/tools/MacPorts/print/ghostscript/Portfile index 090d41fee6..7f8f64cfae 100644 --- a/tools/MacPorts/print/ghostscript/Portfile +++ b/tools/MacPorts/print/ghostscript/Portfile @@ -4,7 +4,7 @@ PortSystem 1.0 PortGroup muniversal 1.0 name ghostscript -version 9.56.1 +version 10.01.2 revision 1 categories print license AGPL-3 BSD @@ -24,7 +24,7 @@ master_sites https://github.com/ArtifexSoftware/ghostpdl-downloads/releas # Note: this needs to be manually updated for new upstream commits set mappingresources_commit \ - a709991e67196a87af053e2c16d7a65108613a41 + 2dd5e53fb74a01718b9dfd448a0d1cce6fff2aa5 distname ghostpdl-${version} distfiles ${distname}.tar.gz:source \ @@ -33,12 +33,14 @@ distfiles ${distname}.tar.gz:source \ ${mappingresources_commit}.zip:misc patchfiles patch-base_unix-dll.mak.diff \ - patch-base_unixinst.mak.diff + patch-base_unixinst.mak.diff \ + patch-base_gspaint.diff \ + patch-psi_imainarg.c.diff checksums ${distname}.tar.gz \ - rmd160 babe8112b085191511fb9aec32f9162926c582d8 \ - sha256 6bf362286e359e31f934e5aad49db3d88a2382a3cac44b40572861ee5c536664 \ - size 92134638 \ + rmd160 1a21460fb6ec98858a723cd6570a1b98e9f2124a \ + sha256 ee76cb526f5b6683e2adcb65398a1f333f7972289cec960b67aaa227c0d72e88 \ + size 96848797 \ ghostscript-fonts-other-6.0.tar.gz \ rmd160 ab60dbf71e7d91283a106c3df381cadfe173082f \ sha256 4fa051e341167008d37fe34c19d241060cd17b13909932cd7ca7fe759243c2de \ @@ -48,9 +50,9 @@ checksums ${distname}.tar.gz \ sha256 0eb6f356119f2e49b2563210852e17f57f9dcc5755f350a69a46a0d641a0c401 \ size 3752871 \ ${mappingresources_commit}.zip \ - rmd160 6f327e09590d517760dafd99cc7a197e68d85c6e \ - sha256 03bb11a4db4b01f8509e93db469a24f904934fece3b5b9b8be932267ed7173f4 \ - size 1600471 + rmd160 a65458ab9955421cf3085cf84a6eac299e8c93cb \ + sha256 e3971985977cee4b75f6b49f6e43842d3b699c4255d010adb82796073e98fbfe \ + size 1601563 depends_lib port:fontconfig \ port:freetype \ diff --git a/tools/MacPorts/print/ghostscript/Portfile.orig b/tools/MacPorts/print/ghostscript/Portfile.orig index 56fa720bc0..958d860d9c 100644 --- a/tools/MacPorts/print/ghostscript/Portfile.orig +++ b/tools/MacPorts/print/ghostscript/Portfile.orig @@ -4,7 +4,7 @@ PortSystem 1.0 PortGroup muniversal 1.0 name ghostscript -version 9.56.1 +version 10.01.2 revision 1 categories print license AGPL-3 BSD @@ -24,7 +24,7 @@ master_sites https://github.com/ArtifexSoftware/ghostpdl-downloads/releas # Note: this needs to be manually updated for new upstream commits set mappingresources_commit \ - a709991e67196a87af053e2c16d7a65108613a41 + 2dd5e53fb74a01718b9dfd448a0d1cce6fff2aa5 distname ghostpdl-${version} distfiles ${distname}.tar.gz:source \ @@ -33,12 +33,14 @@ distfiles ${distname}.tar.gz:source \ ${mappingresources_commit}.zip:misc patchfiles patch-base_unix-dll.mak.diff \ - patch-base_unixinst.mak.diff + patch-base_unixinst.mak.diff \ + patch-base_gspaint.diff \ + patch-psi_imainarg.c.diff checksums ${distname}.tar.gz \ - rmd160 babe8112b085191511fb9aec32f9162926c582d8 \ - sha256 6bf362286e359e31f934e5aad49db3d88a2382a3cac44b40572861ee5c536664 \ - size 92134638 \ + rmd160 1a21460fb6ec98858a723cd6570a1b98e9f2124a \ + sha256 ee76cb526f5b6683e2adcb65398a1f333f7972289cec960b67aaa227c0d72e88 \ + size 96848797 \ ghostscript-fonts-other-6.0.tar.gz \ rmd160 ab60dbf71e7d91283a106c3df381cadfe173082f \ sha256 4fa051e341167008d37fe34c19d241060cd17b13909932cd7ca7fe759243c2de \ @@ -48,9 +50,9 @@ checksums ${distname}.tar.gz \ sha256 0eb6f356119f2e49b2563210852e17f57f9dcc5755f350a69a46a0d641a0c401 \ size 3752871 \ ${mappingresources_commit}.zip \ - rmd160 6f327e09590d517760dafd99cc7a197e68d85c6e \ - sha256 03bb11a4db4b01f8509e93db469a24f904934fece3b5b9b8be932267ed7173f4 \ - size 1600471 + rmd160 a65458ab9955421cf3085cf84a6eac299e8c93cb \ + sha256 e3971985977cee4b75f6b49f6e43842d3b699c4255d010adb82796073e98fbfe \ + size 1601563 depends_lib port:fontconfig \ port:freetype \ diff --git a/tools/MacPorts/print/ghostscript/files/patch-base_gspaint.diff b/tools/MacPorts/print/ghostscript/files/patch-base_gspaint.diff new file mode 100644 index 0000000000..91d384a4b7 --- /dev/null +++ b/tools/MacPorts/print/ghostscript/files/patch-base_gspaint.diff @@ -0,0 +1,42 @@ +--- base/gspaint.c.orig 2023-03-27 15:49:35.000000000 +0900 ++++ base/gspaint.c 2023-04-27 19:13:03.000000000 +0900 +@@ -208,6 +208,7 @@ + gs_fixed_rect bbox; + gs_int_rect ibox; + uint width, raster, band_space; ++ uint dev_width, dev_height; + uint height, height2; + gs_log2_scale_point log2_scale; + gs_memory_t *mem; +@@ -223,6 +224,7 @@ + if ((ibox.q.y <= ibox.p.y) || (ibox.q.x <= ibox.p.x)) + return 2; + width = (ibox.q.x - ibox.p.x) << log2_scale.x; ++ dev_width = ibox.q.x << log2_scale.x; + raster = bitmap_raster(width); + band_space = raster << log2_scale.y; + height2 = (ibox.q.y - ibox.p.y); +@@ -232,6 +234,7 @@ + if (height > height2) + height = height2; + height <<= log2_scale.y; ++ dev_height = ibox.q.y << log2_scale.y; + mem = pgs->memory; + mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory, + "alpha_buffer_init"); +@@ -244,13 +247,9 @@ + } + gs_make_mem_abuf_device(mdev, mem, dev, &log2_scale, + alpha_bits, ibox.p.x << log2_scale.x, devn); +- mdev->width = width; +- mdev->height = height; ++ mdev->width = dev_width; ++ mdev->height = dev_height; + mdev->bitmap_memory = mem; +- /* Set the horrible hacky flag that tells people that the width/height here +- * have been set for *our* convenience, rather than accurately depicting the +- * size of the device for callers. */ +- mdev->non_strict_bounds = 1; + if ((*dev_proc(mdev, open_device)) ((gx_device *) mdev) < 0) { + /* No room for bits, punt. */ + gs_free_object(mem, mdev, "alpha_buffer_init"); diff --git a/tools/MacPorts/print/ghostscript/files/patch-psi_imainarg.c.diff b/tools/MacPorts/print/ghostscript/files/patch-psi_imainarg.c.diff new file mode 100644 index 0000000000..061f509107 --- /dev/null +++ b/tools/MacPorts/print/ghostscript/files/patch-psi_imainarg.c.diff @@ -0,0 +1,11 @@ +--- psi/imainarg.c.orig 2023-06-21 14:10:21 ++++ psi/imainarg.c 2023-07-24 12:51:29 +@@ -1455,7 +1455,7 @@ + print_help_trailer(const gs_main_instance *minst) + { + char buffer[gp_file_name_sizeof]; +- const char *use_htm = "Use.htm", *p = buffer; ++ const char *use_htm = "Ghostscript.pdf", *p = buffer; + uint blen = sizeof(buffer); + + if (gp_file_name_combine(gs_doc_directory, strlen(gs_doc_directory), diff --git a/tools/MacPorts/python/py-pyside2/Portfile b/tools/MacPorts/python/py-pyside2/Portfile index 2a81424ac9..6eb342a70b 100644 --- a/tools/MacPorts/python/py-pyside2/Portfile +++ b/tools/MacPorts/python/py-pyside2/Portfile @@ -4,7 +4,7 @@ PortSystem 1.0 PortGroup python 1.0 name py-pyside2 -version 5.15.8 +version 5.15.10 revision 0 categories-append devel aqua platforms darwin @@ -18,27 +18,23 @@ master_sites https://download.qt.io/official_releases/QtForPython/pys distname pyside-setup-opensource-src-${version} use_xz yes -checksums rmd160 49384ee04a5755d42dfaa89b7b11bbdbf58d012e \ - sha256 23436302c8deb5b4cbc769b205d09604e38ba83b40708efccb7bd8c9af6f6b5d \ - size 3582256 +checksums rmd160 492396a82a4140e86a81e4235cafa6a781766714 \ + sha256 2af691d3613a41f83a60439b46568fc2c696dbfae42f7cd7b07152d115ead33a \ + size 3583764 python.versions 37 38 39 310 -set llvm_version 15 +set llvm_version 16 if {${name} ne ${subport}} { PortGroup qt5 1.0 - # fix error related to _Py_Mangle, which was half-patched in this version - # see: https://bugzilla.redhat.com/show_bug.cgi?id=1990768#c9 - patchfiles-append patch-py-mangle.diff - # fix error with shiboken2 doc building patchfiles-append patch-shiboken2-docs.diff - # see https://trac.macports.org/ticket/62135#comment:4 - qt5.min_version 5.12 + # see https://trac.macports.org/ticket/68072 + qt5.min_version 5.14 # Needed for generating shiboken2 documentation qt5.depends_build_component sqlite-plugin diff --git a/tools/MacPorts/python/py-pyside2/Portfile.orig b/tools/MacPorts/python/py-pyside2/Portfile.orig index ac065a429d..0f21fa2d37 100644 --- a/tools/MacPorts/python/py-pyside2/Portfile.orig +++ b/tools/MacPorts/python/py-pyside2/Portfile.orig @@ -4,7 +4,7 @@ PortSystem 1.0 PortGroup python 1.0 name py-pyside2 -version 5.15.8 +version 5.15.10 revision 0 categories-append devel aqua platforms darwin @@ -18,27 +18,23 @@ master_sites https://download.qt.io/official_releases/QtForPython/pys distname pyside-setup-opensource-src-${version} use_xz yes -checksums rmd160 49384ee04a5755d42dfaa89b7b11bbdbf58d012e \ - sha256 23436302c8deb5b4cbc769b205d09604e38ba83b40708efccb7bd8c9af6f6b5d \ - size 3582256 +checksums rmd160 492396a82a4140e86a81e4235cafa6a781766714 \ + sha256 2af691d3613a41f83a60439b46568fc2c696dbfae42f7cd7b07152d115ead33a \ + size 3583764 python.versions 37 38 39 310 -set llvm_version 15 +set llvm_version 16 if {${name} ne ${subport}} { PortGroup qt5 1.0 - # fix error related to _Py_Mangle, which was half-patched in this version - # see: https://bugzilla.redhat.com/show_bug.cgi?id=1990768#c9 - patchfiles-append patch-py-mangle.diff - # fix error with shiboken2 doc building patchfiles-append patch-shiboken2-docs.diff - # see https://trac.macports.org/ticket/62135#comment:4 - qt5.min_version 5.12 + # see https://trac.macports.org/ticket/68072 + qt5.min_version 5.14 # Needed for generating shiboken2 documentation qt5.depends_build_component sqlite-plugin diff --git a/tools/jenkins/build-natron.sh b/tools/jenkins/build-natron.sh index 2b6ce4d844..25c398d12c 100755 --- a/tools/jenkins/build-natron.sh +++ b/tools/jenkins/build-natron.sh @@ -66,13 +66,13 @@ cd "$TMP_PATH" # OpenColorIO-Configs setup -OCIO_CONFIGS_VERSION="" +OCIO_CONFIGS_VERSION=${OCIO_CONFIGS_VERSION:-} if [ "$NATRON_BUILD_CONFIG" = "ALPHA" ] || [ "$NATRON_BUILD_CONFIG" = "BETA" ] || [ "$NATRON_BUILD_CONFIG" = "RC" ] || [ "$NATRON_BUILD_CONFIG" = "STABLE" ]; then OCIO_CONFIGS_VERSION=$(echo $NATRON_GIT_BRANCH | sed 's#tags/v##;' | cut -c1-3) -else +elif [ "$OCIO_CONFIGS_VERSION" = "" ]; then case "$NATRON_GIT_BRANCH" in - RB-*) - OCIO_CONFIGS_VERSION=$(echo $NATRON_GIT_BRANCH | sed 's#RB-##;') + *RB-*) + OCIO_CONFIGS_VERSION=$(echo $NATRON_GIT_BRANCH | sed 's#.*RB-##;') ;; esac fi @@ -342,9 +342,37 @@ if [ "$PKGOS" = "OSX" ]; then MAC_CRASH_PATH=/NatronCrashReporter.app/Contents/MacOS fi +CP_OR_MV=cp +if [ "${MINIMIZE_DISK_USAGE:-}" = "1" ]; then + echo "Cleaning up files to minimize disk usage..." + + # Free up some disk space before copying. + DIRS_TO_CLEAN="Engine Gui Tests libs/openMVG libs/ceres libs/libmv" + + for dir in ${DIRS_TO_CLEAN}; do + if [ "$PKGOS" = "Windows" ]; then + rm -vf ${dir}/${WIN_BIN_TYPE}/{*.o,*.a} + else + rm -vf ${dir}/{*.o,*.a} + fi + + if [ -d ${dir}/pch ]; then + rm -rv ${dir}/pch + fi + done + + # Move large files instead of copying them to minimize disk usage. + CP_OR_MV=mv +fi + cp Tests/$NATRON_TEST "$TMP_BINARIES_PATH/bin/" -cp App${MAC_APP_PATH:-}/$NATRON_BIN "$TMP_BINARIES_PATH/bin/" +TEST_BINARY_TO_RUN="$TMP_BINARIES_PATH/bin/Tests" +if [ "$PKGOS" = "Windows" ]; then + TEST_BINARY_TO_RUN="${TEST_BINARY_TO_RUN}.exe" +fi + +${CP_OR_MV} App${MAC_APP_PATH:-}/$NATRON_BIN "$TMP_BINARIES_PATH/bin/" # copy Info.plist and PkgInfo if [ "$PKGOS" = "OSX" ]; then @@ -355,14 +383,14 @@ if [ "$PKGOS" = "OSX" ]; then cp "App${MAC_PKGINFO}" "$TMP_BINARIES_PATH/bin/" fi -cp Renderer/$RENDERER_BIN "$TMP_BINARIES_PATH/bin/" +${CP_OR_MV} Renderer/$RENDERER_BIN "$TMP_BINARIES_PATH/bin/" if [ -f ProjectConverter/$NATRON_CONVERTER ]; then cp ProjectConverter/$NATRON_CONVERTER "${TMP_BINARIES_PATH}/bin/" fi if [ -f PythonBin/$NATRON_PYTHON_BIN ]; then - cp PythonBin/$NATRON_PYTHON_BIN "${TMP_BINARIES_PATH}/bin/" + ${CP_OR_MV} PythonBin/$NATRON_PYTHON_BIN "${TMP_BINARIES_PATH}/bin/" fi mkdir -p "$TMP_BINARIES_PATH/docs/natron" || true @@ -370,8 +398,8 @@ cp "$srcdir"/LICENSE.txt "$TMP_BINARIES_PATH/docs/natron/" # install crashapp(s) if [ "${DISABLE_BREAKPAD:-}" != "1" ]; then - cp CrashReporter${MAC_CRASH_PATH:-}/$CRASHGUI "$TMP_BINARIES_PATH/bin/" - cp CrashReporterCLI/$CRASHCLI "$TMP_BINARIES_PATH/bin/" + ${CP_OR_MV} CrashReporter${MAC_CRASH_PATH:-}/$CRASHGUI "$TMP_BINARIES_PATH/bin/" + ${CP_OR_MV} CrashReporterCLI/$CRASHCLI "$TMP_BINARIES_PATH/bin/" fi RES_DIR="$TMP_BINARIES_PATH/Resources" @@ -449,7 +477,7 @@ if [ "$PKGOS" = "Linux" ]; then # Note: Several suppression files can be passed to valgrind. # There is an automatic tool to generate libc/libstdc++/Qt # suppressions at https://github.com/AlekSi/valgrind-suppressions - env LD_LIBRARY_PATH="$SDK_HOME/gcc/lib:$SDK_HOME/gcc/lib64:$SDK_HOME/lib:$FFMPEG_PATH/lib:$LIBRAW_PATH/lib:$QTDIR/lib" $TIMEOUT -s KILL 1800 valgrind --tool=memcheck --suppressions="$INC_PATH/natron/valgrind-python${PYV}.supp" Tests/Tests + env LD_LIBRARY_PATH="$SDK_HOME/gcc/lib:$SDK_HOME/gcc/lib64:$SDK_HOME/lib:$FFMPEG_PATH/lib:$LIBRAW_PATH/lib:$QTDIR/lib" $TIMEOUT -s KILL 1800 valgrind --tool=memcheck --suppressions="$INC_PATH/natron/valgrind-python${PYV}.supp" ${TEST_BINARY_TO_RUN} rm -f lib || true # ITS NOT POSSIBLE TO RUN THE WIN TESTS HERE, DO IT IN THE INSTALLER SCRIPT elif [ "$PKGOS" = "Windows" ]; then @@ -467,7 +495,7 @@ elif [ "$PKGOS" = "Windows" ]; then #rm -rf /c/Users/NatronWin/AppData/Local/INRIA/Natron &> /dev/null || true rm -rf "$LOCALAPPDATA\\INRIA\\Natron"* &> /dev/null || true testfail=0 - env PYTHONHOME="$SDK_HOME" PATH="$FFMPEG_PATH/bin:$LIBRAW_PATH/bin:$QTDIR/bin:$SDK_HOME/osmesa/lib:$SDK_HOME/bin:${PATH:-}" $TIMEOUT -s KILL 1800 Tests/$WIN_BIN_TYPE/Tests.exe || testfail=1 + env PYTHONHOME="$SDK_HOME" PATH="$FFMPEG_PATH/bin:$LIBRAW_PATH/bin:$QTDIR/bin:$SDK_HOME/osmesa/lib:$SDK_HOME/bin:${PATH:-}" $TIMEOUT -s KILL 1800 "${TEST_BINARY_TO_RUN}" || testfail=1 if [ $testfail != 0 ]; then echo "*** WARNING: Natron tests FAILED" fi @@ -492,14 +520,14 @@ elif [ "$PKGOS" = "OSX" ]; then # However, The universal build on OS X 10.6 requires this if [ "$MACOSX_DEPLOYMENT_TARGET" = "10.6" ]; then if [ "$COMPILER" = "gcc" ]; then - env DYLD_LIBRARY_PATH="$SDK_HOME"/lib/libgcc:/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources:"$SDK_HOME"/lib $TIMEOUT -s KILL 1800 Tests/Tests + env DYLD_LIBRARY_PATH="$SDK_HOME"/lib/libgcc:/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources:"$SDK_HOME"/lib $TIMEOUT -s KILL 1800 ${TEST_BINARY_TO_RUN} else # be more tolerant to test fails on 10.6 - $TIMEOUT -s KILL 1800 Tests/Tests || true + $TIMEOUT -s KILL 1800 ${TEST_BINARY_TO_RUN} || true fi else # Tests exit with a segfault on Qt5 - $TIMEOUT -s KILL 1800 Tests/Tests || [ "$QT_VERSION_MAJOR" = 5 ] + $TIMEOUT -s KILL 1800 ${TEST_BINARY_TO_RUN} || [ "$QT_VERSION_MAJOR" = 5 ] fi fi set +x diff --git a/tools/jenkins/build-plugins.sh b/tools/jenkins/build-plugins.sh index 6475eaf0ab..56c9ef0eef 100755 --- a/tools/jenkins/build-plugins.sh +++ b/tools/jenkins/build-plugins.sh @@ -121,6 +121,22 @@ else OPTFLAG=-Ofast fi +CP_OR_MV="cp -a" +if [ "${MINIMIZE_DISK_USAGE:-}" = "1" ]; then + # Move large files instead of copying them to minimize disk usage. + CP_OR_MV=mv +fi + +function maybe_cleanup_binary_files() { + if [ "${MINIMIZE_DISK_USAGE:-}" = "1" ]; then + echo "Cleaning up files to minimize disk usage..." + + rm -fv `find . -name *.o` + rm -fv `find . -name *.ofx` + fi +} + + # MISC if [ "$BUILD_MISC" = "1" ] && [ -d "$TMP_PATH/openfx-misc" ]; then @@ -235,9 +251,12 @@ if [ "$BUILD_MISC" = "1" ] && [ -d "$TMP_PATH/openfx-misc" ]; then CXXFLAGS_EXTRA="${CXXFLAGS_EXTRA}" \ make -j"${MKJOBS}" ${MAKEFLAGS_VERBOSE:-} -C CImg fi - cp -a ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + ${CP_OR_MV} ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" echo "Info: build openfx-misc using make... done!" fi + + maybe_cleanup_binary_files + cd "$TMP_PATH" #rm -rf openfx-misc || true fi @@ -294,9 +313,12 @@ if [ "$BUILD_IO" = "1" ] && [ -d "$TMP_PATH/openfx-io" ]; then LDFLAGS_ADD="${BUILDID:-}" \ CXXFLAGS_EXTRA="${CXXFLAGS_EXTRA}" \ make -j"${MKJOBS}" ${MAKEFLAGS_VERBOSE:-} - cp -a ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + ${CP_OR_MV} ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" echo "Info: build openfx-io using make... done!" fi + + maybe_cleanup_binary_files + cd "$TMP_PATH" #rm -rf openfx-io || true fi @@ -347,7 +369,10 @@ if [ "$BUILD_ARENA" = "1" ] && [ -d "$TMP_PATH/openfx-arena" ]; then CXXFLAGS_EXTRA="${CXXFLAGS_EXTRA}" \ make -j"${MKJOBS}" ${MAKEFLAGS_VERBOSE:-} - cp -a ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + ${CP_OR_MV} ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + + maybe_cleanup_binary_files + cd "$TMP_PATH" #rm -rf openfx-arena || true echo "Info: build openfx-arena using make... done!" @@ -399,7 +424,10 @@ if [ "$BUILD_GMIC" = "1" ] && [ -d "$TMP_PATH/openfx-gmic" ]; then CXXFLAGS_EXTRA="$GMIC_CXXFLAGS_EXTRA ${CXXFLAGS_EXTRA}" \ make -j"${GMIC_MKJOBS}" ${MAKEFLAGS_VERBOSE:-} fi - cp -a ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + ${CP_OR_MV} ./*/*-*-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + + maybe_cleanup_binary_files + cd "$TMP_PATH" #rm -rf openfx-gmic || true echo "Info: build openfx-gmic using make... done!" @@ -424,7 +452,10 @@ if [ "$BUILD_CV" = "1" ] && [ -d "$TMP_PATH/openfx-opencv" ]; then LDFLAGS_ADD="${BUILDID:-}" \ CXXFLAGS_EXTRA="${CXXFLAGS_EXTRA}" \ make -j"${MKJOBS}" ${MAKEFLAGS_VERBOSE:-} - cp -a ./*/*-"${BITS}"-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + ${CP_OR_MV} ./*/*-"${BITS}"-*/*.ofx.bundle "$TMP_BINARIES_PATH/OFX/Plugins/" + + maybe_cleanup_binary_files + fi #rm -f $KILLSCRIPT || true diff --git a/tools/jenkins/common.sh b/tools/jenkins/common.sh index e6e9e4a443..f85973f759 100644 --- a/tools/jenkins/common.sh +++ b/tools/jenkins/common.sh @@ -412,7 +412,7 @@ if [ "$PKGOS" = "Linux" ]; then #LD_RUN_PATH="$SDK_HOME/lib:$QTDIR/lib:$SDK_HOME/gcc/lib:$FFMPEG_PATH/lib:$LIBRAW_PATH/lib" PKG_CONFIG_PATH="$SDK_HOME/lib/pkgconfig:$SDK_HOME/share/pkgconfig:$SDK_HOME/libdata/pkgconfig:$FFMPEG_PATH/lib/pkgconfig:$LIBRAW_PATH/lib/pkgconfig:$OSMESA_PATH/lib/pkgconfig:$PYTHON_HOME/lib/pkgconfig:$QTDIR/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" elif [ "$PKGOS" = "Windows" ]; then - PKG_CONFIG_PATH="$FFMPEG_PATH/lib/pkgconfig:$LIBRAW_PATH/lib/pkgconfig:$OSMESA_PATH/lib/pkgconfig:$PYTHON_HOME/lib/pkgconfig:$QTDIR/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + PKG_CONFIG_PATH="$FFMPEG_PATH/lib/pkgconfig:$LIBRAW_PATH/lib/pkgconfig:$OSMESA_PATH/lib/pkgconfig:$(cygpath -u ${PYTHON_HOME})/lib/pkgconfig:$QTDIR/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" elif [ "$PKGOS" = "OSX" ]; then PKG_CONFIG_PATH="$FFMPEG_PATH/lib/pkgconfig:$LIBRAW_PATH/lib/pkgconfig:$OSMESA_PATH/lib/pkgconfig:$PYTHON_HOME/lib/pkgconfig:$QTDIR/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" fi diff --git a/tools/jenkins/launchBuildMain.sh b/tools/jenkins/launchBuildMain.sh index cf9739d9b5..2fe0ac0f80 100755 --- a/tools/jenkins/launchBuildMain.sh +++ b/tools/jenkins/launchBuildMain.sh @@ -573,6 +573,10 @@ fi INSTALLER_BASENAME="${INSTALLER_BASENAME}-${NATRON_VERSION_STRING}-${INSTALLER_OS}-${INSTALLER_ARCH}" +if [ "${DISABLE_BREAKPAD:-}" != "1" ]; then + INSTALLER_BASENAME="${INSTALLER_BASENAME}-breakpad" +fi + if [ "$COMPILE_TYPE" = "debug" ]; then INSTALLER_BASENAME="${INSTALLER_BASENAME}-debug" fi diff --git a/tools/jenkins/zip-python-mingw.sh b/tools/jenkins/zip-python-mingw.sh index 421c73a4bd..7e10f3b637 100755 --- a/tools/jenkins/zip-python-mingw.sh +++ b/tools/jenkins/zip-python-mingw.sh @@ -35,6 +35,7 @@ logging msilib multiprocessing pydoc_data +re sqlite3 unittest urllib