diff --git a/.gitignore b/.gitignore index 6faafbe..7f4d1ff 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,9 @@ sdk CHANGES .DS_Store deploy -mxe \ No newline at end of file +mxe +Windows +Linux +Darwin +legal + diff --git a/CMakeLists.txt b/CMakeLists.txt index cd97200..5f821fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ cmake_minimum_required(VERSION 3.1) enable_testing() -project(Cyan VERSION 1.2.3) +project(Cyan VERSION 1.2.4) if(NOT PROJECT_VERSION_TWEAK) set(PROJECT_VERSION_TWEAK 0) diff --git a/cyan.pro b/cyan.pro index 6461844..0a74aec 100644 --- a/cyan.pro +++ b/cyan.pro @@ -31,7 +31,7 @@ # USED FOR OFFICIAL BINARIES, USE CMAKE INSTEAD! TARGET = Cyan -VERSION = 1.2.3 +VERSION = 1.2.4 SOURCES += \ src/main.cpp \ @@ -135,9 +135,12 @@ unix:!mac { mac { ICON = res/Cyan.icns QMAKE_INFO_PLIST = res/Info.plist - #QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10 - #QMAKE_CXXFLAGS += -fopenmp - #QMAKE_LFLAGS += -fopenmp + # ugly workaround for static build: + QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.13 + QMAKE_CFLAGS += -fopenmp + QMAKE_CXXFLAGS += -fopenmp + QMAKE_LFLAGS += -lomp -liconv + LIBS += -L /opt/local/lib/libomp } win32 { diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 6e29866..db4e312 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -1,3 +1,8 @@ +## 1.2.4 - 20220324 + + * Fixed Gimp path detection bug + * Fixed macOS support + ## 1.2.3 - 20220318 * Fixed some (not all) UI scaling issues @@ -8,8 +13,6 @@ * Fixed compatibility with Qt 5.15 * Updated third-party software (included in binaries) -This release does not include macOS binaries. - ## 1.2.2 - 20191103 * Added support for output compression quality diff --git a/res/Info.plist b/res/Info.plist index a84b81d..f36d3c0 100644 --- a/res/Info.plist +++ b/res/Info.plist @@ -9,7 +9,7 @@ CFBundlePackageType APPL CFBundleGetInfoString - 1.2 + 1.2.4 CFBundleSignature ???? CFBundleExecutable diff --git a/res/clang-tiff-version.diff b/res/clang-tiff-version.diff new file mode 100644 index 0000000..44643eb --- /dev/null +++ b/res/clang-tiff-version.diff @@ -0,0 +1,22 @@ +--- Makefile.am.orig 2022-03-23 19:22:06.000000000 +0100 ++++ Makefile.am 2022-03-23 19:22:30.000000000 +0100 +@@ -34,7 +34,7 @@ + README.md \ + RELEASE-DATE \ + TODO \ +- VERSION ++ VERSION.txt + + EXTRA_DIST = \ + cmake \ +--- Makefile.in.orig 2022-03-23 19:22:13.000000000 +0100 ++++ Makefile.in 2022-03-23 19:22:51.000000000 +0100 +@@ -424,7 +424,7 @@ + README.md \ + RELEASE-DATE \ + TODO \ +- VERSION ++ VERSION.txt + + EXTRA_DIST = \ + cmake \ diff --git a/res/gimp.py b/res/gimp.py index cd0c87b..02c27f0 100755 --- a/res/gimp.py +++ b/res/gimp.py @@ -9,7 +9,7 @@ import os.path import tempfile -cyanversion = "1.2.3" +cyanversion = "1.2.4" cyanbin = "cyan" def plugin_maketempfile( image, src, type ): diff --git a/res/mktarball.sh b/res/mktarball.sh index 0f43d89..2d1d073 100755 --- a/res/mktarball.sh +++ b/res/mktarball.sh @@ -4,7 +4,7 @@ set -e -x CWD=`pwd` BUILD_DIR=${BUILD_DIR:-"${CWD}/../cyan-tmp"} -VERSION=${VERSION:-1.2.3} +VERSION=${VERSION:-1.2.4} rm -rf "${BUILD_DIR}" || true mkdir -p "${BUILD_DIR}" && cd "${BUILD_DIR}" diff --git a/res/release.sh b/res/release.sh index 19bb459..25b1bbc 100755 --- a/res/release.sh +++ b/res/release.sh @@ -1,17 +1,16 @@ #!/bin/sh # -# Build Cyan release for Windows and Linux +# Build Cyan release for Windows/macOS/Linux # -# Windows release is built on Ubuntu 20.04 using MXE -# Linux release is built on CentOS 7 using DTS-7 -# -# macOS support will be added if demand is high enough. +# Windows release is built on Ubuntu 20.04 using MXE (GCC 7) +# Linux release is built on CentOS 7 using DTS (GCC 7) +# macOS release is built on macOS 10.13 (CLANG MP 9 from macports) # set -e CWD=`pwd` -OS=${OS:-"Windows"} # Windows is default +OS=${OS:-"Windows"} # Windows is default (use Windows/Linux/Darwin) SDK=${SDK:-${CWD}/${OS}} TYPE=${TYPE:-Release} MKJOBS=${MKJOBS:-1} @@ -25,8 +24,11 @@ WINE=${WINE:-wine64} QMAKE=${MXE}/usr/${MXE_TC}/qt5/bin/qmake VERSION=`cat CMakeLists.txt | sed '/Cyan VERSION/!d;s/)//' | awk '{print $3}'` CI=20220315 - +OSX_MIN=10.13 +CLANG=9.0 +CLANG_ROOT="/opt/local" ARCH="x86_64" + if [ "${OS}" = "Windows" ]; then ARCH="x64" fi @@ -40,7 +42,16 @@ elif [ "${OS}" = "Linux" ]; then WINE="" QMAKE="${SDK}/bin/qmake" export PATH="${SDK}/usr/bin:${PATH}" +elif [ "${OS}" = "Darwin" ]; then + CMAKE="$CLANG_ROOT/bin/cmake" + STRIP="strip -u -r" + WINE="" + QMAKE="${SDK}/bin/qmake" + export CC="$CLANG_ROOT/bin/clang-mp-$CLANG -stdlib=libc++ -mmacosx-version-min=$OSX_MIN" + export CXX="$CLANG_ROOT/bin/clang++-mp-$CLANG -stdlib=libc++ -mmacosx-version-min=$OSX_MIN" + export PATH=$SDK/bin:/usr/bin:/usr/sbin:/bin:/sbin fi + export PKG_CONFIG_PATH="${SDK}/lib/pkgconfig" echo "Building Cyan ${VERSION} ${ARCH} for ${OS} using ${SDK} ... (Ctrl+C to cancel)\n" @@ -57,15 +68,29 @@ AEXE=build/Cyan if [ "${OS}" = "Windows" ]; then AEXE=build/Cyan.exe fi -${STRIP} ${AEXE} -ls -lah ${AEXE} -mkdir tst -cd tst -${QMAKE} ../../tests.pro -make -if [ "${OS}" = "Windows" ]; then - ${WINE} build/tests.exe +if [ "${OS}" != "Darwin" ]; then + ${STRIP} ${AEXE} + ls -lah ${AEXE} +fi + +if [ "${OS}" = "Darwin" ]; then + AEXE=build/Cyan.app + $SDK/bin/macdeployqt ${AEXE} + ${STRIP} ${AEXE}/Contents/MacOS/* + ls -lah ${AEXE}/Contents/MacOS/* + otool -L ${AEXE}/Contents/MacOS/* +fi + +# qt 5.12.12 testlib is currently broken on macos +if [ "${OS}" != "Darwin" ]; then + mkdir tst + cd tst + ${QMAKE} ../../tests.pro + make + if [ "${OS}" = "Windows" ]; then + ${WINE} build/tests.exe + fi fi cd "${BUILD_DIR}" @@ -75,19 +100,33 @@ if [ ! -d "${CWD}/legal" ]; then tar xvf legal.tar.xz -C "${CWD}/" fi -ZIP_DIR=Cyan-${VERSION}-${OS}-${ARCH} +if [ "${OS}" = "Darwin" ]; then + ZIP_DIR=Cyan-${VERSION}-macOS-${ARCH} +else + ZIP_DIR=Cyan-${VERSION}-${OS}-${ARCH} +fi + mkdir -p ${ZIP_DIR} -cp ${AEXE} ${ZIP_DIR}/ +cp -a ${AEXE} ${ZIP_DIR}/ cp ../LICENSE ${ZIP_DIR}/LICENSE.TXT cp -a ${CWD}/legal ${ZIP_DIR}/ -if [ "${OS}" = "Windows" ]; then - rm -rf ${ZIP_DIR}/legal/libxkbcommon || true -else +if [ "${OS}" != "Windows" ]; then rm -rf ${ZIP_DIR}/legal/gcc ${ZIP_DIR}/legal/mingw-w64 || true fi +if [ "${OS}" != "Linux" ]; then + rm -rf ${ZIP_DIR}/legal/libxkbcommon || true +fi echo "Licenses for included open-source software.\n\nSource code :\n\nhttps://github.com/rodlie/cyan/releases/download/continuous/cyan-sdk-src-${CI}.tar\nhttps://github.com/rodlie/cyan/releases/download/continuous/cyan-mxe-${CI}.tar.xz" > ${ZIP_DIR}/legal/README.TXT -zip -9 -r ${ZIP_DIR}.zip ${ZIP_DIR} -ls -lah ${ZIP_DIR}.zip +EXT=zip + +if [ "${OS}" = "Darwin" ]; then + EXT=dmg + hdiutil create -volname "Cyan $VERSION" -srcfolder ${ZIP_DIR} -ov -format UDBZ ${ZIP_DIR}.${EXT} +else + zip -9 -r ${ZIP_DIR}.${EXT} ${ZIP_DIR} +fi + +ls -lah ${ZIP_DIR}.${EXT} diff --git a/res/sdk.sh b/res/sdk.sh index 8b7c70a..ea58e1f 100644 --- a/res/sdk.sh +++ b/res/sdk.sh @@ -53,12 +53,13 @@ if [ "$OS" = "Darwin" ]; then # sudo port install clang-$CLANG ld64 export CC="$CLANG_ROOT/bin/clang-mp-$CLANG -stdlib=libc++ -mmacosx-version-min=$OSX_MIN" export CXX="$CLANG_ROOT/bin/clang++-mp-$CLANG -stdlib=libc++ -mmacosx-version-min=$OSX_MIN" + export PATH=$SDK/bin:/usr/bin:/usr/sbin:/bin:/sbin +else + export PATH="${SDK}/bin:${PATH}" fi -# export common env +# pkgconfig .pc path export PKG_CONFIG_PATH="$SDK/lib/pkgconfig" -#export PATH=$SDK/bin:/usr/bin:/usr/sbin:/bin:/sbin -export PATH="${SDK}/bin:${PATH}" # always clean tmp rm -rf "$WRK" || true @@ -162,7 +163,15 @@ if [ ! -f "$SDK/lib/pkgconfig/libtiff-4.pc" ]; then rm -rf tiff-$TIFF || true tar xvf $SRC/tiff-$TIFF.tar.gz cd tiff-$TIFF + if [ "${OS}" = "Darwin" ]; then + mv VERSION VERSION.txt + patch -p0 < $CWD/res/clang-tiff-version.diff + fi TIF_CONFIGURE=$DEFAULT_CONFIGURE + #TIF_CONFIGURE=$SHARED_CONFIGURE + #if [ "${OS}" = "Linux" ]; then + # TIF_CONFIGURE=$DEFAULT_CONFIGURE + #fi CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" CPPFLAGS="$DEFAULT_FLAGS" ./configure $TIF_CONFIGURE \ --without-x --disable-webp --enable-lzma --enable-jpeg12 --with-jpeg12-include-dir=$SDK/include make -j$JOBS @@ -208,7 +217,7 @@ if [ ! -f "$SDK/lib/pkgconfig/Magick++.pc" ]; then if [ "$OS" = "Darwin" ]; then MAGICK_LDFLAGS="-mmacosx-version-min=$OSX_MIN" fi - sed -i 's#-ltiff#-ltiff -llzma -ljpeg -lz#g' configure + sed -i '' 's#-ltiff#-ltiff -llzma -ljpeg -lz#g' configure LDFLAGS="$MAGICK_LDFLAGS" LIBS="-lz -llzma -lbz2" CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ./configure --prefix=$SDK \ --enable-static --disable-shared \ --with-x=no --disable-docs --disable-modules --without-modules --with-xml --without-gslib \ @@ -237,41 +246,30 @@ if [ "$OS" = "Linux" ] && [ ! -f "$SDK/lib/pkgconfig/xkbcommon.pc" ]; then fi # qtbase -QT_CONFIGURE="-optimize-size -opensource -release -confirm-license -gui -widgets -strip -static -nomake examples -nomake tests -no-glib -no-dbus -no-openssl -no-ico -no-icu -no-sql-sqlite -no-sse4.2 -no-avx -no-avx2 -no-avx512 -no-cups -no-gtk -no-libjpeg -no-fontconfig -no-mtdev -no-syslog -no-gif -qt-pcre -qt-freetype -qt-harfbuzz -opengl desktop" -if [ ! -f "$SDK/bin/qmake" ] && [ "$OS" = "Darwin" ]; then - ## we use the legacy LTS release (5.9) on OSX - #cd $WRK || exit 1 - #tar xvf $SRC/qtbase-opensource-src-$QT.tar.xz || exit 1 - #cd $WRK/qtbase-opensource-src-$QT || exit 1 - ## set correct compiler - #sed -i '' "s#QMAKE_CC = clang#QMAKE_CC = $CLANG_ROOT/bin/clang-mp-${CLANG}#" mkspecs/common/clang.conf || exit 1 - #sed -i '' "s#QMAKE_CXX = clang++#QMAKE_CXX = $CLANG_ROOT/bin/clang++-mp-${CLANG}#" mkspecs/common/clang.conf || exit 1 - #./configure -prefix $SDK -release -opensource -c++std c++11 -framework \ - #-no-sql-sqlite -no-avx -no-avx2 -force-pkg-config -system-zlib -no-gif -no-libjpeg \ - #-system-libpng -no-fontconfig -qt-freetype -qt-harfbuzz -no-openssl -qt-pcre -nomake examples \ - #-gui -widgets -no-glib -no-cups -no-dbus -opengl desktop -no-securetransport -confirm-license -I $SDK/include -L $SDK/lib || exit 1 - #make -j$JOBS || exit 1 - #make install || exit 1 - echo "update me!" -elif [ ! -f "$SDK/bin/qmake" ] && [ "$OS" = "Linux" ]; then +QT_CONFIGURE="-static -force-pkg-config -optimize-size -opensource -release -confirm-license -gui -widgets -strip -nomake examples -nomake tests -no-glib -no-dbus -no-openssl -no-ico -no-icu -no-sql-sqlite -no-sse4.2 -no-avx -no-avx2 -no-avx512 -no-cups -no-gtk -no-libjpeg -no-fontconfig -no-mtdev -no-syslog -no-gif -qt-pcre -qt-freetype -qt-harfbuzz -opengl desktop -system-libpng -system-zlib" +if [ ! -f "$SDK/bin/qmake" ]; then cd $WRK rm -rf qtbase-everywhere-src-$QT tar xvf $SRC/qtbase-everywhere-src-$QT.tar.xz cd qtbase-everywhere-src-$QT || exit 1 export LD_LIBRARY_PATH="$SDK/lib:$LD_LIBRARY_PATH" - CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ./configure -prefix $SDK $QT_CONFIGURE \ - -no-eglfs -no-kms -no-linuxfb -xkbcommon -qt-xcb -system-libpng -system-zlib \ - -I $SDK/include -L $SDK/lib || exit 1 - make -j$JOBS || exit 1 - make install || exit 1 + if [ "$OS" = "Darwin" ]; then + echo "QMAKE_CC = $CLANG_ROOT/bin/clang-mp-${CLANG} -mmacosx-version-min=$OSX_MIN" >> mkspecs/common/clang.conf + echo "QMAKE_CXX = $CLANG_ROOT/bin/clang++-mp-${CLANG} -mmacosx-version-min=$OSX_MIN" >> mkspecs/common/clang.conf + CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ./configure -prefix $SDK $QT_CONFIGURE -c++std c++14 -no-feature-testlib -no-securetransport -I $SDK/include -L $SDK/lib + elif [ "$OS" = "Linux" ]; then + CFLAGS="$DEFAULT_FLAGS" CXXFLAGS="$DEFAULT_FLAGS" ./configure -prefix $SDK $QT_CONFIGURE -no-eglfs -no-kms -no-linuxfb -xkbcommon -qt-xcb -I $SDK/include -L $SDK/lib + fi + make -j$JOBS + make install fi # macdeployqt if [ ! -f "$SDK/bin/macdeployqt" ] && [ "$OS" = "Darwin" ]; then cd $WRK || exit 1 rm -rf qttools* || true - tar xvf $SRC/qttools-opensource-src-$QT.tar.xz || exit 1 - cd qttools-opensource-src-$QT || exit 1 + tar xvf $SRC/qttools-everywhere-src-$QT.tar.xz || exit 1 + cd qttools-everywhere-src-$QT || exit 1 $SDK/bin/qmake || exit 1 make || exit 1 make install || exit 1 diff --git a/src/cyan.cpp b/src/cyan.cpp index a4b65c8..2a691a8 100644 --- a/src/cyan.cpp +++ b/src/cyan.cpp @@ -62,6 +62,9 @@ extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory (PULONGLONG #endif #elif defined(Q_OS_LINUX) #include +#elif defined(Q_OS_MAC) +#include +#include #endif #include "helpdialog.h" @@ -1232,13 +1235,18 @@ void Cyan::gimpPlugin() gimps << ".gimp-" << ".config/GIMP-AppImage/" << ".config/GIMP/" << "AppData/Roaming/GIMP/" << "Library/Application Support/GIMP/" << ".var/app/org.gimp.GIMP/config/GIMP/"; foreach (QString version, versions) { foreach (QString gimp, gimps) { - QString configPath = QString("%1/%2%3/plug-ins") + QString configPath = QString("%1/%2%3") .arg(QDir::homePath()) .arg(gimp) .arg(version); if (QFile::exists(configPath)) { + configPath.append("/plug-ins"); + if (!QFile::exists(configPath)) { + QDir dir(configPath); + dir.mkdir(configPath); + } folders << QString("%1/cyan.py").arg(configPath); - qDebug() << "found GIMP folder" << configPath; + std::cout << "found GIMP folder: " << configPath.toStdString() << std::endl; } } } @@ -1598,6 +1606,13 @@ int Cyan::getTotalRam(int percent) int gib = qRound(static_cast(physicalMemory/1024000000)); ram = qRound(static_cast((gib*percent)/100)); #endif +#elif defined(Q_OS_MAC) + int mib [] = { CTL_HW, HW_MEMSIZE }; + int64_t physicalMemory = 0; + size_t length = sizeof(physicalMemory); + sysctl(mib, 2, &physicalMemory, &length, NULL, 0); + int gib = qRound(static_cast(physicalMemory/1024000000)); + ram = qRound(static_cast((gib*percent)/100)); #endif Q_UNUSED(percent)