a5a414bae59e8ce998968452794b527857448397
[geeqie.git] / web / geeqie-install-debian.sh
1 #!/bin/bash
2 version="2019-07-21"
3 description=$'
4 Geeqie is an image viewer.
5 This script will download, compile, and install Geeqie on Debian-based systems.
6 If run from a folder that already contains the Geeqie sources, the source
7 code will be updated from the repository.
8 Dialogs allow the user to install additional features, including
9 additional pixbuf loaders.
10
11 Command line options are:
12 -v --version The version of this file
13 -h --help Output this text
14 -c --commit=ID Checkout and compile commit ID
15 -t --tag=TAG Checkout and compile TAG (e.g. v1.4 or v1.3)
16 -b --back=N Checkout commit -N (e.g. "-b 1" for last-but-one commit)
17 -d --debug=yes Compile with debug output
18 '
19
20 # Essential for compiling
21 essential_array=(
22 "git"
23 "build-essential"
24 "autoconf"
25 "libglib2.0-0"
26 "intltool"
27 "libtool"
28 )
29
30 # Optional for both GTK2 and GTK3
31 optional_array=(
32 "LCMS (for color management)"
33 "liblcms2-dev"
34 "exiv2 (for exif handling)"
35 "libgexiv2-dev"
36 "lua (for --remote commands)"
37 "liblua5.1-0-dev"
38 "libffmpegthumbnailer (for mpeg thumbnails)"
39 "libffmpegthumbnailer-dev"
40 "libtiff (for tiff support)"
41 "libtiff-dev"
42 "libjpeg (for jpeg support)"
43 "libjpeg-dev"
44 "librsvg2 (for viewing .svg images)"
45 "librsvg2-common"
46 "libwmf (for viewing .wmf images)"
47 "libwmf0.2-7-gtk"
48 "exiftran (for image rotation)"
49 "exiftran"
50 "imagemagick (for image rotation)"
51 "imagemagick"
52 "ufraw (for RAW file handling)"
53 "ufraw"
54 "exiv2 command line (for jpeg export)"
55 "exiv2"
56 "jpgicc (for jpeg export color correction)"
57 "liblcms2-utils"
58 "markdown (for generating README help file)"
59 "markdown"
60 "gphoto2 (for tethered photography and camera download plugins)"
61 "gphoto2"
62 "libimage-exiftool-perl (for jpeg extraction plugin)"
63 "libimage-exiftool-perl"
64 "libheif (for HEIF support)"
65 "libheif-dev"
66 "libwebp (for WebP images)"
67 "libwebp-dev"
68 )
69
70 # Optional for GTK3 only
71 optional_gtk3_array=(
72 "libchamplain gtk (for GPS maps)"
73 "libchamplain-gtk-0.12-dev"
74 "libchamplain (for GPS maps)"
75 "libchamplain-0.12-dev"
76 "libpoppler (for pdf file preview)"
77 "libpoppler-glib-dev"
78 )
79
80 # Optional pixbuf loaders
81 optional_loaders_array=(
82 ".psd Photoshop images"
83 "psd"
84 ".xcf Gimp files"
85 "xcf"
86 )
87
88 ####################################################################
89 # Get System Info
90 # Derived from: https://github.com/coto/server-easy-install (GPL)
91 ####################################################################
92 lowercase()
93 {
94         echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
95 }
96
97 systemProfile()
98 {
99         OS=`lowercase \`uname\``
100         KERNEL=`uname -r`
101         MACH=`uname -m`
102
103         if [ "${OS}" == "windowsnt" ]
104         then
105                 OS=windows
106         elif [ "${OS}" == "darwin" ]
107         then
108                 OS=mac
109         else
110                 OS=`uname`
111                 if [ "${OS}" = "SunOS" ]
112                 then
113                         OS=Solaris
114                         ARCH=`uname -p`
115                         OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
116                 elif [ "${OS}" = "AIX" ]
117                 then
118                         OSSTR="${OS} `oslevel` (`oslevel -r`)"
119                 elif [ "${OS}" = "Linux" ]
120                 then
121                         if [ -f /etc/redhat-release ]
122                         then
123                                 DistroBasedOn='RedHat'
124                                 DIST=`cat /etc/redhat-release |sed s/\ release.*//`
125                                 PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
126                                 REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
127                         elif [ -f /etc/SuSE-release ]
128                         then
129                                 DistroBasedOn='SuSe'
130                                 PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
131                                 REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
132                         elif [ -f /etc/mandrake-release ]
133                         then
134                                 DistroBasedOn='Mandrake'
135                                 PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
136                                 REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
137                         elif [ -f /etc/debian_version ]
138                         then
139                                 DistroBasedOn='Debian'
140                                 if [ -f /etc/lsb-release ]
141                                 then
142                                         DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F=  '{ print $2 }'`
143                                         PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F=  '{ print $2 }'`
144                                         REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F=  '{ print $2 }'`
145                                 fi
146                         fi
147                         if [ -f /etc/UnitedLinux-release ]
148                         then
149                                 DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
150                         fi
151                         OS=`lowercase $OS`
152                         DistroBasedOn=`lowercase $DistroBasedOn`
153                         readonly OS
154                         readonly DIST
155                         readonly DistroBasedOn
156                         readonly PSUEDONAME
157                         readonly REV
158                         readonly KERNEL
159                         readonly MACH
160                 fi
161         fi
162 }
163
164 install_essential()
165 {
166         arraylength=${#essential_array[@]}
167         for (( i=0; i<${arraylength}; i=i+1 ));
168         do
169                 package_query ${essential_array[$i]}
170                 if [ $? != 0 ]
171                 then
172                         package_install ${essential_array[$i]}
173                 fi
174         done
175
176         if [[ $1 == "GTK3" ]]
177         then
178                 package_query "libgtk-3-dev"
179                 if [ $? != 0 ]
180                 then
181                         package_install libgtk-3-dev
182                 fi
183         else
184                 package_query "libgtk2.0-dev"
185                 if [ $? != 0 ]
186                 then
187                         package_install libgtk2.0-dev
188                 fi
189         fi
190 }
191
192 install_options()
193 {
194         if [ -n "$options" ]
195         then
196                 OLDIFS=$IFS
197                 IFS='|'
198                 set $options
199                 while [ $# -gt 0 ];
200                 do
201                         package_install $1
202                         shift
203                 done
204                 IFS=$OLDIFS
205         fi
206 }
207
208 install_psd()
209 {
210         rm -rf gdk-pixbuf-psd
211         git clone https://github.com/and-rom/gdk-pixbuf-psd.git
212         cd gdk-pixbuf-psd
213         ./autogen.sh
214         make
215         sudo --askpass make install
216         sudo --askpass gdk-pixbuf-query-loaders --update-cache
217         cd -
218         rm -rf gdk-pixbuf-psd
219 }
220
221 install_xcf()
222 {
223         rm -rf xcf-pixbuf-loader
224         package_install libbz2-dev
225         git clone https://github.com/StephaneDelcroix/xcf-pixbuf-loader.git
226         cd xcf-pixbuf-loader
227         ./autogen.sh
228         make
229
230         # There must be a better way...
231         loader_locn=$(gdk-pixbuf-query-loaders | grep "LoaderDir" | tr -d '#[:space:]')
232
233         OLDIFS=$IFS
234         IFS='='
235         set $loader_locn
236         OLDIFS=$IFS
237
238         if [ -d $2 ]
239         then
240                 sudo --askpass cp .libs/libioxcf.so $2
241                 sudo --askpass gdk-pixbuf-query-loaders --update-cache
242         fi
243         cd -
244         rm -rf xcf-pixbuf-loader
245 }
246
247 install_extra_loaders()
248 {
249         if [ -n "$extra_loaders" ]
250         then
251                 OLDIFS=$IFS
252                 IFS='|'
253                 set $extra_loaders
254                 while [ $# -gt 0 ];
255                 do
256                         case $1 in
257                         "psd" )
258                                 install_psd
259                         ;;
260                         "xcf" )
261                                 install_xcf
262                         ;;
263                         esac
264
265                         shift
266                 done
267                 IFS=$OLDIFS
268         fi
269         return
270 }
271
272 uninstall()
273 {
274         current_dir=$(basename $PWD)
275         if [[ $current_dir == "geeqie" ]]
276         then
277                 sudo --askpass make uninstall
278                 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
279
280                 if [[ $? == 1 ]]
281                 then
282                         cd ..
283                         sudo --askpass rm -rf geeqie
284                 fi
285         else
286                 zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
287         fi
288
289         exit_install
290 }
291
292 package_query()
293 {
294         if [[ $DistroBasedOn == "debian" ]]
295         then
296                 res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
297                 if [[ "$res" == "install ok installed"* ]]
298                 then
299                         status=0
300                 else
301                         status=1
302                 fi
303         fi
304         return $status
305 }
306
307 package_install()
308 {
309         if [[ $DistroBasedOn == "debian" ]]
310         then
311                 sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
312         fi
313 }
314
315 exit_install()
316 {
317         rm $install_pass_script >/dev/null 2>&1
318         #~ rm $install_log >/dev/null 2>&1
319
320         if [[ -p $zen_pipe ]]
321         then
322                 echo "100" > $zen_pipe
323                 echo "#End" > $zen_pipe
324         fi
325
326         zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
327
328         rm $zen_pipe >/dev/null 2>&1
329
330         exit 1
331 }
332
333 # Entry point
334
335 # If uninstall has been run, maybe the current directory no longer exists
336 ls $PWD >/dev/null
337 if [[ $? != 0 ]]
338 then
339         zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Folder $PWD does not exist!" 2>/dev/null
340
341         exit
342 fi
343
344 # Check system type
345 systemProfile
346 if [[ $DistroBasedOn != "debian" ]]
347 then
348         zenity --error --title="Install Geeqie and dependencies" --width=370 --text="Unknown operating system:\n
349 Operating System: $OS
350 Distribution: $DIST
351 Psuedoname: $PSUEDONAME
352 Revision: $REV
353 DistroBasedOn: $DistroBasedOn
354 Kernel: $KERNEL
355 Machine: $MACH" 2>/dev/null
356
357         exit
358 fi
359
360 # Parse the comand line
361 OPTS=$(getopt -o vhc:t:b:d: --long version,help,commit:,tag:,back:,debug: -- "$@")
362 eval set -- "$OPTS"
363
364 while true;
365 do
366         case "$1" in
367         -v | --version )
368                 echo "$version"
369                 exit
370                 ;;
371         -h | --help )
372                 echo "$description"
373                 exit
374                 ;;
375         -c | --commit )
376                 COMMIT="$2"
377                 shift
378                 shift
379                 ;;
380         -t | --tag )
381                 TAG="$2"
382                 shift;
383                 shift
384                 ;;
385         -b | --back )
386                 BACK="$2"
387                 shift;
388                 shift
389                 ;;
390         -d | --debug )
391                 DEBUG="$2"
392                 shift;
393                 shift
394                 ;;
395         * ) break
396                 ;;
397         esac
398 done
399
400 # If a Geeqie folder already exists here, warn the user
401 if [ -d "geeqie" ]
402 then
403         zenity --info --title="Install Geeqie and dependencies" --width=370 --text="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\nA sub-folder of that name already exists.\nPlease try another folder." 2>/dev/null
404
405         exit
406 fi
407
408 # If it looks like a Geeqie download folder, assume an update
409 if [ -d ".git" ] && [ -d "src" ] && [ -f "geeqie.1" ]
410 then
411         mode="update"
412 else
413         # If it looks like something else is already installed here, warn the user
414         if [ -d ".git" ] || [ -d "src" ]
415         then
416                 zenity --info --title="Install Geeqie and dependencies" --width=370 --text="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\nIt looks like you are running this script from a folder which already has software installed.\n\nPlease try another folder." 2>/dev/null
417
418                 exit
419         else
420                 mode="install"
421         fi
422 fi
423
424 # Use GTK3 as default
425 gk2_installed=FALSE
426 gtk3_installed=TRUE
427
428 if [[ $mode == "install" ]]
429 then
430         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."
431
432         title="Install Geeqie and dependencies"
433         install_option=TRUE
434 else
435         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."
436
437         title="Update Geeqie and re-install"
438         install_option=FALSE
439
440         # When updating, use previous installation as default
441         if [[ -f config.log ]]
442         then
443                 grep gtk-2.0 config.log >/dev/null
444                 if [[ $? != 0 ]]
445                 then
446                         gtk2_installed=FALSE
447                         gtk3_installed=TRUE
448                 else
449                         gtk2_installed=TRUE
450                         gtk3_installed=FALSE
451                 fi
452         fi
453 fi
454
455 # Ask whether to install GTK2 or GTK3 or uninstall
456
457 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)
458
459 if [[ $? == 1 ]]
460 then
461         exit
462 fi
463
464 # Environment variable SUDO_ASKPASS cannot be "zenity --password",
465 # so create a temporary script containing the command
466 install_pass_script=$(mktemp --tmpdir geeqie_install_XXXXXX.sh)
467 echo $'#!/bin/bash
468 zenity --password --title=\"'$title$'\" --width=370 2>/dev/null
469 if [[ $? > 0 ]]
470 then
471         exit 1
472 fi
473 \n' > $install_pass_script
474 chmod +x $install_pass_script
475 export SUDO_ASKPASS=$install_pass_script
476
477 if [[ $gtk_version == "Uninstall" ]]
478 then
479         uninstall
480         exit
481 fi
482
483 # Put the install log in tmp, to avoid writing to PWD during a new install
484 rm install.log 2>/dev/null
485 install_log=$(mktemp --tmpdir geeqie_install_XXXXXX.log)
486
487 sleep 100 | zenity --title="$title" --text="Checking for installed files" --width=370 --progress --pulsate 2>/dev/null &
488 zen_pid=$!
489
490 # Get the standard options that are not yet installed
491 arraylength=${#optional_array[@]}
492 for (( i=0; i<${arraylength}; i=i+2 ));
493 do
494         package_query ${optional_array[$i+1]}
495         if [ $? != 0 ]
496         then
497                 if [ -z "$option_string" ]
498                 then
499                         option_string="$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
500                 else
501                         option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_array[$i]}"$'\n'"${optional_array[$i+1]}"
502                 fi
503         fi
504 done
505
506 # If GTK3 required, get the GTK3 options not yet installed
507 if [[ "$gtk_version" == "GTK3"* ]]
508 then
509         arraylength=${#optional_gtk3_array[@]}
510         for (( i=0; i<${arraylength}; i=i+2 ));
511         do
512                 package_query ${optional_gtk3_array[$i+1]}
513                 if [ $? != 0 ]
514                 then
515                         if [ -z "$option_string" ]
516                         then
517                                 option_string="$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
518                         else
519                                 option_string="$option_string"$'\n'"$install_option"$'\n'"${optional_gtk3_array[$i]}"$'\n'"${optional_gtk3_array[$i+1]}"
520                         fi
521                 fi
522         done
523 fi
524
525 # Get the optional loaders not yet installed
526 ((i=0))
527 gdk-pixbuf-query-loaders | grep WebP >/dev/null
528 if [[ $? == 1 ]]
529 then
530         if [ -z "$loaders_string" ]
531         then
532                 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
533         else
534                 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
535
536         fi
537 fi
538
539 ((i=i+2))
540 gdk-pixbuf-query-loaders | grep psd >/dev/null
541 if [[ $? == 1 ]]
542 then
543         if [ -z "$loaders_string" ]
544         then
545                 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
546         else
547                 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
548         fi
549 fi
550
551 ((i=i+2))
552 gdk-pixbuf-query-loaders | grep xcf >/dev/null
553 if [[ $? == 1 ]]
554 then
555         if [ -z "$loaders_string" ]
556         then
557                 loaders_string=$'FALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
558         else
559                 loaders_string="$loaders_string"$'\nFALSE\n'"${optional_loaders_array[$i]}"$'\n'"${optional_loaders_array[$i+1]}"
560         fi
561 fi
562
563 kill $zen_pid 2>/dev/null
564
565 # Ask the user which options to install
566 if [ -n "$option_string" ]
567 then
568         options=$(echo "$option_string" | zenity --title="$title" --width=400 --height=500 --list --checklist --text 'Select which library files to install:' --column='Select' --column='Library files' --column='Library' --hide-column=3 --print-column=3 2>/dev/null)
569
570         if [[ $? == 1 ]]
571         then
572                 exit_install
573         fi
574 fi
575
576 # Ask the user which extra loaders to install
577 if [ -n "$loaders_string" ]
578 then
579         extra_loaders=$(echo "$loaders_string" | zenity --title="$title" --width=370 --height=400 --list --checklist --text 'These loaders are not part of the main repository,\nbut are known to work to some extent.' --column='Select' --column='Library files' --column='Library' --hide-column=3 --print-column=3 2>/dev/null)
580
581         if [[ $? == 1 ]]
582         then
583                 exit_install
584         fi
585 fi
586
587 # Start of Zenity progress section
588 zen_pipe=$(mktemp --dry-run --tmpdir geeqie_install_pipe_XXXXXX)
589 mkfifo $zen_pipe
590 (tail  -f $zen_pipe 2>/dev/null) | zenity --progress --title="$title" --width=370 --text="Installing options..." --auto-close --auto-kill --percentage=0 2>/dev/null &
591
592 echo "2" > $zen_pipe
593 echo "#Installing essential libraries..." > $zen_pipe
594
595 install_essential $gtk_version
596
597 echo "4" > $zen_pipe
598 echo "#Installing options..." > $zen_pipe
599
600 install_options
601
602 echo "6" > $zen_pipe
603 echo "#Installing extra loaders..." > $zen_pipe
604
605 install_extra_loaders
606
607 echo "10" > $zen_pipe
608 echo "#Getting new sources from server..." > $zen_pipe
609
610 if [[ $mode == "install" ]]
611 then
612         ret=$(git clone git://www.geeqie.org/geeqie.git >>$install_log 2>&1)
613 else
614         git checkout master >>$install_log 2>&1
615         if [[ $? != 0 ]]
616         then
617                 git_error=$(tail -n5 $install_log 2>&1)
618                 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
619                 exit_install
620         fi
621         ret=$(git pull >>$install_log 2>&1)
622 fi
623
624 if [[ $? != 0 ]]
625 then
626         git_error=$(tail -n5 $install_log 2>&1)
627         zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
628         exit_install
629 fi
630
631 echo "20" > $zen_pipe
632 echo "#Cleaning installed version..." > $zen_pipe
633
634 if [[ $mode == "install" ]]
635 then
636         cd geeqie
637 else
638         sudo --askpass make uninstall >>$install_log 2>&1
639         sudo --askpass make maintainer-clean >>$install_log 2>&1
640 fi
641
642 echo "30" > $zen_pipe
643 echo "#Checkout required version..." > $zen_pipe
644
645 if [[ "$BACK" ]]
646 then
647         ret=$(git checkout master~"$BACK" >>$install_log 2>&1)
648         if [[ $? != 0 ]]
649         then
650                 git_error=$(tail -n5 $install_log 2>&1)
651                 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
652                 exit_install
653         fi
654 elif [[ "$COMMIT" ]]
655 then
656         ret=$(git checkout "$COMMIT" >>$install_log 2>&1)
657         if [[ $? != 0 ]]
658         then
659                 git_error=$(tail -n5 $install_log 2>&1)
660                 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
661                 exit_install
662         fi
663 elif [[ "$TAG" ]]
664 then
665         ret=$(git checkout "$TAG" >>$install_log 2>&1)
666         if [[ $? != 0 ]]
667         then
668         echo "error"
669                 git_error=$(tail -n5 $install_log 2>&1)
670                 zenity --title="$title" --width=370 --height=400 --error --text=$'Git error:\n\n'"$git_error" 2>/dev/null
671                 exit_install
672                 exit
673         fi
674 fi
675 if [[ "$DEBUG" == "yes" ]]
676 then
677         debug_opt=""
678 else
679         debug_opt="--disable-debug-log"
680 fi
681
682 echo "40" > $zen_pipe
683 echo "#Creating configuration files..." > $zen_pipe
684
685 if [[ $gtk_version == "GTK3"* ]]
686 then
687         ./autogen.sh "$debug_opt" >>$install_log 2>&1
688 else
689         ./autogen.sh "$debug_opt" --disable-gtk3 >>$install_log 2>&1
690 fi
691
692 echo "60" > $zen_pipe
693 echo "#Compiling..." > $zen_pipe
694
695 export CFLAGS=$CFLAGS" -Wno-deprecated-declarations"
696 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
697 make -j >>$install_log 2>&1
698
699 if [[ $? != 0 ]]
700 then
701         zenity --title="$title" --width=370 --height=400 --error --text=$'Compile error' 2>/dev/null
702         exit_install
703         exit
704 fi
705
706 echo "90 " > $zen_pipe
707 echo "#Installing Geeqie..." > $zen_pipe
708
709 sudo --askpass make install >>$install_log 2>&1
710
711 # This is a temporary fix until the ZoneDetect project releases its source code
712 zonedetect_message="ZoneDetect database not loaded"
713 if [[ -d "/usr/local/lib/geeqie" ]]
714 then
715         if [[ ! -f "/usr/local/lib/geeqie/timezone21.bin" ]]
716         then
717                 sudo --askpass wget --directory-prefix=/usr/local/lib/geeqie/ https://github.com/BertoldVdb/ZoneDetect/raw/master/database/timezone21.bin >>$install_log 2>&1
718                 if [[ $? == 0 ]]
719                 then
720                         zonedetect_message=""
721                 fi
722         else
723                 zonedetect_message=""
724         fi
725 fi
726
727 rm $install_pass_script
728 mv -f $install_log install.log;
729
730 echo "100 " > $zen_pipe
731 rm $zen_pipe
732
733 (for i in $(seq 0 4 100); do echo "$i"; sleep 0.1; done) | zenity --progress --title="$title" --width=370 --text="Geeqie installation complete...\n$zonedetect_message" --auto-close --percentage=0 2>/dev/null
734
735 exit