Skip to content

Commit 9a4417d

Browse files
bitjammerwebkit-commit-queue
authored andcommitted
.: Allow building with arbitrary SDK and ARCHS with make + Xcode
https://bugs.webkit.org/show_bug.cgi?id=107863 Patch by David Farler <dfarler@apple.com> on 2013-01-26 Reviewed by David Kilzer. * Makefile: Removed references to legacy Xcode configurations. * Makefile.shared: Added default ARCHS + SDK settings and parameterized xcodebuild calls. * Source/Makefile: iOS does not build WebKit2. Tools: Makefiles should work for arbitrary SDKs and architectures on Apple ports https://bugs.webkit.org/show_bug.cgi?id=107863 Patch by David Farler <dfarler@apple.com> on 2013-01-26 Reviewed by David Kilzer. * Makefile: Added temporary filters for projects not yet building on iOS. * DumpRenderTree/Makefile: Building with iOS SDKs -> -target All-iOS * Scripts/webkitdirs.pm: (determineConfiguration): Added --configuration switch detection. (determineArchitecture): Added --architecture and ARCH=(.*) switch detection. (argumentsForConfiguration): (determineXcodeSDK): Look for --device, --simulator, and --sdk switches. (xcodeSDK): Added. (XcodeOptions): Determine Xcode SDK and generate -arch switches. Canonical link: https://commits.webkit.org/126221@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 202025b commit 9a4417d

8 files changed

Lines changed: 160 additions & 14 deletions

File tree

ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2013-01-26 David Farler <dfarler@apple.com>
2+
3+
Allow building with arbitrary SDK and ARCHS with make + Xcode
4+
https://bugs.webkit.org/show_bug.cgi?id=107863
5+
6+
Reviewed by David Kilzer.
7+
8+
* Makefile:
9+
Removed references to legacy Xcode configurations.
10+
* Makefile.shared:
11+
Added default ARCHS + SDK settings and parameterized xcodebuild calls.
12+
* Source/Makefile:
13+
iOS does not build WebKit2.
14+
115
2013-01-25 Jussi Kukkonen <jussi.kukkonen@intel.com>
216

317
[CMake][EFL] Build ThirdParty/leveldb when IndexedDB is enabled

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ all:
44
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
55
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
66

7-
debug d development dev develop:
7+
debug d:
88
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
99
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
1010

11-
release r deployment dep deploy:
11+
release r:
1212
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
1313
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
1414

Makefile.shared

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
SCRIPTS_PATH ?= ../Tools/Scripts
2-
XCODE_OPTIONS = `perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print XcodeOptionString()'` $(ARGS)
32

3+
SDK = /
4+
5+
ifneq (,$(findstring iphoneos,$(SDK)))
6+
ARCHS = armv7
7+
else ifneq (,$(findstring iphonesimulator,$(SDK)))
8+
ARCHS = i386
9+
else ifneq (,$(findstring macosx,$(SDK)))
10+
ARCHS = x86_64
11+
else
12+
ARCHS = x86_64
13+
endif
14+
15+
ARCH_FLAGS=$(addprefix --arch ,$(ARCHS))
416
DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
517
VERBOSITY ?= $(DEFAULT_VERBOSITY)
618

@@ -14,18 +26,22 @@ OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
1426
endif
1527
endif
1628

29+
define xcode-options
30+
$(shell perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print XcodeOptionString()' -- --sdk $(SDK) $1 $(ARCH_FLAGS) $(ARGS))
31+
endef
32+
1733
all:
18-
( xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
34+
xcodebuild $(OTHER_OPTIONS) $(call xcode-options,) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]}
1935

20-
debug d development dev develop: force
36+
debug d: force
2137
$(SCRIPTS_PATH)/set-webkit-configuration --debug
22-
( xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
38+
xcodebuild $(OTHER_OPTIONS) $(call xcode-options, --configuration Debug) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]}
2339

24-
release r deployment dep deploy: force
40+
release r: force
2541
$(SCRIPTS_PATH)/set-webkit-configuration --release
26-
( xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
42+
xcodebuild $(OTHER_OPTIONS) $(call xcode-options, --configuration Release) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]}
2743

