Skip to content

Commit

Permalink
Fix Source2 linux packaging layout (#120)
Browse files Browse the repository at this point in the history
* Fix linux packaging layout
* Split binary layouts per sdk
  • Loading branch information
GAMMACASE authored Sep 29, 2023
1 parent 0e81445 commit 62dd3dd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
3 changes: 1 addition & 2 deletions core/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ for sdk_name in MMS.sdks:
'vsp_bridge.cpp'
]

# Source2 hack. TODO: check this more deterministically, "are we doing an x64 build?"
if binary.compiler.target.arch == 'x86':
if cxx.target.arch == 'x86':
binary.sources += ['sourcehook/sourcehook_hookmangen.cpp']
nodes = builder.Add(binary)
MMS.binaries += [nodes]
7 changes: 4 additions & 3 deletions loader/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ def configure_library(cxx, name, linux_defines):

for cxx in MMS.all_targets:
if cxx.target.platform == 'linux':
if cxx.target.arch == 'x64':
if cxx.target.arch == 'x86_64':
configure_library(cxx, 'libserver', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])
elif cxx.target.arch == 'x86':
configure_library(cxx, 'server_i486', ['LIB_PREFIX=""', 'LIB_SUFFIX="_i486.so"'])

configure_library(cxx, 'server', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])
configure_library(cxx, 'server', ['LIB_PREFIX=""', 'LIB_SUFFIX=".so"'])
else:
configure_library(cxx, 'server', [])
19 changes: 18 additions & 1 deletion support/buildbot/PackageScript
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import os

builder.SetBuildFolder('package')

def deduce_target_sdk(path):
for sdk_name in MMS.sdks:
sdk = MMS.sdks[sdk_name]
if ('metamod.' + sdk.ext) in path:
return sdk
return None

addons_folder = builder.AddFolder('addons')
metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
bin_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin'))
Expand All @@ -11,14 +18,17 @@ for cxx in MMS.all_targets:
if cxx.target.arch == 'x86_64':
if cxx.target.platform == 'windows':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'win64'))
bin64_s2_folder = bin64_folder
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_win64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
elif cxx.target.platform == 'linux':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'linux64'))
bin64_s2_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'linuxsteamrt64'))
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_linux64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
elif cxx.target.platform == 'mac':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'osx64'))
bin64_s2_folder = bin64_folder
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_osx64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))

Expand All @@ -28,8 +38,15 @@ builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'README.txt'), metam

pdb_list = []
for task in MMS.binaries:
sdk = deduce_target_sdk(task.binary.path)

if task.target.arch == 'x86_64':
builder.AddCopy(task.binary, bin64_folder)
# libserver check is a hack to make sure that binary ends up in the correct folder
# as s2 folders differ to s1 layout
if 'libserver' in task.binary.path or (sdk is not None and sdk.name in ['dota', 'cs2']):
builder.AddCopy(task.binary, bin64_s2_folder)
else:
builder.AddCopy(task.binary, bin64_folder)
else:
builder.AddCopy(task.binary, bin_folder)

Expand Down

0 comments on commit 62dd3dd

Please sign in to comment.