From a0ed89ce0d267749ce3a845be5e11bf9e0a391e5 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 27 Dec 2018 12:50:00 +0100 Subject: [PATCH] Add source patch to fix ARM compatibility --- scripts/install | 16 ++++++------- scripts/upgrade | 22 +++++++---------- ...i_racer-dependencies-for-ARM-compati.patch | 24 +++++++++++++++++++ 3 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch diff --git a/scripts/install b/scripts/install index 9a25b25..abbb637 100644 --- a/scripts/install +++ b/scripts/install @@ -90,6 +90,14 @@ CREATE EXTENSION IF NOT EXISTS hstore; CREATE EXTENSION IF NOT EXISTS pg_trgm;" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +# Specific actions on ARM architecture +if [ -n "$(uname -m | grep arm)" ] ; then + # Unapply commit cf9b4a789b855b5199e98a13424e409854a8e848 that breaks ARM + # compatibility by pointing to a recent libv8 version + # This is due to this libv8 issue (https://github.com/cowboyd/libv8/issues/261) + # that prevents it from being compiled on ARM hence no binary gem is available yet + cp ../sources/patches_arm/* ../sources/patches +fi # Download, check integrity, uncompress and patch the source from app.src # Use the patch from https://meta.discourse.org/t/uglifier-error-during-assets-precompile/96970/4 to fix the Uglifier error @@ -198,14 +206,6 @@ if [ -n "$(uname -m | grep arm)" ] ; then # Define the platform specifically to retrieve binaries # for libv8 because it currently doesn't compile on ARM devices exec_login_as $app bundle config specific_platform arm-linux - # Unapply commit cf9b4a789b855b5199e98a13424e409854a8e848 that breaks ARM - # compatibility by pointing to a recent libv8 version - # This is due to this libv8 issue (https://github.com/cowboyd/libv8/issues/261) - # that prevents it from being compiled on ARM hence no binary gem is available yet - (cd $final_path - wget https://github.com/discourse/discourse/commit/cf9b4a789b855b5199e98a13424e409854a8e848.diff -O libv8-patch.diff - patch -R -p1 < libv8-patch.diff - rm libv8-patch.diff) fi # Install dependencies exec_login_as $app MAKEFLAGS=-j2 bundle install --jobs 2 --path vendor/bundle --with development diff --git a/scripts/upgrade b/scripts/upgrade index b5699f5..1418e1b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,7 +90,14 @@ if ! ynh_is_upstream_up_to_date ; then #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= - + # Specific actions on ARM architecture + if [ -n "$(uname -m | grep arm)" ] ; then + # Unapply commit cf9b4a789b855b5199e98a13424e409854a8e848 that breaks ARM + # compatibility by pointing to a recent libv8 version + # This is due to this libv8 issue (https://github.com/cowboyd/libv8/issues/261) + # that prevents it from being compiled on ARM hence no binary gem is available yet + cp ../sources/patches_arm/* ../sources/patches + fi ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" @@ -136,7 +143,7 @@ if ! ynh_is_upstream_up_to_date ; then # Don't notify on new versions (handled by the YunoHost package) ynh_replace_string "new_version_emails = true" "new_version_emails = false" "$discourse_config_file" - + # Calculate and store the config file checksum ynh_store_file_checksum "$discourse_config_file" @@ -175,17 +182,6 @@ if ! ynh_is_upstream_up_to_date ; then gem install bundler # Install without documentation exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc" - # Specific actions on ARM architecture - if [ -n "$(uname -m | grep arm)" ] ; then - # Unapply commit cf9b4a789b855b5199e98a13424e409854a8e848 that breaks ARM - # compatibility by pointing to a recent libv8 version - # This is due to this libv8 issue (https://github.com/cowboyd/libv8/issues/261) - # that prevents it from being compiled on ARM hence no binary gem is available yet - (cd $final_path - wget https://github.com/discourse/discourse/commit/cf9b4a789b855b5199e98a13424e409854a8e848.diff -O libv8-patch.diff - patch -R -p1 < libv8-patch.diff - rm libv8-patch.diff) - fi # Install dependencies exec_login_as $app bundle install --path vendor/bundle --with development) # On ARM architecture, replace bundled libpsl by system native libpsl diff --git a/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch b/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch new file mode 100644 index 0000000..a1f830f --- /dev/null +++ b/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch @@ -0,0 +1,24 @@ +diff --git a/Gemfile.lock b/Gemfile.lock +index 5752044b07..016f600bcc 100644 +--- a/Gemfile.lock ++++ b/Gemfile.lock +@@ -171,7 +171,7 @@ GEM + jwt (1.5.6) + kgio (2.11.2) + kramdown (1.17.0) +- libv8 (6.7.288.46.1) ++ libv8 (6.3.292.48.1) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) +@@ -198,8 +198,8 @@ GEM + method_source (0.8.2) + mini_mime (1.0.0) + mini_portile2 (2.3.0) +- mini_racer (0.2.0) +- libv8 (>= 6.3) ++ mini_racer (0.1.15) ++ libv8 (~> 6.3) + mini_scheduler (0.8.1) + mini_sql (0.1.10) + mini_suffix (0.3.0)