2844
clean:
29-
( xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
45+
xcodebuild $(OTHER_OPTIONS) -alltargets clean $(call xcode-options,) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]}
3046

3147
force: ;

Source/Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
MODULES = WTF JavaScriptCore ThirdParty/ANGLE WebCore WebKit WebKit2
22

3+
IOS_DONT_BUILD = WebKit2
4+
5+
ifneq (,$(findstring iphoneos,$(SDK)))
6+
MODULES = $(filter-out $(IOS_DONT_BUILD),$(MODULES))
7+
else ifneq (,$(findstring iphonesimulator,$(SDK)))
8+
MODULES = $(subst $(IOS_DONT_BUILD),$(MODULES))
9+
endif
10+
311
all:
412
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
513
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
614

7-
debug d development dev develop:
15+
debug d:
816
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
917
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
1018

11-
release r deployment dep deploy:
19+
release r:
1220
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
1321
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
1422

Tools/ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2013-01-26 David Farler <dfarler@apple.com>
2+
3+
Makefiles should work for arbitrary SDKs and architectures on Apple ports
4+
https://bugs.webkit.org/show_bug.cgi?id=107863
5+
6+
Reviewed by David Kilzer.
7+
8+
* Makefile:
9+
Added temporary filters for projects not yet building on iOS.
10+
* DumpRenderTree/Makefile:
11+
Building with iOS SDKs -> -target All-iOS
12+
* Scripts/webkitdirs.pm:
13+
(determineConfiguration):
14+
Added --configuration switch detection.
15+
(determineArchitecture):
16+
Added --architecture and ARCH=(.*) switch detection.
17+
(argumentsForConfiguration):
18+
(determineXcodeSDK):
19+
Look for --device, --simulator, and --sdk switches.
20+
(xcodeSDK):
21+
Added.
22+
(XcodeOptions):
23+
Determine Xcode SDK and generate -arch switches.
24+
125
2013-01-25 Jochen Eisinger <jochen@chromium.org>
226

327
[chromium] move tracking of the top loading frame to TestRunner library

Tools/DumpRenderTree/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
SCRIPTS_PATH = ../Scripts
2+
3+
ifneq (,$(findstring iphoneos,$(SDK)))
4+
OTHER_OPTIONS += -target All-iOS
5+
else ifneq (,$(findstring iphonesimulator,$(SDK)))
6+
OTHER_OPTIONS += -target All-iOS
7+
endif
8+
29
include ../../Makefile.shared

Tools/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
MODULES = DumpRenderTree WebKitTestRunner MiniBrowser ../Source/ThirdParty/gtest/xcode TestWebKitAPI
22

3+
IOS_DONT_BUILD = WebKitTestRunner MiniBrowser TestWebKitAPI
4+
IPHONEOS_DONT_BUILD = DumpRenderTree
5+
6+
ifneq (,$(findstring iphoneos,$(SDK)))
7+
MODULES = $(filter-out $(IOS_DONT_BUILD),$(MODULES))
8+
MODULES = $(filter-out $(IPHONEOS_DONT_BUILD),$(MODULES))
9+
else ifneq (,$(findstring iphonesimulator,$(SDK)))
10+
MODULES = $(filter-out $(IOS_DONT_BUILD),$(MODULES))
11+
endif
12+
313
all:
414
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
515
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
616

7-
debug d development dev develop:
17+
debug d:
818
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
919
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
1020

11-
release r deployment dep deploy:
21+
release r:
1222
@for dir in $(MODULES); do ${MAKE} $@ -C $$dir; exit_status=$$?; \
1323
if [ $$exit_status -ne 0 ]; then exit $$exit_status; fi; done
1424

