mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
[APISETS] Update the script to take the current newline setting into account.
This commit is contained in:
parent
5aefc6f49a
commit
15affd19ee
|
@ -14,6 +14,8 @@ import subprocess
|
||||||
|
|
||||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
NL_CHAR = '\n'
|
||||||
|
|
||||||
IGNORE_OPTIONS = ('-norelay', '-ret16', '-ret64', '-register', '-private',
|
IGNORE_OPTIONS = ('-norelay', '-ret16', '-ret64', '-register', '-private',
|
||||||
'-noname', '-ordinal', '-i386', '-arch=', '-stub')
|
'-noname', '-ordinal', '-i386', '-arch=', '-stub')
|
||||||
|
|
||||||
|
@ -234,7 +236,7 @@ class SpecEntry(object):
|
||||||
assert self._ord != '@'
|
assert self._ord != '@'
|
||||||
name = 'Ordinal' + self._ord
|
name = 'Ordinal' + self._ord
|
||||||
if not self._forwarder:
|
if not self._forwarder:
|
||||||
spec_file.write('{} stub{} {}\n'.format(self._ord, opts, name))
|
spec_file.write('{} stub{} {}{}'.format(self._ord, opts, name, NL_CHAR))
|
||||||
estimate_size += 0x1000
|
estimate_size += 0x1000
|
||||||
else:
|
else:
|
||||||
assert self.arch != Arch(), self.name
|
assert self.arch != Arch(), self.name
|
||||||
|
@ -256,12 +258,13 @@ class SpecEntry(object):
|
||||||
fwd = '{}._imp__{}'.format(*self._forwarder)
|
fwd = '{}._imp__{}'.format(*self._forwarder)
|
||||||
if arch != Arch(Arch.Any):
|
if arch != Arch(Arch.Any):
|
||||||
opts = '{} -arch={}'.format(opts, arch.to_str())
|
opts = '{} -arch={}'.format(opts, arch.to_str())
|
||||||
spec_file.write('{ord} {cc}{opts} {name}{args} {fwd}\n'.format(ord=self._ord,
|
spec_file.write('{ord} {cc}{opts} {name}{args} {fwd}{nl}'.format(ord=self._ord,
|
||||||
cc=callconv,
|
cc=callconv,
|
||||||
opts=opts,
|
opts=opts,
|
||||||
name=name,
|
name=name,
|
||||||
args=args,
|
args=args,
|
||||||
fwd=fwd))
|
fwd=fwd,
|
||||||
|
nl=NL_CHAR))
|
||||||
estimate_size += 0x100
|
estimate_size += 0x100
|
||||||
return estimate_size
|
return estimate_size
|
||||||
|
|
||||||
|
@ -353,7 +356,7 @@ class SpecFile(object):
|
||||||
fwd_strings = ' '.join(fwd_strings)
|
fwd_strings = ' '.join(fwd_strings)
|
||||||
name = self.name
|
name = self.name
|
||||||
baseaddress = '0x{:8x}'.format(baseaddress)
|
baseaddress = '0x{:8x}'.format(baseaddress)
|
||||||
cmakelists.write('add_apiset({} {} {})\n'.format(name, baseaddress, fwd_strings))
|
cmakelists.write('add_apiset({} {} {}){}'.format(name, baseaddress, fwd_strings, NL_CHAR))
|
||||||
return self._estimate_size
|
return self._estimate_size
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,6 +380,7 @@ def generate_specnames(dll_dir):
|
||||||
yield (os.path.join(dll_dir, '..', 'win32ss', 'gdi', 'gdi32', 'gdi32.spec'), 'gdi32')
|
yield (os.path.join(dll_dir, '..', 'win32ss', 'gdi', 'gdi32', 'gdi32.spec'), 'gdi32')
|
||||||
|
|
||||||
def run(wineroot):
|
def run(wineroot):
|
||||||
|
global NL_CHAR
|
||||||
wine_apisets = []
|
wine_apisets = []
|
||||||
ros_modules = []
|
ros_modules = []
|
||||||
|
|
||||||
|
@ -426,16 +430,21 @@ def run(wineroot):
|
||||||
total = tuple(map(sum, zip(apiset.extra_forwarders(function_lookup, module_lookup), total)))
|
total = tuple(map(sum, zip(apiset.extra_forwarders(function_lookup, module_lookup), total)))
|
||||||
print 'found', total[0], '/', total[1], 'forwarders'
|
print 'found', total[0], '/', total[1], 'forwarders'
|
||||||
|
|
||||||
print 'Writing apisets'
|
|
||||||
for apiset in wine_apisets:
|
|
||||||
with open(os.path.join(SCRIPT_DIR, apiset.name + '.spec'), 'wb') as out_spec:
|
|
||||||
out_spec.writelines(SPEC_HEADER)
|
|
||||||
apiset.write(out_spec)
|
|
||||||
|
|
||||||
print 'Writing CMakeLists.txt'
|
|
||||||
with open(os.path.join(SCRIPT_DIR, 'CMakeLists.txt.in'), 'rb') as template:
|
with open(os.path.join(SCRIPT_DIR, 'CMakeLists.txt.in'), 'rb') as template:
|
||||||
data = template.read()
|
data = template.read()
|
||||||
data = data.replace('%WINE_GIT_VERSION%', version)
|
data = data.replace('%WINE_GIT_VERSION%', version)
|
||||||
|
# Detect the checkout newline settings
|
||||||
|
if '\r\n' in data:
|
||||||
|
NL_CHAR = '\r\n'
|
||||||
|
|
||||||
|
print 'Writing apisets'
|
||||||
|
spec_header = [line.replace('\n', NL_CHAR) for line in SPEC_HEADER]
|
||||||
|
for apiset in wine_apisets:
|
||||||
|
with open(os.path.join(SCRIPT_DIR, apiset.name + '.spec'), 'wb') as out_spec:
|
||||||
|
out_spec.writelines(spec_header)
|
||||||
|
apiset.write(out_spec)
|
||||||
|
|
||||||
|
print 'Writing CMakeLists.txt'
|
||||||
baseaddress = 0x60000000
|
baseaddress = 0x60000000
|
||||||
with open(os.path.join(SCRIPT_DIR, 'CMakeLists.txt'), 'wb') as cmakelists:
|
with open(os.path.join(SCRIPT_DIR, 'CMakeLists.txt'), 'wb') as cmakelists:
|
||||||
cmakelists.write(data)
|
cmakelists.write(data)
|
||||||
|
|
Loading…
Reference in a new issue