Browse Source

fix gnu linux zip generation

zplugins_osx
Alexandros Theodotou 2 years ago
parent
commit
6d23598647
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 6
      gnu-linux/README.in
  2. 33
      gnu-linux/installer.sh.in
  3. 79
      gnu-linux/make_installer_zip.sh.in
  4. 59
      gnu-linux/meson.build
  5. 9
      meson.build
  6. 10
      meson_options.txt
  7. 11
      mingw-meson/0002-Default-to-sys.prefix-as-the-default-prefix.patch
  8. 33
      mingw-meson/0003-Strip-the-prefix-from-all-paths-when-installing-with.patch
  9. 11
      mingw-meson/color-term.patch
  10. 11
      mingw-meson/install-man.patch
  11. 2
      osx-brew/make_zip.sh.in
  12. 2
      osx-brew/meson.build
  13. 42
      scripts/get_pkg_filename_from_distro.sh.in
  14. 7
      scripts/meson.build
  15. 132
      tools/gen_installer.sh

6
README.in → gnu-linux/README.in

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Thank you for supporting Zrythm!
Thank you for @SUPPORTING_TEXT@ Zrythm!
This is Zrythm v@VERSION@.
This is Zrythm v@ZRYTHM_PKG_VERSION@.
To install Zrythm, open a terminal and
navigate to this directory, then run
@ -13,7 +13,7 @@ If you prefer to install the packages @@ -13,7 +13,7 @@ If you prefer to install the packages
manually, you can find them inside `bin`.
If you experience any problems, please
email alex@_AT_@zrythm.org
email alex@EMAIL_AT_SYM@zrythm.org
This installer is offered as-is, without
any warranty.

33
installer.sh.in → gnu-linux/installer.sh.in

@ -19,10 +19,9 @@ @@ -19,10 +19,9 @@
set -e
zrythm_ver="@VERSION@"
zplugins_ver="@ZPLUGINS_VERSION@"
zrythm_ver="@ZRYTHM_PKG_VERSION@"
architecture="amd64"
trial="@TRIAL@"
trial="@DASH_TRIAL@"
distro_identifier=""
@ -79,7 +78,7 @@ fi @@ -79,7 +78,7 @@ fi
# ---- Detect arch systems ----
arch_str="Arch GNU/Linux"
arch_str="Arch Linux"
if [[ "$ID" = "arch" ]] || [[ "$ID_LIKE" = *"arch"* ]]; then
echo "found $arch_str"
@ -171,29 +170,3 @@ if [ $proceed -ne 0 ]; then @@ -171,29 +170,3 @@ if [ $proceed -ne 0 ]; then
print_install_success
fi
fi
proceed=0
proceed_txt="Proceed with the installation of ZPlugins v$zplugins_ver?"
if [ $have_zenity -ne 0 ]; then
zenity --question --text="$proceed_txt" --width $zenity_width
if [ $? -eq 0 ]; then
proceed=1
fi
else
read -p "$proceed_txt (type Y or y): " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
proceed=1
fi
fi
# install plugins
if [ $proceed -ne 0 ]; then
ask_for_root_pw;
libdir="lib"
if [[ $distro_identifier = "fedora"* ]]; then
libdir="lib64"
fi
sudo /bin/sh -c \
"cp -R \"bin/$zplugins/\"* /usr/$libdir/lv2/"
print_install_success
fi

79
gnu-linux/make_installer_zip.sh.in

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
#! /bin/bash
set -e
out_file=$1
private_dir=$2
installer_sh=$3
readme=$4
# dir holding each package
packages_dir="@PACKAGES_DIR@"
distros="archlinux debian10 debian11 ubuntu1804 ubuntu2004 ubuntu2010 fedora31 fedora32"
get_pkg_filename_from_distro_sh="@MESON_BUILD_ROOT@/scripts/get_pkg_filename_from_distro.sh"
zip_filename=`basename $out_file`
zip_inner_dir_name="${zip_filename%.*}"
zip_inner_dir="$private_dir/$zip_inner_dir_name"
zrythm_version="@ZRYTHM_PKG_VERSION@"
pdf_dir="@PDF_DIR@"
rm -rf $out_file
rm -rf $private_dir
mkdir -p $zip_inner_dir
# returns the built package filename
get_package_filename () {
distro=$1
set +u
trial=$2
set -u
$get_pkg_filename_from_distro_sh $distro $trial
}
# returns the filename to be placed inside "bin"
get_dest_package_filename () {
prefix="zrythm-$zrythm_version"
distro=$1
res=""
case "$distro" in
"debian10" | "ubuntu"*)
res="$prefix-1_amd64.deb"
;;
"archlinux")
res="$prefix-1_x86_64.pkg.tar.zst"
;;
"fedora"*)
res="$prefix-1_x86_64.rpm"
esac
echo $res
}
copy_package () {
distro=$1
src_pkg_filename="$(get_package_filename $distro)"
dest_pkg_filename="$(get_dest_package_filename $distro)"
distro_bin_dir="$zip_inner_dir/bin/$distro"
mkdir -p "$distro_bin_dir"
cp "$packages_dir/$distro/$src_pkg_filename" \
"$distro_bin_dir/$dest_pkg_filename"
}
for distro in $distros ; do
echo "copying packages for $distro..."
copy_package $distro
echo "done"
done
pdf=""
if [ "@TRIAL_TRUE_FALSE@" = "false" ]; then
pdf="$(ls $pdf_dir/Zrythm-*.pdf)"
fi
echo "zipping installer..."
cp -R $pdf $installer_sh $readme $zip_inner_dir/
pushd $private_dir
zip -r $zip_inner_dir_name.zip $zip_inner_dir_name
popd
cp $zip_inner_dir.zip $out_file
echo "done"

