Revert "FIXME: this can be rather slow and blocks until the size is known"
[geeqie.git] / geeqie-install-debian.sh
index 6267613..2f08354 100755 (executable)
@@ -8,7 +8,7 @@
 ## Dialogs allow the user to install additional features.
 ##
 
-version="2022-03-18"
+version="2023-03-11"
 description='
 Geeqie is an image viewer.
 This script will download, compile, and install Geeqie on Debian-based systems.
@@ -23,25 +23,27 @@ Command line options are:
 -t --tag=TAG Checkout and compile TAG (e.g. v1.4 or v1.3)
 -b --back=N Checkout commit -N (e.g. "-b 1" for last-but-one commit)
 -l --list List required dependencies
--d --debug=yes Compile with debug output
 '
 
 # Essential for compiling
 essential_array="git
 build-essential
-autoconf
 libglib2.0-0
-intltool
 libtool
-yelp-tools"
+meson
+yelp-tools
+help2man
+doclifter"
 
-# Optional for both GTK2 and GTK3
+# Optional for GTK3
 optional_array="LCMS (for color management)
 liblcms2-dev
 exiv2 (for exif handling)
 libgexiv2-dev
+evince (for print preview)
+evince
 lua (for --remote commands)
-liblua5.1-0-dev
+liblua5.3-dev
 libffmpegthumbnailer (for mpeg thumbnails)
 libffmpegthumbnailer-dev
 libtiff (for tiff support)
@@ -68,8 +70,8 @@ libimage-exiftool-perl (for jpeg extraction plugin)
 libimage-exiftool-perl
 libheif (for HEIF support)
 libheif-dev
-libwebp (for WebP images)
-libwebp-dev
+webp-pixbuf-loader (for WebP images)
+webp-pixbuf-loader
 libdjvulibre (for DjVu images)
 libdjvulibre-dev
 libopenjp2 (for JP2 images)
@@ -79,10 +81,10 @@ libraw-dev
 libomp (required by libraw)
 libomp-dev
 libarchive (for compressed files e.g. zip, including timezone)
-libarchive-dev"
-
-# Optional for GTK3 only
-optional_gtk3_array="libchamplain gtk (for GPS maps)
+libarchive-dev
+libgspell (for spelling checks)
+libgspell-1-dev
+libchamplain gtk (for GPS maps)
 libchamplain-gtk-0.12-dev
 libchamplain (for GPS maps)
 libchamplain-0.12-dev
@@ -203,7 +205,8 @@ install_options()
        then
                OLDIFS=$IFS
                IFS='|'
-               set "$options"
+               # shellcheck disable=SC2086
+               set $options
                while [ $# -gt 0 ]
                do
                        package_install "$1"
@@ -219,7 +222,7 @@ uninstall()
        if [ "$current_dir" = "geeqie" ]
        then
 
-               sudo --askpass make uninstall
+               sudo --askpass  ninja -C build uninstall
 
                if ! zenity --title="Uninstall Geeqie" --width=370 --text="WARNING.\nThis will delete folder:\n\n$PWD\n\nand all sub-folders!" --question --ok-label="Cancel" --cancel-label="OK" 2> /dev/null
                then
@@ -340,11 +343,6 @@ do
                        shift
                        shift
                        ;;
-               -d | --debug)
-                       DEBUG="$2"
-                       shift
-                       shift
-                       ;;
                *)
                        break
                        ;;
@@ -366,13 +364,6 @@ then
                printf '%b\n' "$file"
        done
 
-       printf '\n'
-       printf '%b\n' "Optional for GTK3:"
-       for file in $optional_gtk3_array
-       do
-               printf '%b\n' "$file"
-       done
-
        exit
 fi
 
@@ -401,38 +392,24 @@ else
 fi
 
 # Use GTK3 as default
-gtk2_installed=FALSE
 gtk3_installed=TRUE
 
 if [ "$mode" = "install" ]
 then
-       message="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will download, compile, and install Geeqie source\ncode and its dependencies.\n\nA sub-folder named \"geeqie\" will be created in the\nfolder this script is run from, and the source code\nwill be downloaded to that sub-folder.\n\nIn this dialog you must select whether to compile\nfor GTK2 or GTK3.\nIf you want to use GPS maps or pdf preview,\nyou must choose GTK3.\nThe GTK2 version has a slightly different\nlook-and-feel compared to the GTK3 version,\nbut otherwise has the same features.\nYou may easily switch between the two after\ninstallation.\n\nIn subsequent dialogs you may choose which\noptional features to install."
+       message="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will download, compile, and install Geeqie source\ncode and its dependencies.\n\nA sub-folder named \"geeqie\" will be created in the\nfolder this script is run from, and the source code\nwill be downloaded to that sub-folder.\n\nIn subsequent dialogs you may choose which\noptional features to install."
 
        title="Install Geeqie and dependencies"
        install_option=TRUE
 else
