home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 January / maximum-cd-2009-01.iso / DiscContents / gimpshop_2.2.8_fix1_setup.exe / bin / gimptool-2.0 < prev    next >
Encoding:
Text File  |  2005-10-13  |  10.3 KB  |  341 lines

  1. #! /bin/sh
  2.  
  3. prefix=/usr/local
  4. exec_prefix=${prefix}
  5. exec_prefix_set=no
  6.  
  7. bindir=${exec_prefix}/bin
  8. sbindir=${exec_prefix}/sbin
  9. libexecdir=${exec_prefix}/libexec
  10. datadir=${prefix}/share
  11. sysconfdir=${prefix}/etc
  12. sharedstatedir=${prefix}/com
  13. localstatedir=${prefix}/var
  14. libdir=${exec_prefix}/lib
  15. infodir=${prefix}/info
  16. mandir=${prefix}/man
  17. includedir=${prefix}/include
  18.  
  19. gimpplugindir=${exec_prefix}/lib/gimp/2.0
  20. gimpdatadir=${prefix}/share/gimp/2.0
  21.  
  22. rt_libs=
  23.  
  24. usage()
  25. {
  26.   cat <<EOF
  27. Usage: gimptool-2.0 [OPTION]...
  28.  
  29. General options:
  30.   --help                  print this message
  31.   --quiet, --silent       don't echo build commands
  32.   --version               print the version of GIMP associated with this script
  33.   -n, --just-print, --dry-run, --recon
  34.                           don't actually run any commands; just print them
  35. Developer options:
  36.   --cflags                print the compiler flags that are necessary to
  37.                           compile a plug-in
  38.   --libs                  print the linker flags that are necessary to link a
  39.                           plug-in
  40.   --prefix=PREFIX         use PREFIX instead of the installation prefix that
  41.                           GIMP was built when computing the output for --cflags
  42.                           and --libs
  43.   --exec-prefix=PREFIX    use PREFIX instead of the installation exec prefix
  44.                           that GIMP was built when computing the output for
  45.                           --cflags and --libs
  46.  
  47. Installation directory options:
  48.   --prefix --exec-prefix --bindir --sbindir --libexecdir --datadir --sysconfdir
  49.   --sharedstatedir --localstatedir --libdir --infodir --mandir --includedir
  50.   --gimpplugindir --gimpdatadir
  51.  
  52. The --cflags and --libs options can be appended with -noui to get appropriate
  53. settings for plug-ins which do not use GTK+.
  54.  
  55. User options:
  56.   --build plug-in.c               build a plug-in from a source file
  57.   --install plug-in.c             same as --build, but installs the built
  58.                                   plug-in as well
  59.   --install-bin plug-in           install a compiled plug-in
  60.   --install-script script.scm     install a script-fu script
  61.  
  62.   --uninstall-bin plug-in         remove a plug-in again
  63.   --uninstall-script plug-in      remove a script-fu script
  64.  
  65. The --install and --uninstall options have "admin" counterparts (with
  66. prefix --install-admin instead of --install) that can be used instead to
  67. install/uninstall a plug-in or script in the site directory instead of a
  68. user directory.
  69.  
  70. For plug-ins which do not use GTK+, the --build and --install options can be
  71. appended with -noui for appropriate settings. For plug-ins that use GTK+ but
  72. not libgimpui, append -nogimpui.
  73.  
  74. All binary build and install options can be appended with -strip to discard
  75. debugging information.
  76. EOF
  77.  
  78.   exit $1
  79. }
  80.  
  81. noarg="\
  82. Error: Need a plug-in source file to build"
  83.  
  84. notfound="\
  85. Error: Couldn't find file to build/install/uninstall"
  86.  
  87. quiet=no
  88. donothing=no
  89.  
  90. if test $# -eq 0; then
  91.   usage 1
  92. fi
  93.  
  94. if test x${PKG_CONFIG+set} != xset ; then
  95.   gtk_cflags='-Ic:/MinGW/include/gtk-2.0 -Ic:/MinGW/lib/gtk-2.0/include -Ic:/MinGW/include/atk-1.0 -Ic:/MinGW/include/pango-1.0 -Ic:/MinGW/include/glib-2.0 -Ic:/MinGW/lib/glib-2.0/include  '
  96.   gtk_libs='-Lc:/MinGW/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv  '
  97.   glib_cflags='-Ic:/MinGW/include/glib-2.0 -Ic:/MinGW/lib/glib-2.0/include  '
  98.   glib_libs='-Lc:/MinGW/lib -lgobject-2.0 -lglib-2.0 -lintl -liconv  '
  99. else
  100.   gtk_cflags=`$PKG_CONFIG --cflags gtk+-2.0`
  101.   gtk_libs=`$PKG_CONFIG --libs gtk+-2.0`
  102.   glib_cflags=`$PKG_CONFIG --cflags glib-2.0`
  103.   glib_libs=`$PKG_CONFIG --libs glib-2.0`
  104. fi
  105.  
  106. if test x${INSTALL+set} != xset ; then
  107.   INSTALL='/bin/install -c'
  108.   if test "$INSTALL" = "./install-sh -c"; then
  109.     mydirname=`echo $0 | sed -e 's#\(.*\)/[^/].*$#\1#'`
  110.     INSTALL="$mydirname/gimpinstall"
  111.   fi
  112. fi
  113.  
  114. if test x${CC+set} != xset ; then
  115.   cc='gcc'
  116. else
  117.   cc="$CC"
  118. fi
  119.  
  120. if test x${CFLAGS+set} != xset ; then
  121.   cflags='-g -O2 -Wall -mms-bitfields'
  122. else
  123.   cflags="$CFLAGS"
  124. fi
  125.  
  126. if test x${LDFLAGS+set} != xset ; then
  127.   ldflags=''
  128. else
  129.   ldflags="$LDFLAGS"
  130. fi
  131.  
  132. if test x${LIBS+set} != xset ; then
  133.   libs=""
  134. else
  135.   libs="$LIBS"
  136. fi
  137.  
  138. while test $# -gt 0; do
  139.   case "$1" in
  140.   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  141.   *) optarg= ;;
  142.   esac
  143.  
  144.   case $1 in
  145.     --version)
  146.       echo 2.2.8
  147.       exit 0
  148.       ;;
  149.     --help)
  150.       usage 0
  151.       ;;
  152.     --quiet | --silent)
  153.       quiet=yes
  154.       ;;
  155.     -n | --just-print | --dry-run | --recon)
  156.       donothing=yes
  157.       ;;
  158.     --prefix=*)
  159.       prefix=$optarg
  160.       if test $exec_prefix_set = no ; then
  161.         exec_prefix=$optarg
  162.       fi
  163.       ;;
  164.     --prefix)
  165.       echo $prefix
  166.       ;;
  167.     --exec-prefix=*)
  168.       exec_prefix=$optarg
  169.       exec_prefix_set=yes
  170.       ;;
  171.     --exec-prefix)
  172.       echo $exec_prefix
  173.       ;;
  174.     --*dir)
  175.       dirname=\$`echo $1 | sed -e 's,^--,,'`
  176.       dirname=`eval echo $dirname`
  177.       test -z "$dirname" && exit 1
  178.       echo $dirname
  179.       exit 0
  180.       ;;
  181.     --cflags | --cflags-noui | --cflags-nogimpui)
  182.       case $1 in
  183.         --cflags | --cflags-nogimpui)
  184.           my_gtk_cflags=$gtk_cflags ;;
  185.         --cflags-noui)
  186.           my_gtk_cflags=$glib_cflags ;;
  187.       esac
  188.       includes=-I${prefix}/include/gimp-2.0
  189.       echo $includes $my_gtk_cflags
  190.       ;;
  191.     --libs | --libs-nogimpui)
  192.       my_gtk_libs=
  193.       libdirs=-L${exec_prefix}/lib
  194.       for i in $gtk_libs ; do
  195.         if test $i != -L${exec_prefix}/lib ; then
  196.           if test -z "$my_gtk_libs" ; then
  197.             my_gtk_libs="$i"
  198.           else
  199.             my_gtk_libs="$my_gtk_libs $i"
  200.           fi
  201.         fi
  202.       done
  203.       case $1 in
  204.         --libs)
  205.           echo $libdirs -lgimpui-2.0 -lgimpwidgets-2.0 -lgimp-2.0 -lgimpcolor-2.0 -lgimpmath-2.0 -lgimpbase-2.0 $my_gtk_libs $rt_libs ;;
  206.         --libs-nogimpui)
  207.           echo $libdirs -lgimp-2.0 -lgimpcolor-2.0 -lgimpmath-2.0 -lgimpbase-2.0 $my_gtk_libs $rt_libs ;;
  208.       esac
  209.       ;;
  210.     --libs-noui)
  211.       echo -L${exec_prefix}/lib -lgimp-2.0 -lgimpcolor-2.0 -lgimpmath-2.0 -lgimpbase-2.0 $glib_libs $rt_libs
  212.       ;;
  213.     --install-bin | --install-admin-bin \
  214.     | --install-bin-strip | --install-admin-bin-strip \
  215.     | --install-script | --install-admin-script \
  216.     | --uninstall-bin | --uninstall-admin-bin \
  217.     | --uninstall-script | --uninstall-admin-script )
  218.       case $1 in
  219.         --*install-bin)
  220.           install_cmd="${INSTALL}"
  221.           install_dir="$HOME/.gimp-2.2/plug-ins"
  222.           ;;
  223.         --install-bin-strip)
  224.           install_cmd="${INSTALL} -s"
  225.           install_dir="$HOME/.gimp-2.2/plug-ins"
  226.           ;;
  227.         --*install-admin-bin)
  228.           install_cmd="${INSTALL}"
  229.           install_dir="$gimpplugindir/plug-ins"
  230.           ;;
  231.         --install-admin-bin-strip)
  232.           install_cmd="${INSTALL} -s"
  233.           install_dir="$gimpplugindir/plug-ins"
  234.           ;;
  235.         --*install-script)
  236.           install_cmd="${INSTALL} -m 644"
  237.           install_dir="$HOME/.gimp-2.2/scripts"
  238.           ;;
  239.         --*install-admin-script)
  240.           install_cmd="${INSTALL} -m 644"
  241.           install_dir="$gimpdatadir/scripts"
  242.           ;;
  243.       esac
  244.       case $1 in
  245.         --uninstall-* )
  246.           shift
  247.           if test "x$1" != "x"; then
  248.             dest=`echo $1 | sed -e 's#.*/\([^/].*\)$#\1#'`
  249.             if test -f "$DESTDIR$install_dir/$dest"; then
  250.               cmd="rm -f $DESTDIR$install_dir/$dest"
  251.               test $quiet = "yes" || echo $cmd
  252.               test $donothing = "yes" || exec $cmd
  253.             else
  254.               echo "${notfound}" 1>&2
  255.               exit 1
  256.             fi  
  257.           else
  258.             echo "${noarg}" 1>&2
  259.             exit 1
  260.           fi
  261.           ;;
  262.         *)
  263.           shift
  264.           if test "x$1" != "x"; then
  265.             if test -r "$1"; then
  266.               cmd="${INSTALL} -d $DESTDIR$install_dir"
  267.               test $quiet = "yes" || echo $cmd
  268.               test $donothing = "yes" || $cmd
  269.               dest=`echo $1 | sed -e 's#.*/\([^/].*\)$#\1#'`
  270.               cmd="$install_cmd $1 $DESTDIR$install_dir/$dest"
  271.               test $quiet = "yes" || echo $cmd
  272.               test $donothing = "yes" || exec $cmd
  273.             else
  274.               echo "${notfound}" 1>&2
  275.               exit 1
  276.             fi  
  277.           else
  278.             echo "${noarg}" 1>&2
  279.             exit 1
  280.           fi
  281.         ;;
  282.       esac
  283.       ;;
  284.     --build | --install | --install-admin | --build-strip | --install-strip \
  285.     | --install-admin-strip | --build-nogimpui | --install-nogimpui \
  286.     | --install-admin-nogimpui | --build-nogimpui-strip \
  287.     | --install-nogimpui-strip | --install-admin-nogimpui-strip \
  288.     | --build-noui | --install-noui | --install-admin-noui \
  289.     | --build-noui-strip | --install-noui-strip | --install-admin-noui-strip)
  290.       opt=`echo $1 | sed 's/-strip$//'`
  291.       if test "x$opt" != "x$1" ; then
  292.         cflags=`echo $cflags | sed -e 's/-g //g' -e 's/ -g//g'`
  293.       fi
  294.       case $opt in
  295.         --build | --build-noui | --build-nogimpui)
  296.           install_dir=. ;;
  297.         --install | --install-noui | --install-nogimpui)
  298.           install_dir="$HOME/.gimp-2.2/plug-ins" ;;
  299.         --install-admin | --install-admin-noui | --install-admin-nogimpui)
  300.           install_dir="$gimpplugindir/plug-ins" ;;
  301.       esac
  302.       noui=`echo $opt | sed 's/^.*\(noui\)$/\1/'`
  303.       nogimpui=`echo $opt | sed 's/^.*\(nogimpui\)$/\1/'`
  304.       if test "$noui" = "noui" ; then
  305.         gimp_cflags=`$0 --cflags-noui`
  306.         gimp_libs=`$0 --libs-noui`
  307.       elif test "$nogimpui" = "nogimpui" ; then
  308.         gimp_cflags=`$0 --cflags-nogimpui`
  309.         gimp_libs=`$0 --libs-nogimpui`
  310.       else
  311.         gimp_cflags=`$0 --cflags`
  312.         gimp_libs=`$0 --libs`
  313.       fi
  314.       shift
  315.       if test "x$1" != "x"; then
  316.         if test -r "$1"; then
  317.           if test "$install_dir" != "."; then
  318.             cmd="${INSTALL} -d $DESTDIR$install_dir"
  319.             test $quiet = "yes" || echo $cmd
  320.             test $donothing = "yes" || $cmd
  321.           fi
  322.           dest=`echo $1 | sed -e 's#.*/\([^/].*\)$#\1#' -e 's/\.[^.]*$//'`
  323.           cmd="$cc $cflags $gimp_cflags -o $install_dir/$dest $1 $ldflags $gimp_libs $libs"
  324.           test $quiet = "yes" || echo $cmd
  325.           test $donothing = "yes" || exec $cmd
  326.         else
  327.           echo "${notfound}" 1>&2
  328.           exit 1
  329.         fi  
  330.       else
  331.         echo "${noarg}" 1>&2
  332.         exit 1
  333.       fi
  334.       ;;
  335.     *)
  336.       usage 1
  337.       ;;
  338.   esac
  339.   shift
  340. done
  341.