mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
r14481: Change paths in headers on the fly when installing. Adds a simple text
file that contains the paths where headers need to be installed.
This commit is contained in:
parent
9bfc3c2537
commit
c3d975f4dc
47
source/headermap.txt
Normal file
47
source/headermap.txt
Normal file
@ -0,0 +1,47 @@
|
||||
# FIXME: This file should be autogenerated by the build system at some
|
||||
# point
|
||||
lib/talloc/talloc.h: talloc.h
|
||||
lib/util/util.h: util.h
|
||||
lib/util/debug.h: util/debug.h
|
||||
lib/util/mutex.h: util/mutex.h
|
||||
lib/util/util_proto.h: util/proto.h
|
||||
nt_status.h: core/nt_status.h
|
||||
lib/util/byteorder.h: util/byteorder.h
|
||||
lib/util/safe_string.h: util/safe_string.h
|
||||
lib/util/xfile.h: util/xfile.h
|
||||
lib/tdr/tdr.h: tdr.h
|
||||
librpc/rpc/dcerpc.h: dcerpc.h
|
||||
lib/socket_wrapper/socket_wrapper.h: socket_wrapper.h
|
||||
libnet/libnet.h: libnet.h
|
||||
libnet/libnet_join.h: libnet/join.h
|
||||
libnet/libnet_lookup.h: libnet/lookup.h
|
||||
libnet/libnet_passwd.h: libnet/passwd.h
|
||||
libnet/libnet_rpc.h: libnet/rpc.h
|
||||
libnet/libnet_share.h: libnet/share.h
|
||||
libnet/libnet_time.h: libnet/time.h
|
||||
libnet/libnet_user.h: libnet/user.h
|
||||
libnet/libnet_site.h: libnet/site.h
|
||||
libnet/libnet_vampire.h: libnet/vampire.h
|
||||
libnet/userinfo.h: libnet/userinfo.h
|
||||
libnet/userman.h: libnet/userman.h
|
||||
lib/ldb/include/ldb.h: ldb.h
|
||||
ntvfs/ntvfs.h: ntvfs.h
|
||||
lib/tdb/include/tdb.h: tdb.h
|
||||
auth/gensec/gensec.h: gensec.h
|
||||
gtk/common/gtk-smb.h: gtk-smb.h
|
||||
gtk/common/select.h: gtk/select.h
|
||||
librpc/ndr/libndr.h: ndr.h
|
||||
lib/registry/registry.h: registry.h
|
||||
libcli/util/nterr.h: core/nterr.h
|
||||
libcli/util/doserr.h: core/doserr.h
|
||||
libcli/util/nt_status.h: core/ntstatus.h
|
||||
libcli/cldap/cldap.h: cldap.h
|
||||
lib/samba3/samba3.h: samba3.h
|
||||
include/core.h: core.h
|
||||
librpc/gen_ndr/dcerpc.h: gen_ndr/dcerpc.h
|
||||
librpc/gen_ndr/misc.h: gen_ndr/misc.h
|
||||
librpc/ndr/libndr_proto.h: ndr/proto.h
|
||||
librpc/rpc/dcerpc_proto.h: dcerpc/proto.h
|
||||
lib/tdr/tdr_proto.h: tdr/proto.h
|
||||
auth/credentials/credentials.h: credentials.h
|
||||
auth/credentials/credentials_proto.h: credentials/proto.h
|
@ -1,18 +1,70 @@
|
||||
#!/usr/bin/perl
|
||||
# Copyright (C) 2006 Jelmer Vernooij
|
||||
use strict;
|
||||
use File::Basename;
|
||||
|
||||
my $includedir = shift;
|
||||
|
||||
|
||||
sub read_headermap($)
|
||||
{
|
||||
my ($fn) = @_;
|
||||
my %map = ();
|
||||
my $ln = 0;
|
||||
open(MAP, "<headermap.txt");
|
||||
while(<MAP>) {
|
||||
$ln++;
|
||||
s/#.*$//g;
|
||||
next if (/^\s*$/);
|
||||
if (! /^(.*): (.*)$/) {
|
||||
print STDERR "headermap.txt:$ln: Malformed line\n";
|
||||
next;
|
||||
}
|
||||
$map{$1} = $2;
|
||||
}
|
||||
|
||||
close(MAP);
|
||||
|
||||
return %map;
|
||||
}
|
||||
|
||||
my %map = read_headermap("headermap.txt");
|
||||
|
||||
sub findmap($)
|
||||
{
|
||||
$_ = shift;
|
||||
s/^\.\///g;
|
||||
|
||||
if (! -f $_ && -f "lib/$_") { $_ = "lib/$_"; }
|
||||
|
||||
return $map{$_};
|
||||
}
|
||||
|
||||
sub rewrite_include($$)
|
||||
{
|
||||
my ($pos,$d) = @_;
|
||||
|
||||
my $n = findmap($d);
|
||||
return $n if $n;
|
||||
return $d;
|
||||
}
|
||||
|
||||
sub install_header($$)
|
||||
{
|
||||
my ($src,$dst) = @_;
|
||||
|
||||
my $lineno = 0;
|
||||
|
||||
open(IN, "<$src");
|
||||
open(OUT, ">$dst");
|
||||
|
||||
while (<IN>) {
|
||||
print OUT $_;
|
||||
$lineno++;
|
||||
if (/^#include \"(.*)\"/) {
|
||||
print OUT "#include <" . rewrite_include("$src:$lineno", $1) . ">\n";
|
||||
} else {
|
||||
print OUT $_;
|
||||
}
|
||||
}
|
||||
|
||||
close(OUT);
|
||||
@ -21,15 +73,25 @@ sub install_header($$)
|
||||
|
||||
foreach my $p (@ARGV)
|
||||
{
|
||||
my $p2 = basename($p);
|
||||
print "Installing $p as $includedir/$p2\n";
|
||||
my $p2 = findmap($p);
|
||||
unless ($p2) {
|
||||
warn("Unable to map $p");
|
||||
next;
|
||||
}
|
||||
print "Installing $p as $includedir/$p2\n";
|
||||
|
||||
if ( -f "$includedir/$p2" ) {
|
||||
unlink("$includedir/$p2.old");
|
||||
rename("$includedir/$p2", "$includedir/$p2.old");
|
||||
}
|
||||
my $dirname = dirname($p2);
|
||||
|
||||
install_header($p,"$includedir/$p2");
|
||||
if (! -d "$includedir/$dirname") {
|
||||
mkdir("$includedir/$dirname");
|
||||
}
|
||||
|
||||
if ( -f "$includedir/$p2" ) {
|
||||
unlink("$includedir/$p2.old");
|
||||
rename("$includedir/$p2", "$includedir/$p2.old");
|
||||
}
|
||||
|
||||
install_header($p,"$includedir/$p2");
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
|
Loading…
Reference in New Issue
Block a user