-       message="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will update the Geeqie source code and its\ndependencies, and will compile and install Geeqie.\n\nYou may also switch the installed version from\nGTK2 to GTK3 and vice versa.\n\nIn this dialog you must select whether to compile\nfor GTK2 or GTK3.\nIf you want to use GPS maps or pdf preview,\nyou must choose GTK3.\nThe GTK2 version has a slightly different\nlook-and-feel compared to the GTK3 version,\nbut otherwise has the same features.\n\nIn subsequent dialogs you may choose which\noptional features to install."
+       message="This script is for use on Ubuntu and other\nDebian-based installations.\nIt will update the Geeqie source code and its\ndependencies, and will compile and install Geeqie.\n\nIn subsequent dialogs you may choose which\noptional features to install."
 
        title="Update Geeqie and re-install"
        install_option=FALSE
-
-       # When updating, use previous installation as default
-       if [ -f config.log ]
-       then
-               if grep gtk-2.0 config.log > /dev/null
-               then
-                       gtk2_installed=TRUE
-                       gtk3_installed=FALSE
-               else
-                       gtk2_installed=FALSE
-                       gtk3_installed=TRUE
-               fi
-       fi
 fi
 
-# Ask whether to install GTK2 or GTK3 or uninstall
+# Ask whether to install GTK3 or uninstall
 
-if ! gtk_version=$(zenity --title="$title" --width=370 --text="$message" --list --radiolist --column "" --column "" "$gtk3_installed" "GTK3 (required for GPS maps and pdf preview)" "$gtk2_installed" "GTK2" FALSE "Uninstall" --cancel-label="Cancel" --ok-label="OK" --hide-header 2> /dev/null)
+if ! gtk_version=$(zenity --title="$title" --width=370 --text="$message" --list --radiolist --column "" --column "" "$gtk3_installed" "Install" FALSE "Uninstall" --cancel-label="Cancel" --ok-label="OK" --hide-header 2> /dev/null)
 then
        exit
 fi
@@ -473,7 +450,7 @@ do
                then
                        if [ -z "$option_string" ]
                        then
-                               option_string="${install_option:+${install_option}}\n${file}\n${file}"
+                               option_string="${install_option:+${install_option}}\n${package_title}\n${file}"
                        else
                                option_string="${option_string:+${option_string}}\n$install_option\n${package_title}\n${file}"
                        fi
@@ -482,30 +459,6 @@ do
        i=$((i + 1))
 done
 
-# If GTK3 required, get the GTK3 options not yet installed
-if [ -z "${gtk_version%%GTK3*}" ]
-then
-       i=0
-       for file in $optional_gtk3_array
-       do
-               if [ $((i % 2)) -eq 0 ]
-               then
-                       package_title="$file"
-               else
-                       if package_query "$file"
-                       then
-                               if [ -z "$option_string" ]
-                               then
-                                       option_string="${install_option:+${install_option}}\n${file}\n${file}"
-                               else
-                                       option_string="${option_string:+${option_string}}\n$install_option\n${package_title}\n${file}"
-                               fi
-                       fi
-               fi
-               i=$((i + 1))
-       done
-fi
-
 kill $zen_pid 2> /dev/null
 
 # Ask the user which options to install
@@ -568,10 +521,7 @@ if [ $mode = "install" ]
 then
        cd geeqie || exit 1
 else
-       # shellcheck disable=SC2024
-       sudo --askpass make uninstall >> "$install_log" 2>&1
-       # shellcheck disable=SC2024
-       sudo --askpass make maintainer-clean >> "$install_log" 2>&1
+       sudo --askpass  ninja -C build uninstall
 fi
 
 printf '%b\n' "30" > "$zen_pipe"
@@ -604,44 +554,26 @@ then
                exit
        fi
 fi
-if [ "$DEBUG" = "yes" ]
-then
-       debug_opt=""
-else
-       debug_opt="--disable-debug-log"
-fi
 
 printf '%b\n' "40" > "$zen_pipe"
 printf '%b\n' "#Creating configuration files..." > "$zen_pipe"
 
 if [ -z "${gtk_version%%GTK3*}" ]
 then
-       ./autogen.sh "$debug_opt" >> "$install_log" 2>&1
+       meson setup build
+       printf '%b\n' "90 " > "$zen_pipe"
+       printf '%b\n' "#Installing Geeqie..." > "$zen_pipe"
+       ninja -C build install
 else
-       ./autogen.sh "$debug_opt" --disable-gtk3 >> "$install_log" 2>&1
+       meson setup build
+       meson configure build
+       printf '%b\n' "90 " > "$zen_pipe"
+       printf '%b\n' "#Installing Geeqie..." > "$zen_pipe"
+       ninja -C build install
 fi
 
-printf '%b\n' "60" > "$zen_pipe"
-printf '%b\n' "#Compiling..." > "$zen_pipe"
-
-export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
-export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
-
-if ! make -j >> "$install_log" 2>&1
-then
-       zenity --title="$title" --width=370 --height=400 --error --text="Compile error" 2> /dev/null
-       exit_install
-       exit
-fi
-
-printf '%b\n' "90 " > "$zen_pipe"
-printf '%b\n' "#Installing Geeqie..." > "$zen_pipe"
-
-# shellcheck disable=SC2024
-sudo --askpass make install >> "$install_log" 2>&1
-
 rm "$install_pass_script"
-mv -f "$install_log" install.log
+mv -f "$install_log" "./build/install.log"
 
 printf '%b\n' "100 " > "$zen_pipe"
 rm "$zen_pipe"