[win] add windows package files

This commit is contained in:
lins_win 2012-08-21 11:57:47 +08:00 committed by lins05
parent 4988d70d7c
commit e9f1b56b10
12 changed files with 394 additions and 0 deletions

4
dll2pyd.sh Normal file
View File

@ -0,0 +1,4 @@
#! /bin/sh
INSTALL_DIR=${PYTHONPATH}
cp -f ${INSTALL_DIR}/ccnet/cclient.dll ${INSTALL_DIR}/ccnet/cclient.pyd

17
msi/Includes.wxi Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Include Id="SeafileInclude">
<?define CurrentSeafileVersion="1.0.0" ?> <!-- beta -->
<?define Manufacturer="海文互知" ?>
<!-- Update Guid 不能变 -->
<?define CurrentUpdateGuid="65DED1C8-A5F1-4C49-8E7E-B0A8A5A6535C" ?>
<!-- 每个新版本必须重新生成 Product Guid -->
<!-- <?define ProductGuid="5D46888B-A960-4E37-9468-54EFB323610F" ?> (0.9.3) -->
<!-- <?define ProductGuid="9ADCC6CF-41E8-4CB7-B48B-5CC87867DF20" ?> (0.9.4) -->
<!-- <?define ProductGuid="137667A1-02F1-4BE3-9B1A-EC0B3DB23ED2" ?> (0.9.5) -->
<?define ProductGuid="DB1C9EB4-F629-43AE-8B46-F5596AC8B8F1" ?>
</Include>

46
msi/README.markdown Normal file
View File

@ -0,0 +1,46 @@
How to build seafile Windows MSI installer
===========
* Download Wix toolset.
http://wix.sourceforge.net/downloadv35.html
And extract downloaded zip file to someplace, such as c:/wix. And add it to system PATH.
* Download Paraffin.exe:
http://www.wintellect.com/CS/files/folders/7420/download.aspx
And put Paraffin.exe to c:/wix
* Compile & install ccnet:
cd ccnet; make && make install
cd seafile; make && make install
* cd msi/custom; make; make x64;
* ./dll2pyd.sh; ./setupwin.sh /c/pack
* Compile msi using Wix:
cd /c/pack; make fragment.wxs; <Edit fragment.wxs> ; make ;
* Now you have the package available in /c/pack/seafile.msi
Edit fragment.wxs
=======
Remove the following items from both <Component> and <ComponentRef>
* seafile-applet.exe
Upgrade
=========
Every time a new version is released, you just need to edit Includes.wxi:
1) Generate a new <ProductGuid>
2) Update <CurrentSeafileVersion>
And go through the compiling process above.

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
The use and distribution terms for this software are covered by the
Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
which can be found in the file CPL.TXT at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not remove this notice, or any other, from this software.
-->
<!--
First-time install dialog sequence:
- WixUI_WelcomeDlg
- WixUI_LicenseAgreementDlg
- WixUI_InstallDirDlg
- WixUI_VerifyReadyDlg
- WixUI_DiskCostDlg
Maintenance dialog sequence:
- WixUI_MaintenanceWelcomeDlg
- WixUI_MaintenanceTypeDlg
- WixUI_InstallDirDlg
- WixUI_VerifyReadyDlg
Patch dialog sequence:
- WixUI_WelcomeDlg
- WixUI_VerifyReadyDlg
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="WixUI_InstallDir_NoLicense">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_Common" />
</Fragment>
</Wix>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable/>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"
/>
<file name="msvcr90.dll" /> <file name="msvcp90.dll" /> <file name="msvcm90.dll" />
</assembly>

32
msi/custom/Makefile Normal file
View File

