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