From: Richard W.M. Jones <"Richard W.M. Jones "> Date: Mon, 7 Jan 2008 11:19:38 +0000 (+0000) Subject: Basic framework for NSIS. X-Git-Tag: 1.0.4~90 X-Git-Url: http://git.annexia.org/?p=virt-top.git;a=commitdiff_plain;h=f2bb550da8353a7ab11d487b947ed702aa9a838f;ds=sidebyside Basic framework for NSIS. --- diff --git a/.hgignore b/.hgignore index 3ecf0c1..33d3be5 100755 --- a/.hgignore +++ b/.hgignore @@ -1,6 +1,7 @@ syntax: glob META ocaml-libvirt-*.tar.gz +ocaml-libvirt-*.exe html configure config.log diff --git a/Makefile.in b/Makefile.in index 703d14e..3d3f561 100755 --- a/Makefile.in +++ b/Makefile.in @@ -20,6 +20,8 @@ VERSION = @PACKAGE_VERSION@ INSTALL = @INSTALL@ +MAKENSIS = @MAKENSIS@ + OCAMLDOC = @OCAMLDOC@ OCAMLDOCFLAGS := -html -sort @@ -65,6 +67,18 @@ doc: libvirt.{ml,mli} libvirt_version.{ml,mli} endif +# Windows installer (requires NSIS). + +ifneq ($(MAKENSIS),) +wininstaller: $(PACKAGE)-$(VERSION).exe + +$(PACKAGE)-$(VERSION).exe: wininstaller.nsis all # opt + "$(MAKENSIS)" \ + //DPACKAGE=$(PACKAGE) //DVERSION=$(VERSION) \ + //DOUTFILE=$@ //V2 $< + ls -l $@ +endif + # Update configure and rerun. configure: force diff --git a/README b/README index b3001a3..3bcaa7e 100755 --- a/README +++ b/README @@ -48,6 +48,10 @@ To build the manpages (optional): perldoc (part of Perl) +To build a Windows installer (optional): + + NSIS (http://nsis.sf.net) + OCaml packages are available for Fedora 7 and above (ocaml, ocaml-findlib, ocaml-findlib-devel, ocaml-ocamldoc, ocaml-extlib, ocaml-extlib-devel, ocaml-lablgtk, ocaml-lablgtk-devel, ocaml-curses, @@ -88,6 +92,16 @@ I have built libvirt (the bindings), examples, mlvirsh and mlvirtmanager on Windows using the MinGW port of OCaml. It's quite likely that it will also work under VC++, but I have not tested this. +To build the Windows installer, you will need NSIS. Then do: + + ./configure --with-nsis=/c/Progra~1/NSIS + make all opt + make wininstaller + +This should build a Windows binary installer called +ocaml-libvirt-$VERSION.exe which includes the bindings, all required +DLLs and all programs that can be built under Windows. + mlvirsh ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 63ef06f..f0ec22a 100755 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,21 @@ AC_SUBST(subdirs) dnl Check for optional perldoc (for building manual pages). AC_CHECK_PROG(HAVE_PERLDOC,perldoc,perldoc) +dnl Check for optional NSIS. +AC_ARG_WITH([nsis], + [AS_HELP_STRING([--with-nsis], + [use NSIS to build a Windows installer])], + [], + [with_nsis=no]) +MAKENSIS= +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 +fi +AC_SUBST(MAKENSIS) + dnl Summary. echo "------------------------------------------------------------" echo "Thanks for downloading" $PACKAGE_STRING diff --git a/wininstaller.nsis b/wininstaller.nsis new file mode 100755 index 0000000..e3c8fd9 --- /dev/null +++ b/wininstaller.nsis @@ -0,0 +1,103 @@ +#!Nsis Installer Command Script +# Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# To build the installer: +# +# ./configure --with-nsis=/c/Progra~1/NSIS +# make all opt +# make wininstaller + +# Installer name. +Name "OCaml Libvirt ${VERSION}" + +# This is where we will write the installer to, set by Makefile. +OutFile "${OUTFILE}" + +# Target directory, or use value from the registry. +InstallDir "c:\${PACKAGE}" +InstallDirRegKey HKLM SOFTWARE\OCAML-LIBVIRT "Install_Dir" + +# Hide details. +ShowInstDetails hide +ShowUninstDetails hide + +# BZip2-compressed files are smaller but use more memory at runtime. +SetCompressor bzip2 + +# Include an XP manifest. +XPStyle on + +# Pages in the installer wizard. +Page license +Page components +Page directory +Page instfiles + +# Title, data for license page. +LicenseText "Continue" +LicenseData "winlicense.rtf" + +# Title for components page. +ComponentText "This will install OCaml libvirt bindings, dependent libraries and programs on your computer. Select which optional components you want installed." + +# Title for the install directory page. +DirText "Please select the installation folder." + +# Installer section. +Section "OCaml Libvirt bindings (required)" + SectionIn RO +SectionEnd + +Section "Libraries (required)" + SectionIn RO +SectionEnd + +Section "Programs (recommended)" + SetOutPath $INSTDIR + File "/oname=mlvirsh.exe" "mlvirsh\mlvirsh.opt" +SectionEnd + +Section "Start Menu Shortcuts" + CreateDirectory "$SMPROGRAMS\${PACKAGE}" + CreateShortCut "$SMPROGRAMS\${PACKAGE}\Uninstall.lnk" "$INSTDIR\Uninstall ${PACKAGE}.exe" "" "$INSTDIR\Uninstall ${PACKAGE}.exe" 0 + CreateShortCut "$SMPROGRAMS\${PACKAGE}\Virt Shell.lnk" "$INSTDIR\mlvirsh.exe" "" "$INSTDIR\mlvirsh.exe" 0 +SectionEnd + +Section "Desktop Icons" + CreateShortCut "$DESKTOP\Virt Shell.lnk" "$INSTDIR\mlvirsh.exe" "" "$INSTDIR\mlvirsh.exe" 0 +SectionEnd + +Section "Uninstall" + # Desktop icons + Delete /rebootok "$DESKTOP\Virt Shell.lnk" + + # Menu shortcuts + Delete /rebootok "$SMPROGRAMS\${PACKAGE}\Virt Shell.lnk" + Delete /rebootok "$SMPROGRAMS\${PACKAGE}\Uninstall.lnk" + RMDir "$SMPROGRAMS\${PACKAGE}" + + # Files in installation directory. + Delete /rebootok "$INSTDIR\mlvirsh.exe" + Delete /rebootok "$INSTDIR\Uninstall ${PACKAGE}.exe" + + RMDir "$INSTDIR" +SectionEnd + +# Write an uninstaller into the installation directory. +Section -post + WriteUninstaller "$INSTDIR\Uninstall ${PACKAGE}.exe" +SectionEnd diff --git a/winlicense.rtf b/winlicense.rtf new file mode 100755 index 0000000..5333b43 Binary files /dev/null and b/winlicense.rtf differ