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