Bundle Gtk DLLs and support files in the Windows installer.
authorRichard W.M. Jones <rjones@redhat.com>
Mon, 7 Jan 2008 17:39:05 +0000 (17:39 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 7 Jan 2008 17:39:05 +0000 (17:39 +0000)
* configure.ac: Detect library paths instead of hard-
  coding them.
* wininstaller.nsis (removed): This file is now autogenerated.
* wininstaller.nsis.in: Bundle Gtk DLLs and support files.
* Makefile.in: More verbose messages from NSIS.

.hgignore
ChangeLog
Makefile.in
configure.ac
wininstaller.nsis.in [moved from wininstaller.nsis with 81% similarity]

index 33d3be5..098c551 100755 (executable)
--- a/.hgignore
+++ b/.hgignore
@@ -30,3 +30,4 @@ mlvirsh/mlvirsh
 mlvirtmanager/mlvirtmanager
 virt-top/virt-top
 virt-df/virt-df
+wininstaller.nsis
\ No newline at end of file
index 8683d58..c8b673a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-01-07  Richard Jones  <rjones@redhat.com>
 
+       Bundle Gtk DLLs and support files in the Windows installer.
+       * configure.ac: Detect library paths instead of hard-
+         coding them.
+       * wininstaller.nsis (removed): This file is now autogenerated.
+       * wininstaller.nsis.in: Bundle Gtk DLLs and support files.
+       * Makefile.in: More verbose messages from NSIS.
+
        Include required libraries in the Windows installer.
        * wininstaller.nsis: Include *.dll files.
 
index 3d3f561..a7cc00b 100755 (executable)
@@ -75,7 +75,7 @@ wininstaller: $(PACKAGE)-$(VERSION).exe
 $(PACKAGE)-$(VERSION).exe: wininstaller.nsis all # opt
        "$(MAKENSIS)" \
          //DPACKAGE=$(PACKAGE) //DVERSION=$(VERSION) \
-         //DOUTFILE=$@ //V2 $<
+         //DOUTFILE=$@ $<
        ls -l $@
 endif
 
index f0ec22a..2920cf3 100755 (executable)
@@ -147,20 +147,94 @@ AC_SUBST(subdirs)
 dnl Check for optional perldoc (for building manual pages).
 AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc)
 
-dnl Check for optional NSIS.
+dnl Check for optional NSIS (for building a Windows installer).
 AC_ARG_WITH([nsis],
        [AS_HELP_STRING([--with-nsis],
            [use NSIS to build a Windows installer])],
        [],
        [with_nsis=no])
+
 MAKENSIS=
+LIBVIRT_DLL_PATH=
+LIBXDR_DLL_PATH=
+LIBXML2_DLL_PATH=
+GNUTLS_DLL_PATH=
+GTK_PATH=
+GTK_DLL_PATH=
+
+[
+msys_to_win_dir () {
+    eval pushd "\$$1" > /dev/null
+    eval $1=`pwd -W`
+    popd > /dev/null
+}
+]
+
 if test "x$with_nsis" != "xno"; then
     AC_PATH_PROG(MAKENSIS,makensis,[],[$with_nsis:$PATH])
     if test "x$MAKENSIS" = "x"; then
        AC_MSG_FAILURE([--with-nsis was given, but could not find MAKENSIS.EXE])
     fi
+
+    # MAKENSIS is set so we will build a rule for making a Windows
+    # installer.  To support this, generate wininstaller.nsis.
+    saved_IFS=$IFS
+    IFS=$PATH_SEPARATOR
+    for d in $PATH; do
+       IFS=$saved_IFS
+       echo Checking $d for DLLs ... >&5
+       if test -f "$d/libvirt-0.dll"; then
+           LIBVIRT_DLL_PATH="$d"
+       fi
+       if test -f "$d/libxdr.dll"; then
+           LIBXDR_DLL_PATH="$d"
+       fi
+       if test -f "$d/libxml2-2.dll"; then
+           LIBXML2_DLL_PATH="$d"
+       fi
+       if test -f "$d/libgpg-error-0.dll"; then
+           GNUTLS_DLL_PATH="$d"
+       fi
+       if test -f "$d/libgtk-win32-2.0-0.dll"; then
+           GTK_DLL_PATH="$d"
+           GTK_PATH="$d/.."
+       fi
+    done
+    IFS=$saved_IFS
+
+    if test "x$LIBVIRT_DLL_PATH" = "x"; then
+       AC_MSG_FAILURE([cannot find libvirt-0.dll in PATH])
+    fi
+    if test "x$LIBXDR_DLL_PATH" = "x"; then
+       AC_MSG_FAILURE([cannot find libxdr.dll in PATH])
+    fi
+    if test "x$LIBXML2_DLL_PATH" = "x"; then
+       AC_MSG_FAILURE([cannot find libxml2-2.dll in PATH])
+    fi
+    if test "x$GNUTLS_DLL_PATH" = "x"; then
+       AC_MSG_FAILURE([cannot find GnuTLS DLLs in PATH])
+    fi
+    if test "x$GTK_DLL_PATH" = "x"; then
+        AC_MSG_WARN([cannot find GTK DLLs in PATH])
+    fi
+
+    # Change the paths to Windows paths.
+    msys_to_win_dir LIBVIRT_DLL_PATH
+    msys_to_win_dir LIBXDR_DLL_PATH
+    msys_to_win_dir LIBXML2_DLL_PATH
+    msys_to_win_dir GNUTLS_DLL_PATH
+    if test "x$GTK_DLL_PATH" != "x"; then
+       msys_to_win_dir GTK_DLL_PATH
+       msys_to_win_dir GTK_PATH
+    fi
 fi
 AC_SUBST(MAKENSIS)
