From 55e27d24d133b19c9168a1ce5b70dc305e8eec42 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 13 Aug 2019 14:31:48 -0300 Subject: [PATCH] Creating windows package. --- .gitignore | 2 ++ configure.ac | 13 +++++++++++++ win/hllapi.nsi.in | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ win/pack.sh | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 237 insertions(+), 0 deletions(-) create mode 100644 win/hllapi.nsi.in create mode 100755 win/pack.sh diff --git a/.gitignore b/.gitignore index 5578ffa..0f4bb82 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ dbus-glue.h *.bak *.[0-9] vgcore.* +*.nsi +*.exe diff --git a/configure.ac b/configure.ac index dfb9289..8f42263 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,18 @@ case "$host" in AC_SUBST(WIN32_FILE_VERSION,$app_win32_file_version) AC_CONFIG_FILES(src/core/windows/resources.rc) + AC_CONFIG_FILES(win/hllapi.nsi) + + if test "$host_cpu" = "x86_64"; then + app_cv_programfiles="PROGRAMFILES64" + app_cv_winarch="64" + else + app_cv_programfiles="PROGRAMFILES" + app_cv_winarch="32" + fi + + AC_SUBST(PROGRAMFILES,$app_cv_programfiles) + AC_SUBST(WINARCH,$app_cv_winarch) ;; *) @@ -108,6 +120,7 @@ AC_SUBST(LOGDIR) AC_SUBST(DLLEXT) AC_SUBST(DLLPREFIX) AC_SUBST(LDFLAGS) +AC_SUBST(DLL_LDFLAGS) dnl --------------------------------------------------------------------------- dnl Check for other programs diff --git a/win/hllapi.nsi.in b/win/hllapi.nsi.in new file mode 100644 index 0000000..03ba20c --- /dev/null +++ b/win/hllapi.nsi.in @@ -0,0 +1,112 @@ +!include "MUI2.nsh" +!include "x64.nsh" +!include "FileFunc.nsh" + +Name "@PACKAGE@" +Caption "@PACKAGE@ - @PACKAGE_DESCRIPTION@" +outfile "@PACKAGE@-@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@.@PACKAGE_MAJOR_RELEASE@.@PACKAGE_MINOR_RELEASE@-@host_cpu@.exe" + +XPStyle on + +installDir "$@PROGRAMFILES@\@PACKAGE@" + +# Get installation folder from registry if available +InstallDirRegKey HKLM "Software\@PACKAGE@" "InstallLocation" + +RequestExecutionLevel admin + +# Properties +VIProductVersion "@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@.@PACKAGE_MAJOR_RELEASE@.@PACKAGE_MINOR_RELEASE@" +VIFileVersion "@WIN32_VERSION@" + +VIAddVersionKey "ProductVersion" "@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@.@PACKAGE_MAJOR_RELEASE@.@PACKAGE_MINOR_RELEASE@" +VIAddVersionKey "FileVersion" "@WIN32_VERSION@" + +VIAddVersionKey "ProductName" "@PACKAGE_NAME@" +VIAddVersionKey "FileDescription" "@PACKAGE_DESCRIPTION@" +VIAddVersionKey "LegalCopyright" "GPL-2.0" + +# Interface + +!define MUI_ABORTWARNING +# !insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "..\LICENSE" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES + +# !insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +# !insertmacro MUI_UNPAGE_FINISH + +# Languages +!insertmacro MUI_LANGUAGE "English" + +# Section scripts +!include Sections.nsh + +# default section +SubSection "@PACKAGE@" SecMain + + Section "Core" SecCore + + SetRegView @WINARCH@ + ${DisableX64FSRedirection} + + # define the output path for this file + setOutPath $SYSDIR + SetShellVarContext all + + file "/oname=$SYSDIR\hllapi.dll" "..\.bin\Release\hllapi.dll" + + # define uninstaller name + SetRegView 32 + + writeUninstaller $INSTDIR\uninstall.exe + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \ + "DisplayName" "@PACKAGE@ - @PACKAGE_DESCRIPTION@" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \ + "DisplayVersion" "@PACKAGE_VERSION@" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \ + "UninstallString" "$INSTDIR\uninstall.exe" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \ + "InstallLocation" "$INSTDIR" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \ + "NoModify" "1" + + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" \ + "NoRepair" "1" + + # Save instalation dir + WriteRegStr HKCU "Software\@PACKAGE@" "" $INSTDIR + + sectionEnd + +SubSectionEnd + +Section "Uninstall" + + # Always delete uninstaller first + delete $INSTDIR\uninstaller.exe + + # delete installed files + delete $SYSDIR\hllapi.dll + + # Remove registry + SetRegView 32 + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@PACKAGE@" + DeleteRegKey HKLM "Software\@PACKAGE@" + + SetRegView @WINARCH@ + DeleteRegKey HKLM "Software\@PACKAGE@" + +SectionEnd + + + diff --git a/win/pack.sh b/win/pack.sh new file mode 100755 index 0000000..8912155 --- /dev/null +++ b/win/pack.sh @@ -0,0 +1,110 @@ +#!/bin/bash +cd $(dirname $(dirname $(readlink -f $0))) + +PUBLISH=0 + +pack() { + + echo -e "\e]2;hllapi-${1}\a" + + ./configure --cache=.${1}.cache \ + --host=${1}-w64-mingw32 \ + --prefix=/usr/${1}-w64-mingw32/sys-root/mingw \ + --libdir=/usr/${1}-w64-mingw32/sys-root/mingw/lib + + if [ "$?" != "0" ]; then + exit -1 + fi + + make clean + if [ "$?" != "0" ]; then + exit -1 + fi + + make Release + if [ "$?" != "0" ]; then + exit -1 + fi + + makensis win/hllapi.nsi + + if [ -d ~/public_html ]; then + mkdir -p ~/public_html/win + cp -v ./win/*.exe ~/public_html/win + if [ "$?" != "0" ]; then + exit -1 + fi + fi + + if [ "${PUBLISH}" == "1" ] && [ ! -z ${WIN_PACKAGE_SERVER} ]; then + scp ./win/*.exe ${WIN_PACKAGE_SERVER} + if [ "$?" != "0" ]; then + exit -1 + fi + fi + + rm -fr $TEMPDIR + rm -fr .${1}.cache + +} + +until [ -z "$1" ] +do + if [ ${1:0:2} = '--' ]; then + tmp=${1:2} + parameter=${tmp%%=*} + parameter=$(echo $parameter | tr "[:lower:]" "[:upper:]") + value=${tmp##*=} + + case "$parameter" in + NOPUBLISH) + PUBLISH=0 + ;; + + PUBLISH) + PUBLISH=1 + ;; + + CLEAR) + if [ -d ~/public_html/win ]; then + rm -fr ~/public_html/win/hllapi-*-{i686,x86_64}.exe + fi + + ;; + HELP) + echo "${0} nome_da_matriz" + echo "" + echo "Opções:" + echo "" + + if [ ! -z ${WIN_PACKAGE_SERVER} ]; then + echo " --nopublish Don't publish in ${WIN_PACKAGE_SERVER}" + echo " --publish Publish in ${WIN_PACKAGE_SERVER}" + fi + + + if [ -d ~/public_html/win ]; then + echo " --clear Remove ~/public_html/win/hllapi-*-{i686,x86_64}.exe" + fi + + echo "" + exit 0 + + ;; + + esac + fi + + shift + +done + +NOCONFIGURE=1 ./autogen.sh +if [ "$?" != "0" ]; then + exit -1 +fi + +pack i686 +pack x86_64 + + -- libgit2 0.21.2