forked from mirrors/principia
Building with CMake on Windows is mostly complete now
This commit is contained in:
parent
789b709097
commit
9a333119c5
20 changed files with 80 additions and 39607 deletions
BIN
packaging/icon.ico
Normal file
BIN
packaging/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
BIN
packaging/installer/unwelcome.bmp
Normal file
BIN
packaging/installer/unwelcome.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
BIN
packaging/installer/welcome.bmp
Normal file
BIN
packaging/installer/welcome.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
151
packaging/mingw-bundledlls
Normal file
151
packaging/mingw-bundledlls
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2015 Martin Preisler
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
|
||||
import subprocess
|
||||
import os.path
|
||||
import argparse
|
||||
import shutil
|
||||
|
||||
# The mingw path matches where Fedora 21 installs mingw32; this is the default
|
||||
# fallback if no other search path is specified in $MINGW_BUNDLEDLLS_SEARCH_PATH
|
||||
DEFAULT_PATH_PREFIXES = [
|
||||
"", "/usr/bin", "/usr/i686-w64-mingw32/sys-root/mingw/bin", "/mingw64/bin",
|
||||
"/usr/i686-w64-mingw32/sys-root/mingw/lib",
|
||||
"C:\\msys64\\mingw64\\bin",
|
||||
"D:\\a\\_temp\\msys64\\mingw64\\bin\\" # Github workflow's MSYS2 install
|
||||
]
|
||||
|
||||
env_path_prefixes = os.environ.get('MINGW_BUNDLEDLLS_SEARCH_PATH', None)
|
||||
if env_path_prefixes is not None:
|
||||
path_prefixes = [path for path in env_path_prefixes.split(os.pathsep) if path]
|
||||
else:
|
||||
path_prefixes = DEFAULT_PATH_PREFIXES
|
||||
|
||||
# This blacklist may need extending
|
||||
blacklist = [
|
||||
"advapi32.dll", "kernel32.dll", "msvcrt.dll", "ole32.dll", "user32.dll",
|
||||
"ws2_32.dll", "comdlg32.dll", "gdi32.dll", "imm32.dll", "oleaut32.dll",
|
||||
"shell32.dll", "winmm.dll", "winspool.drv", "wldap32.dll",
|
||||
"ntdll.dll", "d3d9.dll", "mpr.dll", "crypt32.dll", "dnsapi.dll",
|
||||
"shlwapi.dll", "version.dll", "iphlpapi.dll", "msimg32.dll", "setupapi.dll",
|
||||
"opengl32.dll", "dwmapi.dll", "uxtheme.dll", "secur32.dll", "gdiplus.dll",
|
||||
"usp10.dll", "comctl32.dll", "wsock32.dll", "netapi32.dll", "userenv.dll",
|
||||
"avicap32.dll", "avrt.dll", "psapi.dll", "mswsock.dll", "glu32.dll",
|
||||
"bcrypt.dll", "rpcrt4.dll", "hid.dll",
|
||||
# directx 3d 11
|
||||
"d3d11.dll", "dxgi.dll", "dwrite.dll"
|
||||
]
|
||||
|
||||
|
||||
def find_full_path(filename, path_prefixes):
|
||||
for path_prefix in path_prefixes:
|
||||
path = os.path.join(path_prefix, filename)
|
||||
path_low = os.path.join(path_prefix, filename.lower())
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
if os.path.exists(path_low):
|
||||
return path_low
|
||||
|
||||
else:
|
||||
raise RuntimeError(
|
||||
"Can't find " + filename + ". If it is an inbuilt Windows DLL, "
|
||||
"please add it to the blacklist variable in the script and send "
|
||||
"a pull request!"
|
||||
)
|
||||
|
||||
|
||||
def gather_deps(path, path_prefixes, seen):
|
||||
ret = [path]
|
||||
output = subprocess.check_output(["objdump", "-p", path]).decode(
|
||||
"utf-8", "replace").split("\n")
|
||||
for line in output:
|
||||
if not line.startswith("\tDLL Name: "):
|
||||
continue
|
||||
|
||||
dep = line.split("DLL Name: ")[1].strip()
|
||||
ldep = dep.lower()
|
||||
|
||||
if ldep in blacklist:
|
||||
continue
|
||||
|
||||
if ldep in seen:
|
||||
continue
|
||||
|
||||
dep_path = find_full_path(dep, path_prefixes)
|
||||
seen.add(ldep)
|
||||
subdeps = gather_deps(dep_path, path_prefixes, seen)
|
||||
ret.extend(subdeps)
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"exe_file",
|
||||
help="EXE or DLL file that you need to bundle dependencies for"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--copy",
|
||||
action="store_true",
|
||||
help="In addition to printing out the dependencies, also copy them next to the exe_file"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--upx",
|
||||
action="store_true",
|
||||
help="Only valid if --copy is provided. Run UPX on all the DLLs and EXE."
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.upx and not args.copy:
|
||||
raise RuntimeError("Can't run UPX if --copy hasn't been provided.")
|
||||
|
||||
all_deps = set(gather_deps(args.exe_file, path_prefixes, set()))
|
||||
all_deps.remove(args.exe_file)
|
||||
|
||||
print("\n".join(all_deps))
|
||||
|
||||
if args.copy:
|
||||
print("Copying enabled, will now copy all dependencies next to the exe_file.\n")
|
||||
|
||||
parent_dir = os.path.dirname(os.path.abspath(args.exe_file))
|
||||
|
||||
for dep in all_deps:
|
||||
target = os.path.join(parent_dir, os.path.basename(dep))
|
||||
|
||||
try:
|
||||
print("Copying '%s' to '%s'" % (dep, target))
|
||||
shutil.copy(dep, parent_dir)
|
||||
|
||||
except shutil.SameFileError:
|
||||
print("Dependency '%s' was already in target directory, "
|
||||
"skipping..." % (dep))
|
||||
|
||||
if args.upx:
|
||||
subprocess.call(["upx", target])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
22
packaging/principia.manifest
Normal file
22
packaging/principia.manifest
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!--This Id value indicates the application supports Windows Vista functionality -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!--This Id value indicates the application supports Windows 7 functionality-->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!--This Id value indicates the application supports Windows 8 functionality-->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!--This Id value indicates the application supports Windows 8.1 functionality-->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>True/PM</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
30
packaging/principia.rc
Normal file
30
packaging/principia.rc
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
1 ICON "icon.ico"
|
||||
1 24 "principia.manifest"
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,5,1,0
|
||||
PRODUCTVERSION 1,5,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bithack AB\0"
|
||||
VALUE "FileDescription", "Principia\0"
|
||||
VALUE "FileVersion", "1,5,1,0\0"
|
||||
VALUE "InternalName", "principia\0"
|
||||
VALUE "LegalCopyright", "Copyright © 2014 Bithack AB\0"
|
||||
VALUE "OriginalFilename", "principia.exe\0"
|
||||
VALUE "ProductName", "Principia\0"
|
||||
VALUE "ProductVersion", "1,5,1,0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
150
packaging/principia_install.nsi
Normal file
150
packaging/principia_install.nsi
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
!include "MUI2.nsh"
|
||||
|
||||
!define MUI_ICON "..\packaging\icon.ico"
|
||||
!define /ifndef VER_MAJOR 1
|
||||
!define /ifndef VER_MINOR 5
|
||||
!define /ifndef VER_BUILD 2
|
||||
|
||||
!define /ifndef VER_REVISION 1520
|
||||
|
||||
!define /ifndef VERSION '1.5.2 Beta'
|
||||
|
||||
Name "Principia"
|
||||
OutFile "principia-setup.exe"
|
||||
|
||||
InstallDir "$PROGRAMFILES\Principia"
|
||||
|
||||
;get install dir from registry if available
|
||||
InstallDirRegKey HKCU "Software\Bithack\Principia" ""
|
||||
|
||||
!define REG_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Principia"
|
||||
|
||||
BrandingText "Principia ${VERSION}"
|
||||
|
||||
RequestExecutionLevel admin
|
||||
|
||||
; Required because otherwise start menu and desktop shortcuts will be installed for only
|
||||
; the main administrator, even if a regular user escalating to admin installs it.
|
||||
Function .onInit
|
||||
SetShellVarContext All
|
||||
FunctionEnd
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_UNABORTWARNING
|
||||
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "..\packaging\installer\welcome.bmp"
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "..\packaging\installer\unwelcome.bmp"
|
||||
|
||||
!define MUI_FINISHPAGE_RUN "$INSTDIR/principia.exe"
|
||||
!define MUI_FINISHPAGE_RUN_TEXT "Run Principia"
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "..\LICENSE.md"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
|
||||
VIProductVersion ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD}
|
||||
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||
VIAddVersionKey "FileDescription" "Principia Setup"
|
||||
VIAddVersionKey "LegalCopyright" "Bithack AB"
|
||||
!endif
|
||||
|
||||
Section "Core Files (required)" SecCore
|
||||
|
||||
SectionIn RO
|
||||
SetOverwrite on
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
File "release\principia.exe"
|
||||
File /x "opengl32.dll" "release\*.dll"
|
||||
|
||||
File /r "release\lib"
|
||||
File /r "release\share"
|
||||
|
||||
SetOutPath "$INSTDIR\data-pc"
|
||||
File /r /x *.sw* "..\data-pc\bg"
|
||||
File /r /x *.sw* "..\data-pc\sfx"
|
||||
File /r /x *.sw* "..\data-pc\textures"
|
||||
SetOutPath "$INSTDIR\data-shared"
|
||||
File /r /x *.sw* "..\data-shared\bg"
|
||||
File /r /x *.sw* "..\data-shared\fonts"
|
||||
File /r /x *.sw* "..\data-shared\icons"
|
||||
File /r /x *.sw* "..\data-shared\lvl"
|
||||
File /r /x *.sw* "..\data-shared\models"
|
||||
File /r /x *.sw* "..\data-shared\pkg"
|
||||
File /r /x *.sw* "..\data-shared\shaders"
|
||||
File /r /x *.sw* "..\data-shared\textures"
|
||||
File /r /x *.sw* "..\data-shared\tiles"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Start Menu entry" SecSM
|
||||
|
||||
CreateDirectory $SMPROGRAMS\Principia
|
||||
CreateShortCut $SMPROGRAMS\Principia\Principia.lnk $INSTDIR\principia.exe
|
||||
|
||||
CreateShortCut $SMPROGRAMS\Principia\Uninstall.lnk $INSTDIR\uninst-principia.exe
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Desktop shortcut" SecDesktop
|
||||
|
||||
CreateShortCut $DESKTOP\Principia.lnk $INSTDIR\principia.exe
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section -post
|
||||
|
||||
WriteRegStr HKCR "principia" "" "URL:Principia"
|
||||
WriteRegStr HKCR "principia" "URL Protocol" ""
|
||||
WriteRegStr HKCR "principia" "DefaultIcon" ""
|
||||
WriteRegStr HKCR "principia\shell\open\command" "" '"$INSTDIR\principia.exe" %1'
|
||||
|
||||
WriteRegStr HKCU "Software\Bithack\Principia" "" $INSTDIR
|
||||
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
|
||||
WriteRegDword HKCU "Software\Bithack\Principia" "VersionMajor" "${VER_MAJOR}"
|
||||
WriteRegDword HKCU "Software\Bithack\Principia" "VersionMinor" "${VER_MINOR}"
|
||||
WriteRegDword HKCU "Software\Bithack\Principia" "VersionRevision" "${VER_REVISION}"
|
||||
WriteRegDword HKCU "Software\Bithack\Principia" "VersionBuild" "${VER_BUILD}"
|
||||
!endif
|
||||
|
||||
WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst-principia.exe"'
|
||||
WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "InstallLocation" "$INSTDIR"
|
||||
|
||||
WriteUninstaller "$INSTDIR\uninst-principia.exe"
|
||||
SectionEnd
|
||||
|
||||
LangString DESC_SecCore ${LANG_ENGLISH} "Contains the core files required to run Principia."
|
||||
LangString DESC_SecSM ${LANG_ENGLISH} "Create a Start Menu entry for Principia."
|
||||
LangString DESC_SecDesktop ${LANG_ENGLISH} "Create a shortcut to Principia on your desktop."
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(DESC_SecCore)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecSM} $(DESC_SecSM)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(DESC_SecDesktop)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
Delete "$INSTDIR\uninst-principia.exe"
|
||||
|
||||
RMDir /r "$INSTDIR"
|
||||
RMDir /r "$SMPROGRAMS\Principia"
|
||||
|
||||
; TODO: additional option on uninstall, if the ~/Principia-folder should be deleted
|
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Bithack\Principia"
|
||||
DeleteRegKey HKCR "principia"
|
||||
|
||||
SectionEnd
|
||||
28
packaging/windows_release.sh
Normal file
28
packaging/windows_release.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
# Commented out because I prefer doing the compilation mzself
|
||||
#./go --clean --release
|
||||
|
||||
rm -rf release
|
||||
mkdir -p release
|
||||
|
||||
cp principia.exe release/
|
||||
|
||||
cd release
|
||||
# collect up GTK3 junk to make it work
|
||||
PIXBUF_DIR="lib/gdk-pixbuf-2.0/2.10.0"
|
||||
mkdir -p $PIXBUF_DIR/loaders/
|
||||
cp /mingw64/$PIXBUF_DIR/loaders.cache $PIXBUF_DIR/
|
||||
cp /mingw64/$PIXBUF_DIR/loaders/libpixbufloader-{jpeg,png}.dll $PIXBUF_DIR/loaders/
|
||||
|
||||
SCHEMAS_DIR="share/glib-2.0/schemas"
|
||||
mkdir -p $SCHEMAS_DIR
|
||||
cp /mingw64/$SCHEMAS_DIR/{gschema.dtd,gschemas.compiled} $SCHEMAS_DIR/
|
||||
|
||||
cd ..
|
||||
|
||||
../packaging/mingw-bundledlls release/principia.exe --copy
|
||||
|
||||
cp ../packaging/principia_install.nsi .
|
||||
cp -r ../packaging/installer/ .
|
||||
|
||||
makensis principia_install
|
||||
Loading…
Add table
Add a link
Reference in a new issue