@ -0,0 +1,32 @@
CC64 = x86_64-w64-mingw32-gcc.exe
DLLWRAP64 = x86_64-w64-mingw32-dllwrap.exe
CC32 = gcc.exe
DLLWRAP32 = dllwrap.exe
all: seafile_custom32.dll seafile_custom64.dll
CFLAGS = -Wall -O2
DLLWRAPFLAGS = -Wl,--enable-stdcall-fixup
custom32.o: custom.c
$(CC32) $(CFLAGS) custom.c -c -o $@
custom64.o: custom.c
C_INCLUDE_PATH= $(CC64) $(CFLAGS) custom.c -c -o $@
seafile_custom32.dll: custom32.o
$(DLLWRAP32) $(DLLWRAPFLAGS) --def custom.def $< -o $@
seafile_custom64.dll: custom64.o
$(DLLWRAP64) $(DLLWRAPFLAGS) --def custom.def $< -o $@
clean:
rm -f *.o *.dll
install:
uninstall:
distclean:
.PHONY: all clean

27
msi/custom/custom.c Normal file
View File

@ -0,0 +1,27 @@
#include <windows.h>
#define S_WINDOW_NAME "seafile-applet"
/* UINT __stdcall TerminateSeafile(MSIHANDLE hModule) */
UINT __stdcall TerminateSeafile(HANDLE hModule)
{
HWND hWnd = FindWindow(S_WINDOW_NAME, S_WINDOW_NAME);
if (hWnd)
{
PostMessage(hWnd, WM_CLOSE, (WPARAM)NULL, (LPARAM)NULL);
int i;
for (i = 0; i < 10; ++i)
{
Sleep(500);
if (!IsWindow(hWnd))
{
/* seafile-applet is now killed. */
return ERROR_SUCCESS;
}
}
return ERROR_SUCCESS;
}
/* seafile-applet is not running. */
return ERROR_SUCCESS;
}

3
msi/custom/custom.def Normal file
View File

@ -0,0 +1,3 @@
LIBRARY seafile_custom
EXPORTS
TerminateSeafile

BIN
msi/seafile-background.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 KiB

BIN
msi/seafile-top-banner.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

117
msi/seafile.wxs Normal file
View File

