From 846bb31d43dbcf3a719b9a63f0f2058c14b63f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 29 Aug 2024 13:56:11 +0200 Subject: [PATCH] Install imagemagick v7 --- conf/systemd.service | 2 +- manifest.toml | 7 +++++++ scripts/_common.sh | 36 ++++++++++++++++++++++++++++++++++++ scripts/install | 3 +++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index d4aa3b3..1a57b4b 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -14,7 +14,7 @@ Environment=RAILS_ENV=production Environment=UNICORN_SIDEKIQS=1 Environment=LD_PRELOAD=__LIBJEMALLOC__ Environment=UNICORN_LISTENER=__INSTALL_DIR__/discourse/tmp/sockets/unicorn.sock -Environment="__YNH_RUBY_LOAD_PATH__" +Environment="__YNH_RUBY_LOAD_PATH__:__MAGICK_PREFIX__/bin" ExecStart=__INSTALL_DIR__/discourse/bin/bundle exec unicorn --config config/unicorn.conf.rb -E production Restart=always RestartSec=10 diff --git a/manifest.toml b/manifest.toml index 137823d..00be1c9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -59,6 +59,13 @@ ram.runtime = "1G" autoupdate.strategy = "latest_github_tag" autoupdate.upstream = "https://github.com/jonmbake/discourse-ldap-auth" + [resources.sources.imagemagickv7] + url = "https://github.com/ImageMagick/ImageMagick/archive/7.1.0-62.tar.gz" + sha256 = "d282117bc6d0e91ad1ad685d096623b96ed8e229f911c891d83277b350ef884a" + + autoupdate.strategy = "latest_github_tag" + autoupdate.upstream = "https://github.com/ImageMagick/ImageMagick" + [resources.system_user] [resources.install_dir] diff --git a/scripts/_common.sh b/scripts/_common.sh index ef6a49a..41f92a5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -55,6 +55,42 @@ check_memory_requirements_upgrade() { fi } +magick_prefix="$install_dir/imagemagick" +# See https://github.com/discourse/discourse_docker/blob/main/image/base/install-imagemagick +install_imagemagick() { + ynh_setup_source --source_id="imagemagickv7" --dest_dir="$install_dir/imagemagick_source" + mkdir -p "$magick_prefix" + chown -R "$app:$app" "$install_dir/imagemagick_source" "$magick_prefix" + + pushd "$install_dir/imagemagick_source" + ynh_exec_as "$app" CFLAGS="-O2 -I$magick_prefix/include -Wno-deprecated-declarations" \ + ./configure \ + --prefix="$magick_prefix" \ + --enable-static \ + --enable-bounds-checking \ + --enable-hdri \ + --enable-hugepages \ + --with-threads \ + --with-modules \ + --with-quantum-depth=16 \ + --without-magick-plus-plus \ + --with-bzlib \ + --with-zlib \ + --without-autotrace \ + --with-freetype \ + --with-jpeg \ + --without-lcms \ + --with-lzma \ + --with-png \ + --with-tiff \ + --with-heic \ + --with-rsvg \ + --with-webp + ynh_exec_as "$app" make all -j"$(nproc)" + ynh_exec_as "$app" LIBTOOLFLAGS=-Wnone make install + popd +} + ynh_maintenance_mode_ON () { # Create an html to serve as maintenance notice echo " diff --git a/scripts/install b/scripts/install index f6628ff..d1f97f2 100644 --- a/scripts/install +++ b/scripts/install @@ -49,6 +49,9 @@ ynh_script_progression --message="Installing NodeJS..." ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +ynh_script_progression --message="Building and installing ImageMagick v7..." +install_imagemagick + #================================================= # CONFIGURE A POSTGRESQL DATABASE #=================================================