mirror of
https://github.com/mid-kid/metroskrew.git
synced 2025-06-18 13:15:40 -04:00
Move env.c to the correct directory, as it's a patch exclusive
This commit is contained in:
parent
d7337c9d79
commit
87f5b4980c
@ -28,6 +28,8 @@ as_args = [
|
||||
get_option('trace') ? ['--defsym', 'ETRACE=1'] : [],
|
||||
]
|
||||
|
||||
common_inc = meson.current_source_dir()
|
||||
|
||||
common = static_library('common',
|
||||
sources_c,
|
||||
objects: as_gen.process(sources_s,
|
||||
@ -35,5 +37,3 @@ common = static_library('common',
|
||||
c_args: c_args,
|
||||
dependencies: wine_headers,
|
||||
build_by_default: false)
|
||||
|
||||
common_inc = meson.current_source_dir()
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "_utils.h"
|
||||
|
||||
char *relink_getenv(const char *name)
|
||||
char *patch_getenv(const char *name)
|
||||
{
|
||||
char *res = NULL;
|
||||
if (strcmp(name, "MW_CYGDRIVE_PREFIX") == 0) {
|
||||
@ -37,6 +37,12 @@ char *relink_getenv(const char *name)
|
||||
} else if (strcmp(name, "MWASMINCLUDES") == 0) {
|
||||
// Used by mwasmarm >=1.0-26
|
||||
res = getenv(name);
|
||||
} else if (strcmp(name, "TEMP") == 0) {
|
||||
res = NULL;
|
||||
} else if (strcmp(name, "TMP") == 0) {
|
||||
res = NULL;
|
||||
} else if (strcmp(name, "TMPDIR") == 0) {
|
||||
res = NULL;
|
||||
} else {
|
||||
printf("die: getenv: name='%s'\n", name);
|
||||
exit(EXIT_FAILURE);
|
@ -1,19 +1,25 @@
|
||||
fs = import('fs')
|
||||
|
||||
exescan = executable('scan', 'scan.c', native: true, build_by_default: false)
|
||||
# Common code used by the patches
|
||||
|
||||
bins_patch_gen = {}
|
||||
foreach name, bin : bins
|
||||
patch = custom_target(
|
||||
command: [exescan,
|
||||
'--incbin', bins_paths[name],
|
||||
'-o', '@OUTPUT@', '@INPUT@'],
|
||||
output: name + '_patch.s',
|
||||
input: bins[name])
|
||||
bins_patch_gen += {name: patch}
|
||||
endforeach
|
||||
sources_c = [
|
||||
'env.c'
|
||||
]
|
||||
|
||||
c_args = [
|
||||
c_args_base,
|
||||
get_option('debug') ? [] : '-DNDEBUG',
|
||||
get_option('trace') ? '-DETRACE' : [],
|
||||
'-I' + common_inc
|
||||
]
|
||||
|
||||
patch_common = static_library('patch_common', sources_c,
|
||||
c_args: c_args)
|
||||
|
||||
# Patch listing
|
||||
|
||||
patch_dir = meson.current_source_dir() / 'gen'
|
||||
patch_inc = meson.current_source_dir()
|
||||
|
||||
bins_patch = {}
|
||||
foreach name, bin : bins
|
||||
@ -26,14 +32,25 @@ foreach name, bin : bins
|
||||
bins_patch += {name: patch}
|
||||
endforeach
|
||||
|
||||
# Patch generation
|
||||
|
||||
exescan = executable('scan', 'scan.c', native: true, build_by_default: false)
|
||||
|
||||
bins_patch_gen = {}
|
||||
bins_patch_gen_files = []
|
||||
foreach name, patch : bins_patch_gen
|
||||
foreach name, bin : bins
|
||||
patch = custom_target(
|
||||
command: [exescan,
|
||||
'--incbin', bins_paths[name],
|
||||
'-o', '@OUTPUT@', '@INPUT@'],
|
||||
output: name + '_patch.s',
|
||||
input: bins[name])
|
||||
bins_patch_gen += {name: patch}
|
||||
bins_patch_gen_files += patch
|
||||
endforeach
|
||||
|
||||
run_target('patchgen',
|
||||
command: ['install',
|
||||
'-Dm644', '-t', meson.current_source_dir() / patch_dir,
|
||||
bins_patch_gen_files
|
||||
])
|
||||
|
||||
patch_inc = meson.current_source_dir()
|
||||
|
@ -50,7 +50,7 @@ incbin patch.end, (pe_text_off + pe_text_len - patch.end)
|
||||
|
||||
# Use our own getenv(3)
|
||||
.macro patch_getenv
|
||||
wjmp relink_getenv
|
||||
wjmp patch_getenv
|
||||
.endm
|
||||
|
||||
# The actual code
|
||||
|
@ -5,7 +5,6 @@ sources_s = [
|
||||
]
|
||||
|
||||
sources_c = [
|
||||
'env.c'
|
||||
]
|
||||
|
||||
c_args = [
|
||||
@ -67,6 +66,7 @@ foreach name, bin : bins
|
||||
is_windows ? '-T' + dllimport : [],
|
||||
link_args
|
||||
],
|
||||
link_with: [patch_common],
|
||||
link_whole: [relink_common, common],
|
||||
link_depends: [
|
||||
ldscript,
|
||||
|
Loading…
Reference in New Issue
Block a user