59
gnu-linux/meson.build

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
# Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of Zrythm
#
# Zrythm is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Zrythm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
gnu_linux_zip_conf = configuration_data ()
gnu_linux_zip_conf.merge_from (global_conf)
# configure scripts
make_installer_zip_sh = configure_file (
output: 'make_installer_zip.sh',
input: 'make_installer_zip.sh.in',
configuration: gnu_linux_zip_conf,
)
# configure installer script and README
installer_sh = configure_file (
output: 'installer.sh',
input: 'installer.sh.in',
configuration: gnu_linux_zip_conf,
)
readme = configure_file (
output: 'README',
input: 'README.in',
configuration: gnu_linux_zip_conf,
)
installer_zip_filename = run_command (
get_pkg_filename_from_distro, get_option ('distro')).stdout ().strip ()
installer_zip = custom_target (
'gnu-linux-installer-zip',
output: installer_zip_filename,
input: [
make_zip_sh, installer_sh, readme,
],
command: [
make_zip_sh, '@OUTPUT@', '@PRIVATE_DIR@',
'@INPUT1@', '@INPUT2@',
],
install: true,
install_dir: get_option ('prefix'),
)
run_target (
'gnu-linux',
command: [ 'echo', 'done' ],
depends: installer_zip)

9
meson.build