+AC_SUBST(LIBVIRT_DLL_PATH)
+AC_SUBST(LIBXDR_DLL_PATH)
+AC_SUBST(LIBXML2_DLL_PATH)
+AC_SUBST(GNUTLS_DLL_PATH)
+AC_SUBST(GTK_DLL_PATH)
+AC_SUBST(GTK_PATH)
 
 dnl Summary.
 echo "------------------------------------------------------------"
@@ -181,4 +255,7 @@ AC_CONFIG_FILES([META
        virt-top/Makefile
        virt-df/Makefile
        ])
+if test "x$MAKENSIS" != "x"; then
+       AC_CONFIG_FILES([wininstaller.nsis])
+fi
 AC_OUTPUT
similarity index 81%
rename from wininstaller.nsis
rename to wininstaller.nsis.in
index 0ffba5c..f348540 100755 (executable)
@@ -1,4 +1,5 @@
 #!Nsis Installer Command Script\r
+# @configure_input@\r
 # Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones\r
 #\r
 # This library is free software; you can redistribute it and/or\r
@@ -63,19 +64,29 @@ Section "Libvirt and its libraries (required)"
        SectionIn RO\r
 \r
        SetOutPath $INSTDIR\r
-       # XXX Get these paths automatically.\r
-       File "c:\msys\1.0\local\bin\libvirt-?.dll"\r
-       File "c:\msys\1.0\local\bin\libxdr.dll"\r
-       File "c:\msys\1.0\local\bin\libxml2-?.dll"\r
-       File "c:\gnutls\bin\libgcrypt-??.dll"\r
-       File "c:\gnutls\bin\libgnutls-??.dll"\r
-       File "c:\gnutls\bin\libgpg-error-?.dll"\r
-       File "c:\gnutls\bin\libtasn1-?.dll"\r
+       File "@LIBVIRT_DLL_PATH@\libvirt-0.dll"\r
+       File "@LIBXDR_DLL_PATH@\libxdr.dll"\r
+       File "@LIBXML2_DLL_PATH@\libxml2-2.dll"\r
+       File "@GNUTLS_DLL_PATH@\libgcrypt-??.dll"\r
+       File "@GNUTLS_DLL_PATH@\libgnutls-??.dll"\r
+       File "@GNUTLS_DLL_PATH@\libgpg-error-?.dll"\r
+       File "@GNUTLS_DLL_PATH@\libtasn1-?.dll"\r
+       File "@GTK_DLL_PATH@\*.dll"\r
+\r
+       SetOutPath $INSTDIR\lib\r
+       File /r "@GTK_PATH@\lib\gtk-2.0"\r
+       File /r "@GTK_PATH@\lib\pango"\r
+\r
+       SetOutPath $INSTDIR\r
+       File /r "@GTK_PATH@\etc"\r
+\r
+       SetOutPath $INSTDIR\r
 SectionEnd\r
 \r
 Section "Programs (recommended)"\r
        SetOutPath $INSTDIR\r
        File "/oname=mlvirsh.exe" "mlvirsh\mlvirsh.opt"\r
+       #File "/oname=mlvirtmanager.exe" "mlvirsh\mlvirtmanager.opt"\r
 SectionEnd\r
 \r
 Section "OCaml Libvirt bindings (for developers only)"\r
@@ -102,6 +113,8 @@ Section "Uninstall"
        RMDir "$SMPROGRAMS\${PACKAGE}"\r
 \r
        # Files in installation directory.\r
+       RMDir /r "$INSTDIR\etc"\r
+       RMDir /r "$INSTDIR\lib"\r
        Delete /rebootok "$INSTDIR\*.exe"\r
        Delete /rebootok "$INSTDIR\*.dll"\r
 \r