From 17f3185afdb5acbb3387d368ce041ef4f8b126e8 Mon Sep 17 00:00:00 2001 From: Per Jensen Date: Sat, 9 Jul 2022 14:57:53 +0200 Subject: [PATCH] help out @springm (DT4 on 20.04) --- 20.04/DT400/DT400_compile.sh | 23 +++++++ 20.04/DT400/_compile.sh | 115 ++++++++++++++++++++++++++++++++++ 20.04/DT400/envvars | 10 +++ 20.04/DT400/install_in_vm.sh | 40 ++++++++++++ 20.04/DT400/master_compile.sh | 20 ++++++ README.md | 13 +++- 6 files changed, 219 insertions(+), 2 deletions(-) create mode 100755 20.04/DT400/DT400_compile.sh create mode 100755 20.04/DT400/_compile.sh create mode 100644 20.04/DT400/envvars create mode 100755 20.04/DT400/install_in_vm.sh create mode 100755 20.04/DT400/master_compile.sh diff --git a/20.04/DT400/DT400_compile.sh b/20.04/DT400/DT400_compile.sh new file mode 100755 index 0000000..c03a16c --- /dev/null +++ b/20.04/DT400/DT400_compile.sh @@ -0,0 +1,23 @@ +#!/bin/bash +## +## Author: Per Jensen +## Contact: per2jensen@gmail.com +## Licensed under the Apache License 2.0 +## + +source envvars + +# Change this if you want to run the compile script directly on your machine +# Release to use +export RELEASE=release-4.0.0 + +export VERSION=$(echo $RELEASE|grep -E -o '\-.*') +export INSTALL_PREFIX="$HOME/programmer/darktable${VERSION}" + +# Folder which already contains a darktable git checkout or should be used for a fresh one +export DT_SRC_FOLDER="$HOME/git/darktable" + +# the code name for Ubuntu used in LLVM's repos +export CODENAME_LLVM="focal" + +"./$_COMPILE" diff --git a/20.04/DT400/_compile.sh b/20.04/DT400/_compile.sh new file mode 100755 index 0000000..962e130 --- /dev/null +++ b/20.04/DT400/_compile.sh @@ -0,0 +1,115 @@ +#! /bin/bash + +source envvars + +######################### +# don't change below +######################### +echo user compiling: +id +# install loads of dependencies +echo Fetch llvm-snapshot-gpg.key +curl https://apt.llvm.org/llvm-snapshot.gpg.key|gpg --dearmor > llvm-snapshot-keyring.gpg +if [ $? != "0" ] +then + echo "Downloading llvm gpg key failed, exiting" && exit +fi +sudo mv llvm-snapshot-keyring.gpg /usr/share/keyrings/ + +sudo sh -c "echo deb [signed-by=/usr/share/keyrings/llvm-snapshot-keyring.gpg] http://apt.llvm.org/${CODENAME_LLVM}/ llvm-toolchain-${CODENAME_LLVM} main > /etc/apt/sources.list.d/llvm.list" +sudo sh -c "echo deb-src [signed-by=/usr/share/keyrings/llvm-snapshot-keyring.gpg] http://apt.llvm.org/${CODENAME_LLVM}/ llvm-toolchain-${CODENAME_LLVM} main > /etc/apt/sources.list.d/llvm-src.list" +sudo apt update && sudo apt upgrade -y + +sudo apt install -y lld-12 llvm-12-dev llvm-12-runtime llvm-12 lldb-12 python3-lldb-12 \ + clang-12 clang-format-12 clang-tidy-12 clang-tools-12 python3-clang-12 \ + libc++-12-dev libc++1-12 \ + libc++abi-12-dev libc++abi1-12 \ + libclang-12-dev libclang1-12 liblldb-12-dev libllvm-12-ocaml-dev libomp-12-dev libomp5-12 \ + libopencl-clang-dev libopencl-clang10 opencl-c-headers opencl-headers libclang-common-12-dev nvidia-opencl-dev ocl-icd-opencl-dev \ + intltool cmake +if [ $? != "0" ] +then + echo "1: Package installation failed, exiting" && exit +fi + +sudo apt install -y libxml2-utils xsltproc libsaxon-java libpthread-workqueue0 libpthread-workqueue-dev \ + libc6-dev libglib2.0-dev \ + liblensfun-dev libcurl4-openssl-dev libjpeg8-dev libtiff-dev liblcms2-dev libjson-glib-dev \ + libgtk-3-0 libgtk-3-dev libxml2-dev libxml2 librsvg2-2 librsvg2-dev libsqlite3-dev \ + libexiv2-dev libpugixml-dev lua5.3 liblua5.3-0 liblua5.3-dev libgphoto2-6 libgphoto2-dev colord libcolord-dev \ + libgraphicsmagick1-dev imagemagick libmagick++-6.q16-dev libopenexr-dev libopenexr24 desktop-file-utils libgmic-dev +if [ $? != "0" ] +then + echo "2: Package installation failed, exiting" && exit +fi + +sudo apt install -y libflickcurl-dev libraptor2-dev libopenjp2-7-dev libopenjp2-7 libosmgpsmap-1.0-dev libosmgpsmap-1.0-1 \ + libcolord-gtk-dev libcolord-gtk1 libcups2-dev libcups2 \ + libavifile-0.7-bin libavifile-0.7-dev libavifile-0.7-common libavifile-0.7c2 \ + libsecret-1-dev libsecret-1-0 \ + libimage-exiftool-perl + +if [ $? != "0" ] +then + echo "3: Package installation failed, exiting" && exit +fi + +sudo apt install -y dh-make debhelper libheif-dev libportmidi-dev libsdl2-dev + +if [ $? != "0" ] +then + echo "4: Package installation failed, exiting" && exit +fi + +# see here: https://github.blog/2022-04-12-git-security-vulnerability-announced/ +# if installing outside $HOME, prefix next line with sudo +git config --global --add safe.directory "${DT_SRC_FOLDER}" + +if [[ -d "$DT_SRC_FOLDER" ]]; then + rm -fr "${DT_SRC_FOLDER}" +fi + +git clone https://github.com/darktable-org/darktable.git "$DT_SRC_FOLDER" 2>&1|tee -a "$LOG" +if [[ "${PIPESTATUS[0]}" != "0" ]]; then + echo \"git clone\" failed, exiting + exit 1 +fi + +cd "$DT_SRC_FOLDER" +git checkout "${RELEASE}" 2>&1|tee -a "$LOG" +if [[ "${PIPESTATUS[0]}" != "0" ]]; then + echo \"git checkout\" failed, exiting + exit 1 +fi + +git submodule init 2>&1|tee -a "$LOG" +if [[ "${PIPESTATUS[0]}" != "0" ]]; then + echo \"git submodule init\" failed, exiting + exit 1 +fi + +git submodule update 2>&1|tee -a "$LOG" +if [[ "${PIPESTATUS[0]}" != "0" ]]; then + echo \"git sumodule update\" failed, exiting + exit 1 +fi + +# build darktable +mv "${INSTALL_PREFIX}" "${INSTALL_PREFIX}"-org +./build.sh --prefix "${INSTALL_PREFIX}" 2>&1|tee -a "$LOG" +if [ "${PIPESTATUS[0]}" != "0" ] +then + echo "Build failed, exiting" && exit +fi + + +#install darktable +# if installing outside $HOME, prefix next line with sudo +cmake --build "$DT_SRC_FOLDER/build" --target install -- -j1 2>&1 |tee -a "$LOG" +if [ "${PIPESTATUS[0]}" != "0" ] +then + echo "Installation failed, exiting" && exit +fi + +# print --version info +"${INSTALL_PREFIX}/bin/darktable" --version 2>&1|tee -a "$LOG" diff --git a/20.04/DT400/envvars b/20.04/DT400/envvars new file mode 100644 index 0000000..5ddcae7 --- /dev/null +++ b/20.04/DT400/envvars @@ -0,0 +1,10 @@ +#! /bin/bash + +LOG="$HOME/DT40.log" + +VM_NAME=ubuntu2004-DTcompile +VM_SIZE=15G +VM_IMAGE=20.04 +DT_COMPILE_SCRIPT=DT400_compile.sh +_COMPILE=_compile.sh + diff --git a/20.04/DT400/install_in_vm.sh b/20.04/DT400/install_in_vm.sh new file mode 100755 index 0000000..79e052e --- /dev/null +++ b/20.04/DT400/install_in_vm.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +## +## Author: Per Jensen +## Contact: per2jensen@gmail.com +## Licensed under the Apache License 2.0 +## + +source envvars + +# check if VM exists and is running +multipass list |grep -E ${VM_NAME} +if [ $? == "0" ] +then + multipass info ${VM_NAME} |grep -E "State.*?Running" + if [ $? != "0" ] + then + multipass start ${VM_NAME} + fi + multipass info ${VM_NAME} |grep -E "State.*?Running" + if [ $? != "0" ] + then + echo "VM: ${VM_NAME}" does not start, exiting + exit 1 + fi +else + # create the VM + multipass launch -n ${VM_NAME} -d ${VM_SIZE} ${VM_IMAGE} + if [ $? != "0" ] + then + echo "VM: ${VM_NAME}" does not start, exiting + exit 1 + fi +fi + +echo update OS and start compiling Darktable in virtual machine ${VM_NAME} +multipass transfer ${DT_COMPILE_SCRIPT} ${_COMPILE} envvars ${VM_NAME}: +multipass exec ${VM_NAME} -- chmod u+x ${DT_COMPILE_SCRIPT} ${_COMPILE} +# in VM: install dependencies, compile and install, then print DT's --version info +multipass exec ${VM_NAME} -- ./${DT_COMPILE_SCRIPT} diff --git a/20.04/DT400/master_compile.sh b/20.04/DT400/master_compile.sh new file mode 100755 index 0000000..35e6f77 --- /dev/null +++ b/20.04/DT400/master_compile.sh @@ -0,0 +1,20 @@ +#!/bin/bash +## +## Author: Per Jensen +## Contact: per2jensen@gmail.com +## Licensed under the Apache License 2.0 +## + +# Change this if you want to run the compile script directly on your machine +INSTALL_PREFIX="$HOME/programmer/darktable-master" + +# Folder which already contains a darktable git checkout or should be used for a fresh one +DT_SRC_FOLDER="$HOME/git/darktable" + +# the code name for Ubuntu used in LLVM's repos +CODENAME_LLVM="jammy" + +# Branch to use +BRANCH=master + +source ./_compile.sh diff --git a/README.md b/README.md index 2ddd1c6..7b3a9f6 100644 --- a/README.md +++ b/README.md @@ -71,14 +71,23 @@ compile options: chmod u+x install_in_vm.sh ./install_in_vm.sh - -If you have an old VM lying around and want to start from a fresh, do this. + If you have an old VM lying around and want to start from a fresh, do this. multipass stop ubuntu2204-DTcompile multipass delete ubuntu2204-DTcompile multipass purge +# Experimental compile of DT 4.0.0 on Ubuntu 20.04 + I have added an experimental DT 4.0.0 to Ubuntu 20.04 + + Issues: + - Lua support missing, 20.04 does not satisfy DT4 + - .heif support probably missing + - exiv2 support a bit flaky ("no support for ISOBMFF files (CR3, AVIF, HEIF)" + + + ## Build on your machine Once you are happy that things work in the VM, consider changing the compile script to your liking (set the INSTALL_PREFIX env variable in 22-04/DT400/DT400_compile.sh)