@ -69,6 +69,7 @@ is_nixos = distro.contains ('nixos') @@ -69,6 +69,7 @@ is_nixos = distro.contains ('nixos')
is_rpm = distro.contains ('fedora')
is_windows_msys = distro.contains ('windows10-msys')
is_osx_brew = distro.contains ('osx-brew')
is_gnu_linux = distro.contains ('gnu-linux')
global_conf = configuration_data ()
global_conf.set ('PREFIX', prefix)
@ -141,6 +142,10 @@ global_conf.set ( @@ -141,6 +142,10 @@ global_conf.set (
global_conf.set (
'SUPPORTING_TEXT', build_trial ? 'supporting' : 'trying out')
global_conf.set ('EMAIL_AT_SYM', '@')
global_conf.set (
'PACKAGES_DIR', get_option ('packages-dir'))
global_conf.set (
'PDF_DIR', get_option ('pdf-dir'))
subdir ('scripts')
subdir ('sources')
@ -207,3 +212,7 @@ endif @@ -207,3 +212,7 @@ endif
if is_osx_brew
subdir ('osx-brew')
endif
if is_gnu_linux
subdir ('gnu-linux')
endif

10
meson_options.txt

@ -106,3 +106,13 @@ option ( @@ -106,3 +106,13 @@ option (
'breeze-dark-path', type: 'string',
value: '/Users/alex/.local/share/icons/breeze-dark',
description: 'Breeze dark icons path')
option (
'packages-dir', type: 'string',
value: '/tmp/packages',
description: 'Dir holding each package (for GNU/Linux zip)')
option (
'pdf-dir', type: 'string',
value: '/tmp/pdf',
description: 'Dir holding each manual PDF (for GNU/Linux zip)')

11
mingw-meson/0002-Default-to-sys.prefix-as-the-default-prefix.patch

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
--- meson-0.54.0/mesonbuild/mesonlib.py.orig 2020-03-30 08:16:34.854854700 +0200
+++ meson-0.54.0/mesonbuild/mesonlib.py 2020-03-30 08:16:45.815838600 +0200
@@ -736,6 +736,8 @@
def default_prefix() -> str:
+ if is_windows() and 'MSYSTEM' in os.environ:
+ return sys.prefix
return 'c:/' if is_windows() else '/usr/local'

33
mingw-meson/0003-Strip-the-prefix-from-all-paths-when-installing-with.patch

@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
Strip the prefix from all paths when installing with DESTDIR
Otherwise we end up with <destdir>/<prefix>/<path>
--- meson-0.47.0/mesonbuild/scripts/__init__.py
+++ meson-0.47.0/mesonbuild/scripts/__init__.py
@@ -12,7 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
+from ..mesonlib import is_windows
+
def destdir_join(d1, d2):
+ # When the installation path starts with PREFIX, strip it away
+ if d1 and is_windows() and 'MSYSTEM' in os.environ:
+ assert os.path.isabs(d2) and 'MESON_INSTALL_PREFIX' in os.environ
+ prefix = os.environ['MESON_INSTALL_PREFIX']
+ rel_to_prefix = os.path.relpath(d2, prefix)
+ if not rel_to_prefix.startswith(os.pardir + os.sep):
+ return os.path.join(d1, rel_to_prefix)
+
# c:\destdir + c:\prefix must produce c:\destdir\prefix
if len(d1) > 1 and d1[1] == ':' \
and len(d2) > 1 and d2[1] == ':':
--- meson-0.47.0/mesonbuild/minstall.py.orig
+++ meson-0.47.0/mesonbuild/minstall.py
@@ -286,6 +286,7 @@
with open(datafilename, 'rb') as ifile:
d = pickle.load(ifile)
d.destdir = os.environ.get('DESTDIR', '')
+ os.environ['MESON_INSTALL_PREFIX'] = d.prefix
d.fullprefix = destdir_join(d.destdir, d.prefix)
if d.install_umask is not None:

11
mingw-meson/color-term.patch

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
--- meson-0.50.1/mesonbuild/mlog.py.orig 2019-03-06 21:48:10.000000000 +0100
+++ meson-0.50.1/mesonbuild/mlog.py 2019-04-17 17:46:10.229092600 +0200
@@ -31,7 +31,7 @@
stdout = kernel.GetStdHandle(-11)
mode = DWORD()
if not kernel.GetConsoleMode(stdout, byref(mode)):
- return False
+ return os.isatty(sys.stdout.fileno())
# ENABLE_VIRTUAL_TERMINAL_PROCESSING == 0x4
# If the call to enable VT processing fails (returns 0), we fallback to
# original behavior

11
mingw-meson/install-man.patch

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
--- meson-0.48.0/setup.py.orig 2018-09-22 15:22:03.000000000 +0200
+++ meson-0.48.0/setup.py 2018-09-23 13:48:10.509756600 +0200
@@ -36,7 +36,7 @@
'mesonbuild.scripts',
'mesonbuild.wrap']
data_files = []
-if sys.platform != 'win32':
+if sys.platform != 'win32' or 1:
# Only useful on UNIX-like systems
data_files = [('share/man/man1', ['man/meson.1']),
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])]

2
osx-brew/make_zip.sh.in

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
#!@BASH@
set -ex
set -e
out_file="$1"
zrythm_formula_file=$2

2
osx-brew/meson.build

@ -126,7 +126,7 @@ installer_zip = custom_target ( @@ -126,7 +126,7 @@ installer_zip = custom_target (
input: [
make_zip_sh, zrythm_formula,
carla_bottle, installer_sh,
readme,
readme, zrythm_bottle,
],
command: [
make_zip_sh, '@OUTPUT@',

42
scripts/get_pkg_filename_from_distro.sh.in

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
#!@BASH@
# distro (eg, debian10)
distro="$1"
# "-trial" if trial
trial="$2"
zrythm_pkg_ver="@ZRYTHM_PKG_VERSION@"
get_pkg_filename_sh="@GET_PKG_FILENAME_SH_PATH@"
distro_to_pkg_type () {
distro=$1
case "$distro" in
"archlinux")
echo "ARCH"
;;
"debian"* | "ubuntu"* )
echo "DEBIAN"
;;
"fedora"*)
echo "FEDORA"
;;
"windows10")
echo "WINDOWS"
;;
"windows10-msys")
echo "WINDOWS_MSYS"
;;
"osx" | "macos"*)
echo "OSX"
;;
"osx-brew-zip")
echo "OSX_BREW_ZIP"
;;
"gnu-linux")
echo "GNU_LINUX"
;;
esac
}
pkg_type=$(distro_to_pkg_type $distro)
$get_pkg_filename_sh $pkg_type

