]>
git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/update-headers
62838ac2df2436a70c2543f2123f162468282cd9
3 if (!$ENV{"INSTALL_DIR"} or !$ENV{"PUBLIC_HEADERS_FOLDER_PATH"} or !$ENV{"PRIVATE_HEADERS_FOLDER_PATH"}) {
4 die "Cannot update headers, missing ENV vars\n";
7 $DO_SPLIT = ($#ARGV >= 0 and $ARGV[0] eq "split");
9 $API_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PUBLIC_HEADERS_FOLDER_PATH"};
10 $SPI_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PRIVATE_HEADERS_FOLDER_PATH"};
15 $inc =~ s/#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/.*?>.*?\n#else.*?\n//;
16 $inc =~ s/#endif\s+.*?USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS.*?\n//;
25 $api_new = $DO_SPLIT ? $api : clean_INC
($api);
26 $api_new =~ s/(__MAC)_\w+\/\*SPI\*\//\1_NA/g;
27 $api_new =~ s/(\(__MAC_OS_X_VERSION_MIN_REQUIRED >= \d+\)\/\*SPI\*\/ \
|\
| )//g;
28 $api_new =~ s/(__IPHONE)_\w+\/\*SPI\*\//\1_NA/g;
29 $api_new =~ s/( \|\| \(__IPHONE_OS_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\///g;
38 $spi_new = clean_INC
($spi);
39 $spi_new =~ s/(__MAC_\w+)\/\*SPI\*\//\1/g;
40 $api_new =~ s/(\(__MAC_OS_X_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\/( \
|\
| )/\1\2/g;
41 $spi_new =~ s/(__IPHONE_\w+)\/\*SPI\*\//\1/g;
42 $spi_new =~ s/( \|\| )(\(__IPHONE_OS_VERSION_MIN_REQUIRED >= \d+\))\/\*SPI\*\//\1\2/g;
48 # Update .../PrivateHeaders
51 opendir(HEADERS
, $SPI_BASE);
52 @headers = readdir(HEADERS
);
61 $spi_path = $SPI_BASE . "/" . $spi_header;
62 next if (! -f
$spi_path);
64 open(SPI
, "<", $spi_path);
68 $spi_new = clean_SPI
($spi);
69 if ($spi ne $spi_new) {
70 # printf "cleaning .../PrivateHeaders/%s\n", $spi_header;
71 open(SPI
, ">", $spi_path);
82 opendir(HEADERS
, $API_BASE);
83 @headers = readdir(HEADERS
);
92 $api_path = $API_BASE . "/" . $api_header;
93 next if (! -f
$api_path);
95 open(API
, "<", $api_path);
99 $api_new = clean_API
($api);
100 if ($api ne $api_new) {
101 # printf "cleaning .../Headers/%s\n", $api_header;
102 open(API
, ">", $api_path);
107 $spi_new = clean_SPI
($api);
108 if ($api_new ne $spi_new) {
109 if ((($spi_header) = ($api =~ /#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/(.*?\
.h
)>\s
*.*?\n/))) {
110 if ($api_header eq $spi_header) {
111 die "API & SPI header not unique: $api_header\n";
114 die "Header missing #ifdef/#else/#endif: $api_header\n";
115 # $spi_header = $api_header;
116 # $spi_header =~ s/\.h$/PRIVATE.h/;
119 # printf " adding .../PrivateHeaders/%s\n", $spi_header;
120 $spi_path = $SPI_BASE . "/" . $spi_header;
121 open(SPI
, ">", $spi_path);