mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
more stuff for windows
This commit is contained in:
parent
4b86630b42
commit
b098fa1e43
|
@ -24,28 +24,17 @@ FFMPEG = {
|
|||
local apply = function(option, settings)
|
||||
if option.value == true then
|
||||
if option.use_pkgconfig then
|
||||
settings.cc.flags:Add("`pkg-config libavcodec --cflags`")
|
||||
settings.link.flags:Add("`pkg-config libavcodec --libs`")
|
||||
|
||||
settings.cc.flags:Add("`pkg-config libavformat --cflags`")
|
||||
settings.link.flags:Add("`pkg-config libavformat --libs`")
|
||||
|
||||
settings.cc.flags:Add("`pkg-config libavutil --cflags`")
|
||||
settings.link.flags:Add("`pkg-config libavutil --libs`")
|
||||
|
||||
settings.cc.flags:Add("`pkg-config libswscale --cflags`")
|
||||
settings.link.flags:Add("`pkg-config libswscale --libs`")
|
||||
|
||||
settings.cc.flags:Add("`pkg-config libswresample --cflags`")
|
||||
settings.link.flags:Add("`pkg-config libswresample --libs`")
|
||||
settings.cc.flags:Add("`pkg-config libavcodec libavformat libavutil libswscale libswresample --cflags`")
|
||||
settings.link.flags:Add("`pkg-config libavcodec libavformat libavutil libswscale libswresample --libs`")
|
||||
end
|
||||
|
||||
if platform == "win32" then
|
||||
client_settings.link.libpath:Add("other/ffmpeg/windows/lib32")
|
||||
settings.link.libpath:Add("other/ffmpeg/windows/lib32")
|
||||
elseif platform == "win64" then
|
||||
client_settings.link.libpath:Add("other/ffmpeg/windows/lib64")
|
||||
-- elseif platform == "macosx" and string.find(settings.config_name, "32") then
|
||||
-- client_settings.link.libpath:Add("other/ffmpeg/mac/lib32")
|
||||
settings.link.libpath:Add("other/ffmpeg/windows/lib64")
|
||||
-- elseif platform == "macosx" and not option.use_pkgconfig then
|
||||
-- settings.link.libpath:Add("other/ffmpeg/mac/lib64")
|
||||
-- settings.link.flags:Add("-lavcodec -lavformat -lavutil -lswscale -lswresample")
|
||||
-- elseif platform == "macosx" and string.find(settings.config_name, "64") then
|
||||
-- client_settings.link.libpath:Add("other/ffmpeg/mac/lib64")
|
||||
-- elseif platform == "linux" then
|
||||
|
@ -88,6 +77,7 @@ FFMPEG = {
|
|||
if option.use_pkgconfig == true then return "using pkg-config" end
|
||||
if option.use_winlib == 32 then return "using supplied win32 libraries" end
|
||||
if option.use_winlib == 64 then return "using supplied win64 libraries" end
|
||||
-- if platform == "macosx" then return "using supplied universal libraries" end
|
||||
return "using unknown method"
|
||||
else
|
||||
if option.required then
|
||||
|
|
233
scripts/make_release3.py
Executable file
233
scripts/make_release3.py
Executable file
|
@ -0,0 +1,233 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import zipfile
|
||||
import argparse
|
||||
|
||||
possible_platforms = ["win32", "win64", "osx", "linux", "src"]
|
||||
|
||||
parser = argparse.ArgumentParser(description="Make Release of DDNet")
|
||||
|
||||
parser.add_argument("version", type=str, help="The Version of DDNet (major.minior.patch)")
|
||||
parser.add_argument(
|
||||
"platform",
|
||||
type=str,
|
||||
help="The target Platform. You might want to use one of these: %s"
|
||||
% ' '.join(possible_platforms)
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("wrong number of arguments")
|
||||
print(sys.argv[0], "VERSION PLATFORM")
|
||||
sys.exit(-1)
|
||||
|
||||
name = "DDNet"
|
||||
version = args.version
|
||||
platform = args.platform
|
||||
exe_ext = ""
|
||||
use_zip = 0
|
||||
use_xz = 1
|
||||
use_dmg = 0
|
||||
use_bundle = 0
|
||||
include_data = True
|
||||
include_exe = True
|
||||
include_src = False
|
||||
|
||||
if platform == "src":
|
||||
include_data = True
|
||||
include_exe = False
|
||||
include_src = True
|
||||
use_zip = 1
|
||||
use_xz = 1
|
||||
|
||||
if platform == 'win32' or platform == 'win64':
|
||||
exe_ext = ".exe"
|
||||
use_zip = 1
|
||||
use_xz = 0
|
||||
if platform == 'osx':
|
||||
use_dmg = 1
|
||||
use_xz = 0
|
||||
use_bundle = 1
|
||||
|
||||
def copydir(src, dst, excl=[]):
|
||||
for root, dirs, files in os.walk(src, topdown=True):
|
||||
if "/." in root or "\\." in root:
|
||||
continue
|
||||
for name in dirs:
|
||||
if name[0] != '.':
|
||||
os.mkdir(os.path.join(dst, root, name))
|
||||
for name in files:
|
||||
if name[0] != '.':
|
||||
shutil.copy(os.path.join(root, name), os.path.join(dst, root, name))
|
||||
|
||||
package = "%s-%s-%s" % (name, version, platform)
|
||||
package_dir = package
|
||||
|
||||
print("cleaning target")
|
||||
shutil.rmtree(package_dir, True)
|
||||
os.mkdir(package_dir)
|
||||
|
||||
print("adding files")
|
||||
shutil.copy("license.txt", package_dir)
|
||||
shutil.copy("storage.cfg", package_dir)
|
||||
shutil.copy("autoexec_server.cfg", package_dir)
|
||||
|
||||
if include_data and not use_bundle:
|
||||
os.mkdir(os.path.join(package_dir, "data"))
|
||||
copydir("data", package_dir)
|
||||
if platform[:3] == "win":
|
||||
shutil.copy("other/config_directory.bat", package_dir)
|
||||
|
||||
for i in os.listdir():
|
||||
if i.endswith(".dll"):
|
||||
shutil.copy(i, package_dir)
|
||||
|
||||
if include_exe and not use_bundle:
|
||||
shutil.copy(name+exe_ext, package_dir)
|
||||
shutil.copy(name+"-Server"+exe_ext, package_dir)
|
||||
shutil.copy("dilate"+exe_ext, package_dir)
|
||||
shutil.copy("config_store"+exe_ext, package_dir)
|
||||
shutil.copy("config_retrieve"+exe_ext, package_dir)
|
||||
# shutil.copy(name+"-Server_sql"+exe_ext, package_dir)
|
||||
|
||||
if include_src:
|
||||
for p in ["src", "scripts", "datasrc", "other", "objs"]:
|
||||
os.mkdir(os.path.join(package_dir, p))
|
||||
copydir(p, package_dir)
|
||||
shutil.copy("bam.lua", package_dir)
|
||||
shutil.copy("configure.lua", package_dir)
|
||||
|
||||
if use_bundle:
|
||||
bins = [name, name+'-Server', 'dilate', 'config_store', 'config_retrieve', 'serverlaunch']
|
||||
platforms = ('x86', 'x86_64', 'ppc')
|
||||
for binary in bins:
|
||||
to_lipo = []
|
||||
for p in platforms:
|
||||
fname = binary+'_'+p
|
||||
if os.path.isfile(fname):
|
||||
to_lipo.append(fname)
|
||||
if to_lipo:
|
||||
os.system("lipo -create -output "+binary+" "+" ".join(to_lipo))
|
||||
|
||||
# create Teeworlds appfolder
|
||||
clientbundle_content_dir = os.path.join(package_dir, "DDNet.app/Contents")
|
||||
clientbundle_bin_dir = os.path.join(clientbundle_content_dir, "MacOS")
|
||||
clientbundle_resource_dir = os.path.join(clientbundle_content_dir, "Resources")
|
||||
clientbundle_framework_dir = os.path.join(clientbundle_content_dir, "Frameworks")
|
||||
binary_path = clientbundle_bin_dir + "/" + name+exe_ext
|
||||
os.mkdir(os.path.join(package_dir, "DDNet.app"))
|
||||
os.mkdir(clientbundle_content_dir)
|
||||
os.mkdir(clientbundle_bin_dir)
|
||||
os.mkdir(clientbundle_resource_dir)
|
||||
os.mkdir(clientbundle_framework_dir)
|
||||
os.mkdir(os.path.join(clientbundle_resource_dir, "data"))
|
||||
copydir("data", clientbundle_resource_dir)
|
||||
|
||||
shutil.copy("other/icons/DDNet.icns", clientbundle_resource_dir)
|
||||
# shutil.copy("other/icons/Teeworlds.icns", clientbundle_resource_dir)
|
||||
shutil.copy(name+exe_ext, clientbundle_bin_dir)
|
||||
os.system("install_name_tool -change /opt/X11/lib/libfreetype.6.dylib @executable_path/../Frameworks/libfreetype.6.dylib " + binary_path)
|
||||
os.system("install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/../Frameworks/SDL2.framework/SDL2 " + binary_path)
|
||||
os.system("cp -R /Library/Frameworks/SDL2.framework " + clientbundle_framework_dir)
|
||||
os.system("cp /opt/X11/lib/libfreetype.6.dylib " + clientbundle_framework_dir)
|
||||
|
||||
with open(os.path.join(clientbundle_content_dir, "Info.plist"), "w") as f:
|
||||
f.write("""
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>DDNet</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>DDNet</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>%s</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.DDNetClient.app</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
""" % (version))
|
||||
|
||||
with open(os.path.join(clientbundle_content_dir, "PkgInfo"), "w") as f:
|
||||
f.write("APPL????")
|
||||
|
||||
# create Teeworlds Server appfolder
|
||||
serverbundle_content_dir = os.path.join(package_dir, "DDNet-Server.app/Contents")
|
||||
serverbundle_bin_dir = os.path.join(serverbundle_content_dir, "MacOS")
|
||||
serverbundle_resource_dir = os.path.join(serverbundle_content_dir, "Resources")
|
||||
os.mkdir(os.path.join(package_dir, "DDNet-Server.app"))
|
||||
os.mkdir(serverbundle_content_dir)
|
||||
os.mkdir(serverbundle_bin_dir)
|
||||
os.mkdir(serverbundle_resource_dir)
|
||||
os.mkdir(os.path.join(serverbundle_resource_dir, "data"))
|
||||
os.mkdir(os.path.join(serverbundle_resource_dir, "data/maps"))
|
||||
os.mkdir(os.path.join(serverbundle_resource_dir, "data/mapres"))
|
||||
copydir("data/maps", serverbundle_resource_dir)
|
||||
shutil.copy("other/icons/DDNet-Server.icns", serverbundle_resource_dir)
|
||||
shutil.copy(name+"-Server"+exe_ext, serverbundle_bin_dir)
|
||||
shutil.copy("serverlaunch"+exe_ext, serverbundle_bin_dir + "/"+name+"_server")
|
||||
|
||||
with open(os.path.join(clientbundle_content_dir, "Info.plist"), "w") as f:
|
||||
f.write("""
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>DDNet_server</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>DDNet-Server</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>%s</string>
|
||||
</dict>
|
||||
</plist>
|
||||
""" % (version))
|
||||
with open(os.path.join(clientbundle_content_dir, "PkgInfo"), "w") as f:
|
||||
f.write("APPL????")
|
||||
|
||||
if use_zip:
|
||||
print("making zip archive")
|
||||
zf = zipfile.ZipFile("%s.zip" % package, 'w', zipfile.ZIP_DEFLATED)
|
||||
|
||||
for root, dirs, files in os.walk(package_dir, topdown=True):
|
||||
for name in files:
|
||||
n = os.path.join(root, name)
|
||||
zf.write(n, n)
|
||||
# zf.printdir()
|
||||
zf.close()
|
||||
|
||||
if use_xz:
|
||||
print("making tar.xz archive")
|
||||
os.system("XZ_OPT=-9 tar cJf %s.tar.xz %s" % (package, package_dir))
|
||||
|
||||
if use_dmg:
|
||||
print("making disk image")
|
||||
os.system("rm -f %s.dmg %s_temp.dmg" % (package, package))
|
||||
os.system("hdiutil create -srcfolder %s -volname DDNet -quiet %s_temp" % (package_dir, package))
|
||||
os.system("hdiutil convert %s_temp.dmg -format UDBZ -o %s.dmg -quiet" % (package, package))
|
||||
os.system("rm -f %s_temp.dmg" % package)
|
||||
|
||||
print("done")
|
Loading…
Reference in a new issue