@ -0,0 +1,117 @@
<?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<?include Includes.wxi?>
<Product Id="$(var.ProductGuid)"
Name='Seafile $(var.CurrentSeafileVersion)'
Language='1033'
Version='$(var.CurrentSeafileVersion)'
Manufacturer='$(var.Manufacturer)'
UpgradeCode="$(var.CurrentUpdateGuid)" >
<!-- We set InstallScope to perMachine to install for all users -->
<Package Description='Seafile 安装包' Comments='Seafile 安装包'
Manufacturer='$(var.Manufacturer)'
InstallerVersion='200'
InstallPrivileges='elevated' InstallScope='perMachine'
Compressed='yes' />
<!-- Don't allow downgrade. -->
<MajorUpgrade
DowngradeErrorMessage="检测到您已经安装了更新版本的 Seafile 。安装程序将自动退出。" />
<Media Id='1' Cabinet='seafile.cab' EmbedCab='yes' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id="DesktopFolder" Name="DesktopFolder" />
<Directory Id="ProgramMenuFolder">
<Directory Id="SeafileStartMenuFolder" Name="Seafile" />
</Directory>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='INSTALLDIR' Name='Seafile'>
<Directory Id='bin_Dir' Name='bin'>
<Component Id='comp_custom' Guid='A8CD54F6-9BFB-11E1-9B0E-001CBFC5CA1D'>
<RegistryKey Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Action="createAndRemoveOnUninstall">
<RegistryValue Name="CustomComponent" Value="1" Type="integer" KeyPath='yes' />
</RegistryKey>
<File Id='seafileapplet.exe' Source='bin\seafile-applet.exe' />
<!-- seafile shortcut on desktop -->
<Shortcut Id="ApplicationDesktopShortCut" Directory="DesktopFolder"
Name="Seafile" Target="[#seafileapplet.exe]"
Hotkey="0" IconIndex="0" Show="normal"
WorkingDirectory="bin_Dir" />
<Shortcut Id="ApplicationStartMenuShortCut" Directory="SeafileStartMenuFolder"
Name="启动 Seafile" Target="[#seafileapplet.exe]"
Hotkey="0" IconIndex="0" Show="normal"
WorkingDirectory="bin_Dir" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="SeafileStartMenuFolder" >
<Component Id="Seafile_StartMenuShortCut" Guid="F1662C95-6C0A-4CDD-B009-C5E66A4F8C80" >
<!-- shortcut to 'Uninstall' -->
<Shortcut Id="UninstallProduct" Name="删除 Seafile"
Target="[SystemFolder]msiexec.exe" IconIndex="0"
Arguments="/x [ProductCode]" Description="删除 Seafile" />
<RemoveFolder Id="SeafileStartMenuFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]"
Name="installed" Type="integer" Value="1" KeyPath='yes' />
</Component>
</DirectoryRef>
<Binary Id='seafile_custom_dll32' SourceFile='custom\seafile_custom32.dll' />
<Binary Id='seafile_custom_dll64' SourceFile='custom\seafile_custom64.dll' />
<CustomAction Id="KillSeafile" BinaryKey="seafile_custom_dll32" DllEntry="TerminateSeafile" Execute="immediate" />
<CustomAction Id="KillSeafile64" BinaryKey="seafile_custom_dll64" DllEntry="TerminateSeafile" Execute="immediate" />
<InstallExecuteSequence>
<!-- Ask seafile-applet to quit before uninstall -->
<Custom Action="KillSeafile" Before="InstallValidate">
Installed AND (NOT VersionNT64)
</Custom>
<Custom Action="KillSeafile64" Before="InstallValidate">
Installed AND VersionNT64
</Custom>
</InstallExecuteSequence>
<!-- UI related -->
<Property Id='WIXUI_INSTALLDIR' Value="INSTALLDIR" />
<UI>
<UIRef Id='WixUI_InstallDir_NoLicense' />
<UIRef Id='WixUI_ErrorProgressText' />
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">
<!-- Launch Seafile after setup. -->
NOT Installed
</Publish>
</UI>
<Property Id="WixShellExecTarget" Value="[#seafileapplet.exe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Feature Id='Main' Level='1'>
<ComponentRef Id='Seafile_StartMenuShortCut' />
<ComponentRef Id='comp_custom' />
<!-- defined in fragment.wxs -->
<ComponentGroupRef Id='group_bin' />
</Feature>
<Property Id="CHECKBOX_DEL_SEAFILE_DATA" Secure="yes" />
<WixVariable Id="WixUIBannerBmp" Value="seafile-top-banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="seafile-background.bmp" />
</Product>
</Wix>

46
setupwin.sh Normal file
View File

@ -0,0 +1,46 @@
#! /bin/bash
set -e
TARGET_DIR=/c/pack
if [[ $# != 1 ]] ; then
echo
echo "Usage: ./setupwin.sh <target_dir>"
exit 1;
else
TARGET_DIR=$1
fi
if [[ ! -d ${TARGET_DIR} ]]; then
echo
echo "${TARGET_DIR} is not a valid directory"
exit 1;
fi
echo "target directory is" ${TARGET_DIR}
BIN_DIR=${TARGET_DIR}/bin
mkdir -p "${BIN_DIR}"
cp -f `which libsearpc-1.dll` "${BIN_DIR}"
cp -f `which libsearpc-json-glib-0.dll` "${BIN_DIR}"
cp daemon/.libs/seaf-daemon.exe "${BIN_DIR}"
cp lib/.libs/libseafile-0.dll "${BIN_DIR}"
cp -f gui/win/seafile-applet.exe "${BIN_DIR}"
# python related files. This will copy all dlls that it depends on
# (libevent, libssl, libsqlite3)... as well
pushd web
python websetup.py py2exe
cp -rf dist/* "${BIN_DIR}/"
rm -rf dist
rm -rf build
popd
# copy Wix source files and Makefile
cp -rf msi/* "${TARGET_DIR}"