Skip to content

Modified build scripts for Cygwin #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

foundation.GCC_PREFIX_HEADER = 'CoreFoundation/Base.subproj/CoreFoundation_Prefix.h'

swift_cflags = []
if Configuration.current.target.sdk == OSType.Linux:
foundation.CFLAGS = '-DDEPLOYMENT_TARGET_LINUX -D_GNU_SOURCE '
foundation.LDFLAGS = '${SWIFT_USE_LINKER} -Wl,@./CoreFoundation/linux.ld -lswiftGlibc `${PKG_CONFIG} icu-uc icu-i18n --libs` -Wl,-defsym,__CFConstantStringClassReference=_TMC10Foundation19_NSCFConstantString -Wl,-Bsymbolic '
Expand All @@ -23,6 +24,10 @@
elif Configuration.current.target.sdk == OSType.MacOSX:
foundation.CFLAGS = '-DDEPLOYMENT_TARGET_MACOSX '
foundation.LDFLAGS = '-licucore -twolevel_namespace -Wl,-alias_list,CoreFoundation/Base.subproj/DarwinSymbolAliases -sectcreate __UNICODE __csbitmaps CoreFoundation/CharacterSets/CFCharacterSetBitmaps.bitmap -sectcreate __UNICODE __properties CoreFoundation/CharacterSets/CFUniCharPropertyDatabase.data -sectcreate __UNICODE __data CoreFoundation/CharacterSets/CFUnicodeData-L.mapping -segprot __UNICODE r r '
elif Configuration.current.target.sdk == OSType.Win32 and Configuration.current.target.environ == EnvironmentType.Cygnus:
foundation.CFLAGS = '-DDEPLOYMENT_TARGET_LINUX -D_GNU_SOURCE -mcmodel=large '
foundation.LDFLAGS = '${SWIFT_USE_LINKER} -lswiftGlibc `icu-config --ldflags` -Wl,-defsym,__CFConstantStringClassReference=_TMC10Foundation19_NSCFConstantString,--allow-multiple-definition '
swift_cflags += ['-DCYGWIN']

if Configuration.current.build_mode == Configuration.Debug:
foundation.LDFLAGS += ' -lswiftSwiftOnoneSupport '
Expand Down Expand Up @@ -53,7 +58,7 @@
'-I./',
])

swift_cflags = [
swift_cflags += [
'-I${BUILD_DIR}/Foundation/usr/lib/swift',
'-I${SYSROOT}/usr/include/libxml2'
]
Expand Down
2 changes: 1 addition & 1 deletion lib/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def generate_products(self):

link_command = """
rule Link
command = mkdir -p `dirname $out`; ${CLANG} ${TARGET_LDFLAGS} $flags ${VERBOSE_FLAGS} $start $in $end -o $out"""
command = mkdir -p `dirname $out`; ${CLANG} ${TARGET_LDFLAGS} ${VERBOSE_FLAGS} $start $in $end $flags -o $out"""
if Configuration.current.verbose:
link_command += "-Xlinker --verbose"
link_command += """
Expand Down
11 changes: 11 additions & 0 deletions lib/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ class Target:
triple = None
sdk = None
arch = None
environ = None
executable_suffix = ""
dynamic_library_prefix = "lib"
dynamic_library_suffix = ".dylib"
Expand All @@ -342,6 +343,10 @@ def __init__(self, triple):
self.sdk = OSType.Win32
self.dynamic_library_suffix = ".dll"
self.executable_suffix = ".exe"
if "cygnus" in triple:
self.environ = EnvironmentType.Cygnus
else:
self.environ = EnvironmentType.UnknownEnvironment
elif "darwin" in triple:
self.sdk = OSType.MacOSX
else:
Expand All @@ -366,6 +371,8 @@ def default():
elif platform.system() == "FreeBSD":
# Make this work on 10 as well.
triple += "-freebsd11.0"
elif platform.system() == "CYGWIN_NT-10.0":
triple += "-windows-cygnus"
else:
# TODO: This should be a bit more exhaustive
print("unknown host os")
Expand All @@ -385,6 +392,8 @@ def swift_triple(self):
triple += "-unknown-linux"
elif self.sdk == OSType.FreeBSD:
triple += "-unknown-freebsd"
elif self.sdk == OSType.Win32 and self.environ == EnvironmentType.Cygnus:
triple += "-unknown-windows-cygnus"
else:
print("unknown sdk for swift")
return None
Expand All @@ -399,6 +408,8 @@ def swift_sdk_name(self):
return "linux"
elif self.sdk == OSType.FreeBSD:
return "freebsd"
elif self.sdk == OSType.Win32:
return "cygwin"
else:
print("unknown sdk for swift")
return None
Expand Down