diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..bab7397a6 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,69 @@ +name: macOS build + +on: + push + +jobs: + build: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v1 + - name: Install dependencies + run: brew install gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme libsigc++ little-cms2 libiptcdata fftw lensfun llvm expat pkgconfig libomp shared-mime-info + - name: patch libiconv + run: | + mkdir libiconv && cd libiconv + wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz + tar xf libiconv-1.16.tar.gz + cd libiconv-1.16 + patch -p1 < "${GITHUB_WORKSPACE}/tools/osx/libiconv_1.16_rt.patch" + mkdir build && cd build + destDir="$(pwd)" + ../configure --prefix=/opt/local --disable-static 'CFLAGS=-arch x86_64 -mmacosx-version-min=10.9' 'LDFLAGS=-arch x86_64 -mmacosx-version-min=10.9' CXXFLAGS="-arch x86_64 -mmacosx-version-min=10.9" + make --jobs + make DESTDIR="${destDir}" install + sudo mv opt/local /usr/local/opt/libiconv + - name: cmake + env: + CMAKE_CXX_STANDARD: 11 + PKG_CONFIG_PATH: /usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig + RAW_THERAPEE_MAJOR: '5' + RAW_THERAPEE_MINOR: '7' + C_FLAGS: -Xpreprocessor -fopenmp /usr/local/lib/libomp.dylib -I/usr/local/include -I/usr/local/opt/gdk-pixbuf/include -I/usr/local/opt/libiconv/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/expat/include -I/usr/local/opt/llvm/include + run: | + # GITHUB_REF is the ref that triggered the build, like refs/heads/new-feature - the next line parses that to REF: the branch name only (new-feature) + REF=${GITHUB_REF##*/} + mkdir build && cd build + cmake \ + -DCMAKE_BUILD_TYPE="release" \ + -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ + -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib -L/usr/local/opt/gdk-pixbuf/lib -L/usr/local/opt/libiconv/lib -L/usr/local/opt/libffi/lib -L/usr/local/opt/libffi/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/expat/lib" \ + -DCACHE_NAME_SUFFIX="${RAW_THERAPEE_MAJOR}.${RAW_THERAPEE_MINOR}-${REF}" \ + -DPROC_TARGET_NUMBER="2" \ + -DPROC_LABEL="generic processor" \ + -DWITH_LTO="OFF" \ + -DLENSFUNDBDIR="./share/lensfun" \ + -DOpenMP_C_FLAGS=-fopenmp=libomp \ + -DOpenMP_CXX_FLAGS=-fopenmp=libomp \ + -DOpenMP_C_LIB_NAMES="libomp" \ + -DOpenMP_CXX_LIB_NAMES="libomp" \ + -DOpenMP_libomp_LIBRARY="/usr/local/lib/libomp.dylib" \ + -DOpenMP_C_FLAGS="${C_FLAGS}" \ + -DOpenMP_CXX_FLAGS="${C_FLAGS}" \ + -DCMAKE_AR="/usr/local/opt/llvm/bin/llvm-ar" \ + -DCMAKE_RANLIB="/usr/local/opt/llvm/bin/llvm-ranlib" \ + .. + make --jobs + make install + sudo make macosx_bundle + ARTIFACT=(RawTherapee*.zip) + echo "=== artifact: ${ARTIFACT}" + # defining environment variables for next step as per https://github.com/actions/starter-workflows/issues/68 + echo "::set-env name=ARTIFACT_PATH::${GITHUB_WORKSPACE}/build/${ARTIFACT}" + echo "::set-env name=ARTIFACT_FILE::${ARTIFACT}" + - uses: actions/upload-artifact@v1 + with: + name: ${{env.ARTIFACT_FILE}} + path: ${{env.ARTIFACT_PATH}} diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 2267a9fc1..142374213 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -230,22 +230,7 @@ void Adjuster::setDefaultEditedState (EditedState eState) void Adjuster::autoToggled () { - if (!editedCheckBox) { - // If not used in the BatchEditor panel - if (automatic->get_active()) { - // Disable the slider and spin button - spin->set_sensitive(false); - slider->set_sensitive(false); - reset->set_sensitive(false); - } else { - // Enable the slider and spin button - spin->set_sensitive(true); - slider->set_sensitive(true); - reset->set_sensitive(true); - } - } - - if (adjusterListener != nullptr && !blocked) { + if (adjusterListener && !blocked) { adjusterListener->adjusterAutoToggled(this); } } @@ -380,6 +365,9 @@ void Adjuster::spinChanged () if (adjusterListener && !blocked) { if (!buttonReleaseSlider.connected() || afterReset) { eventPending = false; + if (automatic) { + setAutoValue(false); + } adjusterListener->adjusterChanged(this, spin->get_value()); } else { eventPending = true; @@ -419,6 +407,9 @@ void Adjuster::sliderChanged () if (adjusterListener && !blocked) { if (!buttonReleaseSlider.connected() || afterReset) { eventPending = false; + if (automatic) { + setAutoValue(false); + } adjusterListener->adjusterChanged(this, spin->get_value()); } else { eventPending = true; @@ -459,21 +450,6 @@ void Adjuster::setAutoValue (bool a) const bool oldVal = autoChange.block(true); automatic->set_active(a); autoChange.block(oldVal); - - if (!editedCheckBox) { - // If not used in the BatchEditor panel - if (a) { - // Disable the slider and spin button - spin->set_sensitive(false); - slider->set_sensitive(false); - reset->set_sensitive(false); - } else { - // Enable the slider and spin button - spin->set_sensitive(true); - slider->set_sensitive(true); - reset->set_sensitive(true); - } - } } } @@ -481,6 +457,9 @@ bool Adjuster::notifyListener () { if (eventPending && adjusterListener != nullptr && !blocked) { + if (automatic) { + setAutoValue(false); + } adjusterListener->adjusterChanged(this, spin->get_value()); } @@ -571,6 +550,9 @@ void Adjuster::showEditedCB () void Adjuster::editedToggled () { if (adjusterListener && !blocked) { + if (automatic) { + setAutoValue(false); + } adjusterListener->adjusterChanged(this, spin->get_value()); } diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 4d4bb8dd6..a6d172d46 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -2073,6 +2073,7 @@ bool EditorPanel::idle_sentToGimp (ProgressConnector *pc, rtengine::IImagef { img->free (); int errore = pc->returnValue(); + setProgressState(false); delete pc; if (!errore) { diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 273980ffe..bf043cf82 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -342,34 +342,31 @@ void Thumbnail::notifylisterners_procParamsChanged(int whoChangedIt) * the Preferences). * * The result is a complete ProcParams with default values merged with the values - * from the default Raw or Image ProcParams, then with the values from the loaded - * ProcParams (sidecar or cache file). - */ + * from the loaded ProcParams (sidecar or cache file). +*/ void Thumbnail::loadProcParams () { MyMutex::MyLock lock(mutex); pparamsValid = false; pparams->setDefaults(); - const PartialProfile *defaultPP = ProfileStore::getInstance()->getDefaultPartialProfile(getType() == FT_Raw); - defaultPP->applyTo(pparams.get()); if (options.paramsLoadLocation == PLL_Input) { // try to load it from params file next to the image file - int ppres = pparams->load (fname + paramFileExtension); + const int ppres = pparams->load(fname + paramFileExtension); pparamsValid = !ppres && pparams->ppVersion >= 220; // if no success, try to load the cached version of the procparams if (!pparamsValid) { - pparamsValid = !pparams->load (getCacheFileName ("profiles", paramFileExtension)); + pparamsValid = !pparams->load(getCacheFileName("profiles", paramFileExtension)); } } else { // try to load it from cache - pparamsValid = !pparams->load (getCacheFileName ("profiles", paramFileExtension)); + pparamsValid = !pparams->load(getCacheFileName("profiles", paramFileExtension)); // if no success, try to load it from params file next to the image file if (!pparamsValid) { - int ppres = pparams->load (fname + paramFileExtension); + const int ppres = pparams->load(fname + paramFileExtension); pparamsValid = !ppres && pparams->ppVersion >= 220; } } diff --git a/tools/osx/libiconv_1.16_rt.patch b/tools/osx/libiconv_1.16_rt.patch new file mode 100644 index 000000000..470f7780c --- /dev/null +++ b/tools/osx/libiconv_1.16_rt.patch @@ -0,0 +1,31 @@ +diff --git a/lib/iconv.c b/lib/iconv.c +index b7a04f8..41c5896 100644 +--- a/lib/iconv.c ++++ b/lib/iconv.c +@@ -610,5 +610,26 @@ strong_alias (libiconv_open, iconv_open) + strong_alias (libiconv, iconv) + strong_alias (libiconv_close, iconv_close) + #endif ++ ++#undef iconv_open ++#undef iconv ++#undef iconv_close ++ ++LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode) ++{ ++ return libiconv_open(tocode, fromcode); ++} ++ ++LIBICONV_DLL_EXPORTED size_t iconv (iconv_t icd, ++ ICONV_CONST char * * inbuf, size_t *inbytesleft, ++ char * * outbuf, size_t *outbytesleft) ++{ ++ return libiconv(icd, inbuf, inbytesleft, outbuf, outbytesleft); ++} ++ ++LIBICONV_DLL_EXPORTED int iconv_close (iconv_t icd) ++{ ++ return libiconv_close(icd); ++} + + #endif diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 2501e936b..3958326e8 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -99,6 +99,7 @@ MACOS="${CONTENTS}/MacOS" LIB="${CONTENTS}/Frameworks" ETC="${RESOURCES}/etc" EXECUTABLE="${MACOS}/rawtherapee" +GDK_PREFIX="/usr/local/opt/gdk-pixbuf" msg "Removing old files:" rm -rf "${APP}" "${PROJECT_NAME}_*.dmg" "*zip" @@ -111,13 +112,13 @@ install -d "${RESOURCES}" \ msg "Copying release files:" ditto "${CMAKE_BUILD_TYPE}/MacOS" "${MACOS}" -ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" +ditto "Resources" "${RESOURCES}" msg "Copying dependencies from ${GTK_PREFIX}:" CheckLink "${EXECUTABLE}" msg "Copying library modules from ${GTK_PREFIX}:" -ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 +ditto --arch "${arch}" {"${GDK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gtk-3.0 msg "Removing static libraries and cache files:" @@ -129,50 +130,56 @@ install -d "${ETC}/gtk-3.0" # Make Frameworks folder flat mv "${LIB}"/gdk-pixbuf-2.0/2*/loaders/*.so "${LIB}" mv "${LIB}"/gtk-3.0/3*/immodules/*.so "${LIB}" +# the print*.so lead to errors when running gtk-query-immodules-3.0, just seeing what the app does without, since they are not in immodules +# and including them leads to errors and a completely empty gtk.immodules file +# mv "${LIB}"/gtk-3.0/3*/printbackends/*.so "${LIB}" rm -r "${LIB}"/gtk-3.0 rm -r "${LIB}"/gdk-pixbuf-2.0 -"${GTK_PREFIX}/bin/gdk-pixbuf-query-loaders" "${LIB}"/libpix*.so > "${ETC}/gtk-3.0/gdk-pixbuf.loaders" -"${GTK_PREFIX}/bin/gtk-query-immodules-3.0" "${LIB}"/{im*.so,libprint*.so} > "${ETC}/gtk-3.0/gtk.immodules" +"${GDK_PREFIX}"/bin/gdk-pixbuf-query-loaders "${LIB}"/libpix*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders +"${GTK_PREFIX}"/bin/gtk-query-immodules-3.0 "${LIB}"/im*.so > "${ETC}"/gtk-3.0/gtk.immodules sed -i "" -e "s|${PWD}/RawTherapee.app/Contents/|/Applications/RawTherapee.app/Contents/|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" -ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas -"${GTK_PREFIX}/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" +mkdir -p ${RESOURCES}/share/glib-2.0 +cp -pRL {"/usr/local","${RESOURCES}"}/share/glib-2.0/schemas +"/usr/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" msg "Copying shared files from ${GTK_PREFIX}:" -ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/mime +cp -pRL {"/usr/local","${RESOURCES}"}/share/mime + # GTK3 themes -ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css -ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css +ditto {"/usr/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css +ditto {"/usr/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css # Adwaita icons iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices") for f in "${iconfolders[@]}"; do - ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/"$f" + mkdir -p ${RESOURCES}/share/icons/Adwaita/${f} + cp /usr/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} done -ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme -"${GTK_PREFIX}/bin/gtk-update-icon-cache-3.0" "${RESOURCES}/share/icons/Adwaita" +ditto {"/usr/local","${RESOURCES}"}/share/icons/Adwaita/index.theme +"/usr/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" # Copy libjpeg-turbo into the app bundle -cp /opt/local/lib/libjpeg.62.dylib "${RESOURCES}/../Frameworks" +cp /usr/local/lib/libjpeg.*.dylib "${CONTENTS}/Frameworks" -# Copy libexpat into the app bundle -cp /opt/local/lib/libexpat.1.dylib "${RESOURCES}/../Frameworks" +# Copy libexpat into the app bundle (which is keg-only) +cp /usr/local/Cellar/expat/*/lib/libexpat.1.dylib "${CONTENTS}/Frameworks" # Copy libz into the app bundle -cp /opt/local/lib/libz.1.dylib "${RESOURCES}/../Frameworks" +cp /usr/lib/libz.1.dylib "${CONTENTS}/Frameworks" # Copy libtiff into the app bundle -cp /opt/local/lib/libtiff.5.dylib "${RESOURCES}/../Frameworks" +cp /usr/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks" # Copy the Lensfun database into the app bundle mkdir -p "${RESOURCES}/share/lensfun" -cp /opt/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +cp /usr/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" # Copy liblensfun to Frameworks -cp /opt/local/lib/liblensfun.2.dylib "${RESOURCES}/../Frameworks" +cp /usr/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks" # Copy libomp to Frameworks -cp /opt/local/lib/libomp.dylib "${RESOURCES}/../Frameworks" +cp /usr/local/lib/libomp.dylib "${CONTENTS}/Frameworks" # Install names find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do