]>
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 $USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK = $ENV{"USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK"} eq "YES";
11 $API_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PUBLIC_HEADERS_FOLDER_PATH"};
12 $SPI_BASE = $ENV{"INSTALL_DIR"} . "/" . $ENV{"PRIVATE_HEADERS_FOLDER_PATH"};
17 $inc =~ s/#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/.*?>.*?\n#else.*?\n//;
18 $inc =~ s/#endif\s+.*?USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS.*?\n//;
27 $api_new = $DO_SPLIT ? $api : clean_INC
($api);
28 $api_new =~ s/(__MAC)_\w+\/\*SPI\*\//\1_NA/g;
29 $api_new =~ s/#define\t__AVAILABILITY_INTERNAL__.*FUTURE.*\/\*SPI\*\/\n//;
30 $api_new =~ s/(__IPHONE)_\w+\/\*SPI\*\//\1_NA/g;
39 $spi_new = clean_INC
($spi);
40 $spi_new =~ s/(__MAC_\w+)\/\*SPI\*\//\1/g;
41 $spi_new =~ s/(#define\t__AVAILABILITY_INTERNAL__.*FUTURE.*)\/\*SPI\*\//\1/;
42 $spi_new =~ s/(__IPHONE_\w+)\/\*SPI\*\//\1/g;
48 my ($api_header) = @_;
52 #warning \"Please #include <SystemConfiguration/PUBLIC.h> instead of this file directly.\"
53 #include <SystemConfiguration/PUBLIC.h>
55 $stub_new =~ s/PUBLIC.h/$api_header/g;
61 # Update .../PrivateHeaders
64 opendir(HEADERS
, $SPI_BASE);
65 @headers = readdir(HEADERS
);
74 $spi_path = $SPI_BASE . "/" . $spi_header;
75 next if (! -f
$spi_path);
77 open(SPI
, "<", $spi_path);
81 $spi_new = clean_SPI
($spi);
82 if ($spi ne $spi_new) {
83 printf "cleaning .../PrivateHeaders/%s\n", $spi_header;
84 open(SPI
, ">", $spi_path);
95 opendir(HEADERS
, $API_BASE);
96 @headers = readdir(HEADERS
);
102 next if ($_ eq '..');
105 $api_path = $API_BASE . "/" . $api_header;
106 next if (! -f
$api_path);
108 open(API
, "<", $api_path);
112 $api_new = clean_API
($api);
113 next if ($api eq $api_new); # if no tweaks needed
115 if (!$USING_PRIVATE_SYSTEMCONFIGURATION_FRAMEWORK) {
116 printf "cleaning .../Headers/%s\n", $api_header;
117 open(API
, ">", $api_path);
122 $spi_new = clean_SPI
($api);
123 if ($api_new ne $spi_new) {
124 if ((($spi_header) = ($api =~ /#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/(.*?\
.h
)>\s
*.*?\n/))) {
125 if ($api_header eq $spi_header) {
126 die "API & SPI header not unique: $api_header\n";
129 die "Header missing #ifdef/#else/#endif: $api_header\n";
130 # $spi_header = $api_header;
131 # $spi_header =~ s/\.h$/PRIVATE.h/;
134 printf " adding .../PrivateHeaders/%s\n", $spi_header;
135 $spi_path = $SPI_BASE . "/" . $spi_header;
136 open(SPI
, ">", $spi_path);
142 $spi_new = clean_SPI
($api);
143 if ($api_new ne $spi_new) {
144 if ((($stub_header) = ($api =~ /#ifdef\s+USE_SYSTEMCONFIGURATION_PRIVATE_HEADERS\s*.*?\n#include\s+<SystemConfiguration\/(.*?\
.h
)>\s
*.*?\n/))) {
145 if ($api_header eq $stub_header) {
146 die "API & STUB header not unique: $api_header\n";
149 die "Header missing #ifdef/#else/#endif: $api_header\n";
152 printf "updating .../Headers/%s\n", $api_header;
153 open(API
, ">", $api_path);
157 printf " adding .../PrivateHeaders/%s (stub)\n", $stub_header;
158 $stub_path = $SPI_BASE . "/" . $stub_header;
159 $stub_new = create_STUB
($api_header);
160 open(STUB
, ">", $stub_path);
161 print STUB
$stub_new;