Skip to content

Commit

Permalink
macos fixes + gimp fixes + version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Mar 24, 2022
1 parent aa7fb3b commit dfdcae0
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 63 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ sdk
CHANGES
.DS_Store
deploy
mxe
mxe
Windows
Linux
Darwin
legal

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions cyan.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions docs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion res/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>1.2</string>
<string>1.2.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
Expand Down
22 changes: 22 additions & 0 deletions res/clang-tiff-version.diff
Original file line number Diff line number Diff line change
@@ -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 \
2 changes: 1 addition & 1 deletion res/gimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ):
Expand Down
2 changes: 1 addition & 1 deletion res/mktarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
83 changes: 61 additions & 22 deletions res/release.sh
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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}"
Expand All @@ -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}
54 changes: 26 additions & 28 deletions res/sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
19 changes: 17 additions & 2 deletions src/cyan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory (PULONGLONG
#endif
#elif defined(Q_OS_LINUX)
#include <unistd.h>
#elif defined(Q_OS_MAC)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif

#include "helpdialog.h"
Expand Down Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -1598,6 +1606,13 @@ int Cyan::getTotalRam(int percent)
int gib = qRound(static_cast<double>(physicalMemory/1024000000));
ram = qRound(static_cast<double>((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<double>(physicalMemory/1024000000));
ram = qRound(static_cast<double>((gib*percent)/100));
#endif
Q_UNUSED(percent)

Expand Down

0 comments on commit dfdcae0

Please sign in to comment.