1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/usr/bin/env python
import os
def configure(conf):
AR32 = ['i386', 'i586', 'i686']
AR64 = ['x86_64', 'amd64']
TC = ['mingw32', 'mingw32msvc', 'w64-mingw32']
found = False
for a in AR32:
for t in TC:
if conf.find_program(a + '-' + t + '-gcc', var='WINEXE_CC_WIN32'):
found = True
break
if found:
conf.DEFINE('HAVE_WINEXE_CC_WIN32', 1);
break
found = False
for a in AR64:
for t in TC:
if conf.find_program(a + '-' + t + '-gcc', var='WINEXE_CC_WIN64'):
found = True
break
if found:
conf.DEFINE('HAVE_WINEXE_CC_WIN64', 1);
break
source_date_epoch = os.environ.get('SOURCE_DATE_EPOCH')
if source_date_epoch is None:
# We use the version to make up the timestamp that will be
# embedded in winexe.exe, to keep the build reproducible.
#
# This is less evil than it sounds. According to Raymond Chen in
# https://devblogs.microsoft.com/oldnewthing/20180103-00/?p=97705
# since Windows 10 the timestamp has been randomised.
#
# The purpose of the timestamp in Windows PE files seems to be
# to make spotting ABI changes in DLLs quicker, for which a
# random number is just as good as a real time. The timestamp
# in .exe files is not used.
import samba_version
v = samba_version.load_version(env=conf.env)
version = (v.MAJOR << 16) | (v.MINOR << 8) | v.RELEASE
source_date_epoch = str(version)
conf.env.SOURCE_DATE_EPOCH = source_date_epoch
conf.DEFINE("WINEXE_LDFLAGS",
"-s -Wall -Wl,-Bstatic -Wl,-Bdynamic -luserenv")
|