7
scripts/meson.build

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
scripts_conf = configuration_data ()
scripts_conf.merge_from (global_conf)
scripts_conf.set ('SCRIPTS_DIR', meson.current_build_dir ())
scripts_conf.set ('GET_PKG_FILENAME_SH_PATH', meson.current_build_dir () / 'get_pkg_filename.sh')
# configure each script
make_windows_chroot = configure_file (
@ -92,6 +93,12 @@ get_pkg_filename = configure_file ( @@ -92,6 +93,12 @@ get_pkg_filename = configure_file (
configuration: scripts_conf,
)
get_pkg_filename_from_distro = configure_file (
output: 'get_pkg_filename_from_distro.sh',
input: 'get_pkg_filename_from_distro.sh.in',
configuration: scripts_conf,
)
make_zplugins = configure_file (
output: 'make_zplugins.sh',
input: 'make_zplugins.sh.in',

132
tools/gen_installer.sh

@ -1,132 +0,0 @@ @@ -1,132 +0,0 @@
#! /bin/bash
set -e
# args:
# 1: zrythm version
# 2: installer zip filename
# 3: zplugins version
# 4: `-trial` if trial, otherwise empty
zrythm_version=$1
installer_zip=$2
zplugins_version=$3
trial=$4
distros="archlinux debian10 debian11 ubuntu1804 ubuntu2004 ubuntu2010 fedora31 fedora32"
rm -rf $installer_zip
sed -i -e "s/ZRYTHM_PKG_VERSION=.*/ZRYTHM_PKG_VERSION=$zrythm_version/" Makefile
is_trial () {
[ "$trial" = "-trial" ]
}
copy_plugins () {
distro=$1
src_dir=artifacts/$distro/zplugins
dest_dir=bin/$distro/zplugins
mkdir -p $dest_dir
# copy common
for plugin in ZCompressorSP.lv2 ZLimiterSP.lv2 ZPhaserSP.lv2 ZSaw.lv2 ZVerbSP.lv2 ; do
cp -Rf $src_dir/$plugin $dest_dir/
done
# copy remaining if not trial
if ! is_trial ; then
for plugin in ZChordz.lv2 ZLFO.lv2 ; do
cp -Rf $src_dir/$plugin $dest_dir/
done
fi
}
# returns the built package filename
get_package_filename () {
search_str=""
distro=$1
case "$distro" in
"debian"* | "ubuntu"*)
search_str="DEBIAN"
;;
"archlinux")
search_str="ARCH"
;;
"fedora"*)
search_str="FEDORA"
;;
esac
if is_trial ; then
echo "$(make --no-print-directory -s pkg-trial-filename-$search_str)"
else
echo "$(make --no-print-directory -s pkg-filename-$search_str)"
fi
}
# returns the filename to be placed inside "bin"
get_dest_package_filename () {
prefix="zrythm-$zrythm_version"
distro=$1
res=""
case "$distro" in
"debian10" | "ubuntu"*)
res="$prefix-1_amd64.deb"
;;
"archlinux")
res="$prefix-1_x86_64.pkg.tar.zst"
;;
"fedora"*)
res="$prefix-1_x86_64.rpm"
esac
echo $res
}
copy_package () {
distro=$1
src_pkg_file="$(get_package_filename $distro)"
dest_pkg_file="$(get_dest_package_filename $distro)"
cp "artifacts/$distro/$src_pkg_file" "bin/$distro/$dest_pkg_file"
}
echo "removing previous backup (if any)"
# remove prev backup
rm -rf bin.bak
mv bin bin.bak || true
for distro in $distros ; do
mkdir -p bin/$distro
echo "copying plugins for $distro..."
copy_plugins $distro
echo "done"
echo "copying packages for $distro..."
copy_package $distro
echo "done"
done
#cp artifacts/debian9/Zrythm$(2)-$(ZRYTHM_PKG_VERSION)-x86_64.AppImage \
#Zrythm$(2)-$(ZRYTHM_PKG_VERSION)-x86_64.AppImage
sed -e "s/@VERSION@/$zrythm_version/" \
-e 's/@_AT_@/@/' < README$trial.in > README
sed -e "s/@VERSION@/$zrythm_version/" \
-e "s/@ZPLUGINS_VERSION@/$zplugins_version/" \
-e "s/@TRIAL@/$trial/" \
< installer.sh.in > installer.sh
chmod +x installer.sh
pdf=""
if ! is_trial ; then
pdf="$(ls Zrythm-*.pdf)"
fi
echo "zipping installer..."
installer_zip_dir=${installer_zip::-4}
mkdir $installer_zip_dir
cp -R $pdf installer.sh README bin $installer_zip_dir/
zip -r $installer_zip $installer_zip_dir
echo "done"
echo "cleaning up..."
#rm -rf README installer.sh *.AppImage $pdf
rm -rf README installer.sh *.AppImage $installer_zip_dir
echo "done"
Loading…
Cancel
Save