Loading...
xcodescripts/generate_features.pl Libc-1725.40.4 Libc-1244.20.1
--- Libc/Libc-1725.40.4/xcodescripts/generate_features.pl
+++ Libc/Libc-1244.20.1/xcodescripts/generate_features.pl
@@ -20,34 +20,20 @@
 	# set ENV{"CURRENT_ARCH"} so we can predicate on it
 	$ENV{"CURRENT_ARCH"} = $arch;
 
-	my $platformName = $ENV{"VARIANT_PLATFORM_NAME"};
-
-	# MOVES_LOCALTIME defaults to ON so that new embedded platforms don't
-	# need anything additional here.  macOS and simulator platforms both
-	# retain /etc/localtime.
-	my $platformMovesLocaltime = 1;
-	if ($platformName =~ /simulator/ or $platformName =~ /macos/) {
-		$platformMovesLocaltime = 0;
-	}
-
-	# Platform uses TZDIR symlink in /var/db, which is basically everything
-	# except simulators.  This is technically incorrect for macOS < 10.13.
-	my $platformTzSymlink = 1;
-	if ($platformName =~ /simulator/) {
-		$platformTzSymlink = 0;
+	# BridgeOS shares the same platform name than the watch so
+	# we need to fix it and pick the right configuration.
+	my $platformName = $ENV{"PLATFORM_NAME"};
+	if ($ENV{"RC_BRIDGE"} eq "YES") {
+		$platformName = "bridgeos";
 	}
 
 	$platformName =~ s/simulator/os/;
 
-	# Try to find a platform+arch config file. If not found, try just
-	# a platform config file.
-	my $platformArchPath = $ENV{"SRCROOT"} . "/Platforms/" . $platformName . "/Makefile." . $arch . ".inc";
 	my $platformPath = $ENV{"SRCROOT"} . "/Platforms/" . $platformName . "/Makefile.inc";
-
 	my $featuresHeaderDir = $ENV{"DERIVED_FILES_DIR"}."/".$arch;
 	my $featuresHeader = $featuresHeaderDir."/libc-features.h";
 
-	open FEATURESFILE, "<$platformArchPath" or open FEATURESFILE, "<$platformPath" or die "Unable to open: $platformArchPath nor $platformPath";
+	open FEATURESFILE, "<$platformPath" or die "Unable to open: $platformPath";
 
 	my %features = ();
 	my $skip = 0;
@@ -96,23 +82,9 @@
 	elsif ($unifdef == 1) {
 		# assume FEATURE_BLOCKS was on by default
 		$unifdefs{"UNIFDEF_BLOCKS"} = 1;
-		$unifdefs{"UNIFDEF_DRIVERKIT"} = defined($ENV{"DRIVERKITSDK"});
 		$unifdefs{"UNIFDEF_LEGACY_64_APIS"} = defined($features{"FEATURE_LEGACY_64_APIS"});
 		$unifdefs{"UNIFDEF_LEGACY_RUNE_APIS"} = defined($features{"FEATURE_LEGACY_RUNE_APIS"});
 		$unifdefs{"UNIFDEF_LEGACY_UTMP_APIS"} = defined($features{"FEATURE_LEGACY_UTMP_APIS"});
-		$unifdefs{"UNIFDEF_POSIX_ILP32_ALLOW"} = defined($features{"FEATURE_POSIX_ILP32_ALLOW"});
-
-		if (defined($features{"FEATURE_MOVE_LOCALTIME"}) or $platformMovesLocaltime) {
-			$unifdefs{"UNIFDEF_MOVE_LOCALTIME"} = 1;
-		} else {
-			$unifdefs{"UNIFDEF_MOVE_LOCALTIME"} = 0;
-		}
-
-		if (defined($features{"FEATURE_TZDIR_SYMLINK"}) or $platformTzSymlink) {
-			$unifdefs{"UNIFDEF_TZDIR_SYMLINK"} = 1;
-		} else {
-			$unifdefs{"UNIFDEF_TZDIR_SYMLINK"} = 0;
-		}
 		
 		my $output = "";
 		for my $d (keys %unifdefs) {
@@ -126,11 +98,7 @@
 	
 	elsif ($unifdef == 0) {
 		# If we touch this file on every build, then every other iterative build in Xcode will rebuild *everything*
-		my $platform_mtime = (stat($platformArchPath))[9];
-		if (!defined($platform_mtime)) {
-			# try the other one
-			$platform_mtime = (stat($platformPath))[9];
-		}
+		my $platform_mtime = (stat($platformPath))[9];
 		my $header_mtime = (stat($featuresHeader))[9];
 
 		if (defined($header_mtime) && defined($platform_mtime) && ($header_mtime > $platform_mtime)) {
@@ -157,7 +125,7 @@
 		$shortarch =~ s/armv\d+[a-z]?/arm/g;
 
 		# map all arm64 subtypes to arm64
-		$shortarch =~ s/arm64[_a-z0-9]*/arm64/g;
+		$shortarch =~ s/arm64[_a-z0-9]?/arm64/g;
 
 		printf HEADER "#if !defined(__".$shortarch."__)\n";
 		printf HEADER "#error Mismatched libc-features.h architecture\n";