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