]>
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/#define\t__AVAILABILITY_INTERNAL__.*FUTURE.*\/\*SPI\*\/\n//;
28 $api_new =~ s/(__IPHONE)_\w+\/\*SPI\*\//\1_NA/g;
37 $spi_new = clean_INC
($spi);
38 $spi_new =~ s/(__MAC_\w+)\/\*SPI\*\//\1/g;
39 $spi_new =~ s/(#define\t__AVAILABILITY_INTERNAL__.*FUTURE.*)\/\*SPI\*\//\1/;
40 $spi_new =~ s/(__IPHONE_\w+)\/\*SPI\*\//\1/g;
46 # Update .../PrivateHeaders
49 opendir(HEADERS
, $SPI_BASE);
50 @headers = readdir(HEADERS
);
59 $spi_path = $SPI_BASE . "/" . $spi_header;
60 next if (! -f
$spi_path);
62 open(SPI
, "<", $spi_path);
66 $spi_new = clean_SPI
($spi);
67 if ($spi ne $spi_new) {
68 printf "cleaning .../PrivateHeaders/%s\n", $spi_header;
69 open(SPI
, ">", $spi_path);
80 opendir(HEADERS
, $API_BASE);
81 @headers = readdir(HEADERS
);
90 $api_path = $API_BASE . "/" . $api_header;
91 next if (! -f
$api_path);
93 open(API
, "<", $api_path);
97 $api_new = clean_API
($api);
98 if ($api ne $api_new) {
99 printf "cleaning .../Headers/%s\n", $api_header;
100 open(API
, ">", $api_path);
105 $spi_new = clean_SPI
($api);
106 if ($api_new ne $spi_new) {
107 if ((($spi_header) = ($api =~ /#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/(.*?\
.h
)>\s
*.*?\n/))) {
108 if ($api_header eq $spi_header) {
109 die "API & SPI header not unique: $api_header\n";
112 die "Header missing #ifdef/#else/#endif: $api_header\n";
113 # $spi_header = $api_header;
114 # $spi_header =~ s/\.h$/PRIVATE.h/;
117 printf " adding .../PrivateHeaders/%s\n", $spi_header;
118 $spi_path = $SPI_BASE . "/" . $spi_header;
119 open(SPI
, ">", $spi_path);