mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-04 08:55:36 -05:00
Rewrote Windows build instructions for Windows 10 (fixes #227). Also, switched from sha1 to sha256 for Authenticate codesigning, and updated NSIS config for the Windows installer.
This commit is contained in:
parent
4cfffbf847
commit
064bcb032c
18
BUILD.md
18
BUILD.md
@ -71,27 +71,27 @@ Now you should have `dist/OnionShare.pkg`.
|
||||
|
||||
## Windows
|
||||
|
||||
These instructions assume you're running Windows 10. They should work for other versions of Windows too, except for perhaps installing the Windows SDK which is required if you want to sign binaries with Authenticode.
|
||||
|
||||
### Setting up your dev environment
|
||||
|
||||
* Download and install the latest python 2.7 from https://www.python.org/downloads/ -- make sure you install the 32-bit version.
|
||||
* Right click on Computer, go to Properties. Click "Advanced system settings". Click Environment Variables. Under "System variables" double-click on Path to edit it. Add `;C:\Python27;C:\Python27\Scripts` to the end. Now you can just type `python` to run python scripts in the command prompt.
|
||||
* Go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path, and add `C:\Python27` and `C:\Python27\Scripts`. Now you can just type `python` to run python scripts in the command prompt.
|
||||
* Go to https://pip.pypa.io/en/latest/installing.html. Right-click on `get-pip.py` and Save Link As, and save it to your home folder.
|
||||
* Open `cmd.exe` as an administrator. Type: `python get-pip.py`. Now you can use `pip` to install packages.
|
||||
* Open a command prompt and type: `python get-pip.py`. Now you can use `pip` to install packages.
|
||||
* Open a command prompt and type: `pip install flask stem pyinstaller`
|
||||
* Go to http://www.riverbankcomputing.com/software/pyqt/download and download the latest PyQt4 for Windows for python 2.7, 32-bit (I downloaded `PyQt4-4.11-gpl-Py2.7-Qt4.8.6-x32.exe`), then install it.
|
||||
* Go to http://sourceforge.net/projects/pywin32/ and download and install the latest 32-bit pywin32 binary for python 2.7. I downloaded `pywin32-219.win32-py2.7.exe`.
|
||||
* Download and install the [Microsoft Visual C++ 2008 Redistributable Package (x86)](http://www.microsoft.com/en-us/download/details.aspx?id=29).
|
||||
|
||||
If you want to build the installer:
|
||||
|
||||
* Go to http://nsis.sourceforge.net/Download and download the latest NSIS. I downloaded `nsis-3.0b0-setup.exe`.
|
||||
* Right click on Computer, go to Properties. Click "Advanced system settings". Click Environment Variables. Under "System variables" double-click on Path to edit it. Add `;C:\Program Files (x86)\NSIS` to the end. Now you can just type `makensisw [script]` to build an installer.
|
||||
* Go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path, and add `C:\Program Files (x86)\NSIS` to the end. Now you can just type `makensis [script]` to build an installer.
|
||||
|
||||
If you want to sign binaries with Authenticode:
|
||||
|
||||
* Go to http://msdn.microsoft.com/en-us/vstudio/aa496123 and install the latest .NET Framework. I installed `.NET Framework 4.5.1`.
|
||||
* Go to http://www.microsoft.com/en-us/download/confirmation.aspx?id=8279 and install the Windows SDK.
|
||||
* Right click on Computer, go to Properties. Click "Advanced system settings". Click Environment Variables. Under "System variables" double-click on Path to edit it. Add `;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin` to the end.
|
||||
* Go to https://dev.windows.com/en-us/downloads/windows-10-sdk and install the standalone Windows 10 SDK. Note that you may not need this if you already have Visual Studio.
|
||||
* Go to Start and type "advanced system settings", and open "View advanced system settings" in the Control Panel. Click Environment Variables. Under "System variables" double-click on Path, and add `C:\Program Files (x86)\Windows Kits\10\bin\x86`.
|
||||
* You'll also, of course, need a code signing certificate. I roughly followed [this guide](http://blog.assarbad.net/20110513/startssl-code-signing-certificate/) to make one using my StartSSL account.
|
||||
* Once you get a code signing key and certificate and covert it to a pfx file, import it into your certificate store.
|
||||
|
||||
@ -101,11 +101,11 @@ If you want to sign binaries with Authenticode:
|
||||
|
||||
### To build the installer:
|
||||
|
||||
Note that you must have a code signing certificate installed in order to use the `install\build_exe.bat` script, because it tries code signing both `onionshare.exe` and `OnionShare_Setup.exe`.
|
||||
Note that you must have a codesigning certificate installed in order to use the `install\build_exe.bat` script, because it codesigns `onionshare.exe`, `uninstall.exe`, and `OnionShare_Setup.exe`.
|
||||
|
||||
Open a command prompt, cd to the onionshare directory, and type: `install\build_exe.bat`
|
||||
|
||||
A NSIS window will pop up, and once it's done you will have `dist\OnionShare_Setup.exe`.
|
||||
This will prompt you to codesign three binaries and execute one unsigned binary. When you're done clicking through everything you will have `dist\OnionShare_Setup.exe`.
|
||||
|
||||
## Tests
|
||||
|
||||
|
@ -2,13 +2,10 @@ REM use pyinstaller to builder a folder with onionshare.exe
|
||||
pyinstaller -y install\onionshare-win.spec
|
||||
|
||||
REM sign onionshare.exe
|
||||
signtool.exe sign /v /d "OnionShare" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll dist\onionshare\onionshare.exe
|
||||
|
||||
REM run onionshare once, to compile the .py files into .pyc
|
||||
dist\onionshare\onionshare.exe --help
|
||||
signtool.exe sign /v /d "OnionShare" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll /fd sha256 dist\onionshare\onionshare.exe
|
||||
|
||||
REM build an installer, dist\OnionShare_Setup.exe
|
||||
makensisw install\onionshare.nsi
|
||||
makensis.exe install\onionshare.nsi
|
||||
|
||||
REM sign OnionShare_Setup.exe
|
||||
signtool.exe sign /v /d "OnionShare" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll dist\OnionShare_Setup.exe
|
||||
signtool.exe sign /v /d "OnionShare" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll /fd sha256 dist\OnionShare_Setup.exe
|
||||
|
@ -1,6 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
a = Analysis(['onionshare-launcher.py'],
|
||||
hiddenimports=['onionshare', 'onionshare_gui'],
|
||||
excludes=['_tkinter'],
|
||||
hookspath=None,
|
||||
runtime_hooks=None)
|
||||
a.datas += [
|
||||
|
@ -1,9 +1,9 @@
|
||||
!define APPNAME "OnionShare"
|
||||
!define BINPATH "..\dist\onionshare"
|
||||
!define ABOUTURL "https://onionshare.org/"
|
||||
!define ABOUTURL "https:\\onionshare.org\"
|
||||
|
||||
# change these with each release
|
||||
!define INSTALLSIZE 31187
|
||||
!define INSTALLSIZE 31616
|
||||
!define VERSIONMAJOR 0
|
||||
!define VERSIONMINOR 7
|
||||
!define VERSIONSTRING "0.7.1"
|
||||
@ -32,16 +32,16 @@ ${EndIf}
|
||||
!macroend
|
||||
|
||||
# in order to code sign uninstall.exe, we need to do some hacky stuff outlined
|
||||
# here: http://nsis.sourceforge.net/Signing_an_Uninstaller
|
||||
# here: http:\\nsis.sourceforge.net\Signing_an_Uninstaller
|
||||
!ifdef INNER
|
||||
!echo "Creating uninstall.exe"
|
||||
OutFile "$%TEMP%\tempinstaller.exe"
|
||||
SetCompress off
|
||||
!else
|
||||
!echo "Creating normal installer"
|
||||
!system "$\"${NSISDIR}\makensis$\" /DINNER onionshare.nsi" = 0
|
||||
!system "makensis.exe /DINNER onionshare.nsi" = 0
|
||||
!system "$%TEMP%\tempinstaller.exe" = 2
|
||||
!system "signtool.exe sign /v /d $\"Uninstall OnionShare$\" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll $%TEMP%\uninstall.exe" = 0
|
||||
!system "signtool.exe sign /v /d $\"Uninstall OnionShare$\" /a /tr http://timestamp.globalsign.com/scripts/timstamp.dll /fd sha256 $%TEMP%\uninstall.exe" = 0
|
||||
|
||||
# all done, now we can build the real installer
|
||||
OutFile "..\dist\OnionShare_Setup.exe"
|
||||
@ -63,37 +63,25 @@ Section "install"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "onionshare.ico"
|
||||
File "${BINPATH}\onionshare.exe"
|
||||
File "${BINPATH}\LICENSE"
|
||||
File "${BINPATH}\license"
|
||||
SetOutPath "$INSTDIR\onionshare"
|
||||
File "${BINPATH}\onionshare\__init__.py"
|
||||
File "${BINPATH}\onionshare\__init__.pyc"
|
||||
File "${BINPATH}\onionshare\404.html"
|
||||
File "${BINPATH}\onionshare\helpers.py"
|
||||
File "${BINPATH}\onionshare\helpers.pyc"
|
||||
File "${BINPATH}\onionshare\hs.py"
|
||||
File "${BINPATH}\onionshare\index.html"
|
||||
File "${BINPATH}\onionshare\onionshare.py"
|
||||
File "${BINPATH}\onionshare\onionshare.pyc"
|
||||
File "${BINPATH}\onionshare\socks.py"
|
||||
File "${BINPATH}\onionshare\socks.pyc"
|
||||
File "${BINPATH}\onionshare\strings.py"
|
||||
File "${BINPATH}\onionshare\strings.pyc"
|
||||
File "${BINPATH}\onionshare\web.py"
|
||||
File "${BINPATH}\onionshare\web.pyc"
|
||||
SetOutPath "$INSTDIR\onionshare_gui"
|
||||
File "${BINPATH}\onionshare_gui\__init__.py"
|
||||
File "${BINPATH}\onionshare_gui\__init__.pyc"
|
||||
File "${BINPATH}\onionshare_gui\common.py"
|
||||
File "${BINPATH}\onionshare_gui\common.pyc"
|
||||
File "${BINPATH}\onionshare_gui\downloads.py"
|
||||
File "${BINPATH}\onionshare_gui\downloads.pyc"
|
||||
File "${BINPATH}\onionshare_gui\file_selection.py"
|
||||
File "${BINPATH}\onionshare_gui\file_selection.pyc"
|
||||
File "${BINPATH}\onionshare_gui\onionshare_gui.py"
|
||||
File "${BINPATH}\onionshare_gui\onionshare_gui.pyc"
|
||||
File "${BINPATH}\onionshare_gui\options.py"
|
||||
File "${BINPATH}\onionshare_gui\options.pyc"
|
||||
File "${BINPATH}\onionshare_gui\server_status.py"
|
||||
File "${BINPATH}\onionshare_gui\server_status.pyc"
|
||||
SetOutPath "$INSTDIR\images"
|
||||
File "${BINPATH}\images\logo.png"
|
||||
File "${BINPATH}\images\drop_files.png"
|
||||
@ -120,7 +108,7 @@ Section "install"
|
||||
File "${BINPATH}\_socket.pyd"
|
||||
File "${BINPATH}\_ssl.pyd"
|
||||
File "${BINPATH}\bz2.pyd"
|
||||
File "${BINPATH}\Microsoft.VC90.CRT.manifest"
|
||||
File "${BINPATH}\microsoft.vc90.crt.manifest"
|
||||
File "${BINPATH}\msvcm90.dll"
|
||||
File "${BINPATH}\msvcp90.dll"
|
||||
File "${BINPATH}\msvcr90.dll"
|
||||
@ -130,11 +118,11 @@ Section "install"
|
||||
File "${BINPATH}\PyQt4.QtGui.pyd"
|
||||
File "${BINPATH}\python27.dll"
|
||||
File "${BINPATH}\pywintypes27.dll"
|
||||
File "${BINPATH}\QtCore4.dll"
|
||||
File "${BINPATH}\QtGui4.dll"
|
||||
File "${BINPATH}\QtOpenGL4.dll"
|
||||
File "${BINPATH}\QtSvg4.dll"
|
||||
File "${BINPATH}\QtXml4.dll"
|
||||
File "${BINPATH}\qtcore4.dll"
|
||||
File "${BINPATH}\qtgui4.dll"
|
||||
File "${BINPATH}\qtopengl4.dll"
|
||||
File "${BINPATH}\qtsvg4.dll"
|
||||
File "${BINPATH}\qtxml4.dll"
|
||||
File "${BINPATH}\select.pyd"
|
||||
File "${BINPATH}\sip.pyd"
|
||||
File "${BINPATH}\unicodedata.pyd"
|
||||
@ -160,7 +148,7 @@ Section "install"
|
||||
File "${BINPATH}\qt4_plugins\imageformats\qsvg4.dll"
|
||||
File "${BINPATH}\qt4_plugins\imageformats\qtga4.dll"
|
||||
File "${BINPATH}\qt4_plugins\imageformats\qtiff4.dll"
|
||||
SetOutPath "$INSTDIR\Include"
|
||||
SetOutPath "$INSTDIR\include"
|
||||
File "${BINPATH}\Include\pyconfig.h"
|
||||
|
||||
# uninstaller
|
||||
@ -172,10 +160,10 @@ Section "install"
|
||||
# start menu
|
||||
CreateShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\onionshare.exe" "" "$INSTDIR\onionshare.ico"
|
||||
|
||||
# registry information for add/remove programs
|
||||
# registry information for add\remove programs
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" \S"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\onionshare.ico$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
|
||||
@ -185,7 +173,7 @@ Section "install"
|
||||
# there is no option for modifying or repairing the install
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
|
||||
# set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
|
||||
# set the INSTALLSIZE constant (!defined at the top of this script) so Add\Remove Programs can accurately report the size
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
|
||||
SectionEnd
|
||||
|
||||
@ -210,33 +198,21 @@ FunctionEnd
|
||||
Delete "$INSTDIR\onionshare.ico"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
Delete "$INSTDIR\onionshare\__init__.py"
|
||||
Delete "$INSTDIR\onionshare\__init__.pyc"
|
||||
Delete "$INSTDIR\onionshare\404.html"
|
||||
Delete "$INSTDIR\onionshare\helpers.py"
|
||||
Delete "$INSTDIR\onionshare\helpers.pyc"
|
||||
Delete "$INSTDIR\onionshare\hs.py"
|
||||
Delete "$INSTDIR\onionshare\index.html"
|
||||
Delete "$INSTDIR\onionshare\onionshare.py"
|
||||
Delete "$INSTDIR\onionshare\onionshare.pyc"
|
||||
Delete "$INSTDIR\onionshare\socks.py"
|
||||
Delete "$INSTDIR\onionshare\socks.pyc"
|
||||
Delete "$INSTDIR\onionshare\strings.py"
|
||||
Delete "$INSTDIR\onionshare\strings.pyc"
|
||||
Delete "$INSTDIR\onionshare\web.py"
|
||||
Delete "$INSTDIR\onionshare\web.pyc"
|
||||
Delete "$INSTDIR\onionshare_gui\__init__.py"
|
||||
Delete "$INSTDIR\onionshare_gui\__init__.pyc"
|
||||
Delete "$INSTDIR\onionshare_gui\common.py"
|
||||
Delete "$INSTDIR\onionshare_gui\common.pyc"
|
||||
Delete "$INSTDIR\onionshare_gui\downloads.py"
|
||||
Delete "$INSTDIR\onionshare_gui\downloads.pyc"
|
||||
Delete "$INSTDIR\onionshare_gui\file_selection.py"
|
||||
Delete "$INSTDIR\onionshare_gui\file_selection.pyc"
|
||||
Delete "$INSTDIR\onionshare_gui\onionshare_gui.py"
|
||||
Delete "$INSTDIR\onionshare_gui\onionshare_gui.pyc"
|
||||
Delete "$INSTDIR\onionshare_gui\options.py"
|
||||
Delete "$INSTDIR\onionshare_gui\options.pyc"
|
||||
Delete "$INSTDIR\onionshare_gui\server_status.py"
|
||||
Delete "$INSTDIR\onionshare_gui\server_status.pyc"
|
||||
Delete "$INSTDIR\images\logo.png"
|
||||
Delete "$INSTDIR\images\drop_files.png"
|
||||
Delete "$INSTDIR\images\server_stopped.png"
|
||||
|
Loading…
x
Reference in New Issue
Block a user