Tools/Scripts/webkitdirs.pm

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ my $numberOfCPUs;
8080
my $baseProductDir;
8181
my @baseProductDirOption;
8282
my $configuration;
83+
my $xcodeSDK;
84+
my $xcodeSDKVersion;
8385
my $configurationForVisualStudio;
8486
my $configurationProductDir;
8587
my $sourceDir;
@@ -273,6 +275,17 @@ sub setBaseProductDir($)
273275
sub determineConfiguration
274276
{
275277
return if defined $configuration;
278+
279+
# Look for explicit setting first
280+
for (my $i = 0; $i <= $#ARGV; $i++) {
281+
my $opt = $ARGV[$i];
282+
if ($opt =~ /^--config(uration)$/) {
283+
splice(@ARGV, $i, 1);
284+
$configuration = splice(@ARGV, $i, 1);
285+
return;
286+
}
287+
}
288+
276289
determineBaseProductDir();
277290
if (open CONFIGURATION, "$baseProductDir/Configuration") {
278291
$configuration = <CONFIGURATION>;
@@ -302,6 +315,30 @@ sub determineArchitecture
302315

303316
determineBaseProductDir();
304317

318+
# Look for explicit setting first
319+
my @explicitArchs;
320+
for (my $i = 0; $i <= $#ARGV; $i++) {
321+
my $opt = $ARGV[$i];
322+
323+
if ($opt =~ /^--arch(itecture)?$/) {
324+
splice(@ARGV, $i, 1);
325+
push @explicitArchs, splice(@ARGV, $i--, 1);
326+
} elsif ($opt =~ /^ARCHS=(.*)$/) {
327+
push @explicitArchs, split(/\w/, $1);
328+
splice(@ARGV, $i--, 1);
329+
}
330+
}
331+
332+
# Make explicit arch settings forgiving – remove duplicate settings
333+
# and allow for specifying architectures with both --arch and appending
334+
# Xcode-style ARCHS=(.*)
335+
@explicitArchs = sort keys %{{ map { $_ => 1 } @explicitArchs }};
336+
337+
if (scalar(@explicitArchs)) {
338+
$architecture = join(' ', @explicitArchs) if @explicitArchs;
339+
return;
340+
}
341+
305342
if (isGtk()) {
306343
determineConfigurationProductDir();
307344
my $host_triple = `grep -E '^host = ' $configurationProductDir/GNUmakefile`;
@@ -383,6 +420,7 @@ sub argumentsForConfiguration()
383420
push(@args, '--debug') if $configuration eq "Debug";
384421
push(@args, '--release') if $configuration eq "Release";
385422
push(@args, '--32-bit') if $architecture ne "x86_64";
423+
push(@args, '--sdk', $xcodeSDK) if defined $xcodeSDK;
386424
push(@args, '--qt') if isQt();
387425
push(@args, '--gtk') if isGtk();
388426
push(@args, '--efl') if isEfl();
@@ -396,6 +434,33 @@ sub argumentsForConfiguration()
396434
return @args;
397435
}
398436

437+
sub determineXcodeSDK
438+
{
439+
return if defined $xcodeSDK;
440+
for (my $i = 0; $i <= $#ARGV; $i++) {
441+
my $opt = $ARGV[$i];
442+
if ($opt =~ /^--sdk$/i) {
443+
splice(@ARGV, $i, 1);
444+
$xcodeSDK = splice(@ARGV, $i, 1);
445+
} elsif ($opt =~ /^--device$/i) {
446+
splice(@ARGV, $i, 1);
447+
$xcodeSDK = 'iphoneos.internal';
448+
} elsif ($opt =~ /^--sim(ulator)?/i) {
449+
splice(@ARGV, $i, 1);
450+
$xcodeSDK = 'iphonesimulator';
451+
}
452+
}
453+
$xcodeSDK ||= '/';
454+
455+
chomp $xcodeSDK;
456+
}
457+
458+
sub xcodeSDK
459+
{
460+
determineXcodeSDK();
461+
return $xcodeSDK;
462+
}
463+
399464
sub determineConfigurationForVisualStudio
400465
{
401466
return if defined $configurationForVisualStudio;
@@ -520,7 +585,9 @@ sub XcodeOptions
520585
determineBaseProductDir();
521586
determineConfiguration();
522587
determineArchitecture();
523-
return (@baseProductDirOption, "-configuration", $configuration, "ARCHS=$architecture", argumentsForXcode());
588+
determineXcodeSDK();
589+
my @archFlags = map { ('-arch', $_) } split(/ /, $architecture);
590+
return (@baseProductDirOption, "-configuration", $configuration, "-sdk", $xcodeSDK, @archFlags, argumentsForXcode());
524591
}
525592

526593
sub XcodeOptionString

0 commit comments

Comments
 (0)