Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide instructions and helper scripts to generate dmg of homebrew-based build for macOS #11579

Merged
merged 4 commits into from Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
65 changes: 65 additions & 0 deletions packaging/macosx/1_install_hb_dependencies.sh
@@ -0,0 +1,65 @@
#!/bin/bash
#
# Script to install required homebrew packages
#

# Exit in case of error
set -e -o pipefail
trap 'echo "${BASH_SOURCE[0]}{${FUNCNAME[0]}}:${LINENO}: Error: command \`${BASH_COMMAND}\` failed with exit code $?"' ERR

# Check if brew exists
if ! [ -x "$(command -v brew)" ]; then
echo 'Homebrew not found. Follow instructions as provided by https://brew.sh/ to install it.' >&2
exit 1
else
echo "Found homebrew running in $(arch)-based environment."
fi

# Make sure that homebrew is up-to-date
brew update
brew upgrade

# Define homebrew dependencies
hbDependencies="adwaita-icon-theme \
cmake \
cmocka \
curl \
desktop-file-utils \
exiv2 \
gettext \
git \
glib \
gmic \
gphoto2 \
graphicsmagick \
gtk-mac-integration \
gtk+3 \
icu4c \
intltool \
iso-codes \
jpeg \
json-glib \
lensfun \
libavif \
libheif \
libomp \
librsvg \
libsecret \
libsoup@2 \
little-cms2 \
llvm \
lua \
ninja \
openexr \
openjpeg \
osm-gps-map \
perl \
po4a \
portmidi \
pugixml \
sdl2"

# Install homebrew dependencies
for hbDependency in $hbDependencies; do
brew install "$hbDependency"
done
53 changes: 53 additions & 0 deletions packaging/macosx/2_build_hb_darktable_custom.sh
@@ -0,0 +1,53 @@
#!/bin/bash
#
# Script to build and install darktable with custom configuration
#

# Exit in case of error
set -e -o pipefail
trap 'echo "${BASH_SOURCE[0]}{${FUNCNAME[0]}}:${LINENO}: Error: command \`${BASH_COMMAND}\` failed with exit code $?"' ERR

# Go to directory of script
scriptDir=$(dirname "$0")
cd "$scriptDir"/
scriptDir=$(pwd)

# Set variables
buildDir="../../build"
homebrewHome=$(brew --prefix)

# Build and install darktable here
# ../../build.sh --install --build-type Release --prefix ${PWD}

# Check for previous attempt and clean
if [[ -d "$buildDir" ]]; then
echo "Deleting directory $buildDir ... "
rm -R "$buildDir"
fi

# Create directory
mkdir "$buildDir"
cd "$buildDir"

# Configure build
cmake .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0.1 \
-DCMAKE_CXX_FLAGS=-stdlib=libc++ \
-DCMAKE_OBJCXX_FLAGS=-stdlib=libc++ \
-DBINARY_PACKAGE_BUILD=ON \
-DRAWSPEED_ENABLE_LTO=ON \
-DBUILD_CURVE_TOOLS=ON \
-DBUILD_NOISE_TOOLS=ON \
-DDONT_USE_INTERNAL_LUA=OFF \
-DBUILD_SSE2_CODEPATHS=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DUSE_COLORD=OFF \
-DUSE_KWALLET=OFF \
-DBUILD_CMSTEST=OFF \
-DCMAKE_INSTALL_PREFIX="$scriptDir"

# Build using all available cores
make -j"$(sysctl -n hw.ncpu)"

# Install
make install
25 changes: 25 additions & 0 deletions packaging/macosx/2_build_hb_darktable_default.sh
@@ -0,0 +1,25 @@
#!/bin/bash
#
# Script to build and install darktable with default configuration
#

# Exit in case of error
set -e -o pipefail
trap 'echo "${BASH_SOURCE[0]}{${FUNCNAME[0]}}:${LINENO}: Error: command \`${BASH_COMMAND}\` failed with exit code $?"' ERR

# Go to directory of script
scriptDir=$(dirname "$0")
cd "$scriptDir"/
scriptDir=$(pwd)

# Set variables
buildDir="../../build"

# Check for previous attempt and clean
if [[ -d "$buildDir" ]]; then
echo "Deleting directory $buildDir ... "
rm -R "$buildDir"
fi

# Clean build and install darktable here
../../build.sh --install --build-type Release --prefix "$scriptDir"