]>
git.saurik.com Git - apple/configd.git/blob - SystemConfiguration.fproj/update-headers
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/(__IPHONE)_\w+\/\*SPI\*\//\1_NA/g;
36 $spi_new = clean_INC
($spi);
37 $spi_new =~ s/(__MAC_\w+)\/\*SPI\*\//\1/g;
38 $spi_new =~ s/(__IPHONE_\w+)\/\*SPI\*\//\1/g;
44 # Update .../PrivateHeaders
47 opendir(HEADERS
, $SPI_BASE);
48 @headers = readdir(HEADERS
);
57 $spi_path = $SPI_BASE . "/" . $spi_header;
58 next if (! -f
$spi_path);
60 open(SPI
, "<", $spi_path);
64 $spi_new = clean_SPI
($spi);
65 if ($spi ne $spi_new) {
66 printf "cleaning .../PrivateHeaders/%s\n", $spi_header;
67 open(SPI
, ">", $spi_path);
78 opendir(HEADERS
, $API_BASE);
79 @headers = readdir(HEADERS
);
88 $api_path = $API_BASE . "/" . $api_header;
89 next if (! -f
$api_path);
91 open(API
, "<", $api_path);
95 $api_new = clean_API
($api);
96 if ($api ne $api_new) {
97 printf "cleaning .../Headers/%s\n", $api_header;
98 open(API
, ">", $api_path);
103 $spi_new = clean_SPI
($api);
104 if ($api_new ne $spi_new) {
105 if ((($spi_header) = ($api =~ /#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/(.*?\
.h
)>\s
*.*?\n/))) {
106 if ($api_header eq $spi_header) {
107 die "API & SPI header not unique: $api_header\n";
110 die "Header missing #ifdef/#else/#endif: $api_header\n";
111 # $spi_header = $api_header;
112 # $spi_header =~ s/\.h$/PRIVATE.h/;
115 printf " adding .../PrivateHeaders/%s\n", $spi_header;
116 $spi_path = $SPI_BASE . "/" . $spi_header;
117 open(SPI
, ">", $spi_path);