-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile.PL.sombok
78 lines (62 loc) · 1.91 KB
/
Makefile.PL.sombok
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#-*- perl -*-
#-*- coding: us-ascii -*-
use ExtUtils::MakeMaker;
use Cwd;
my $define = '';
$define .= ' -DWIN32 -DPERL_STATIC_SYMS' if ($^O eq 'MSWin32');
my $pwd = cwd();
WriteMakefile(
NAME => 'sombok', # (doesn't matter what the name is here) oh yes it does
DEFINE => $define,
INC => "\"-I\$(PERL_INC)\" \"-I$pwd\$(DIRFILESEP)include\" @LIBTHAI_INC@", # force PERL_INC dir ahead of system -I's
SKIP => [qw(dynamic dynamic_lib dlsyms)],
OBJECT => '$(O_FILES)',
clean => {'FILES' => 'libsombok$(LIB_EXT)'},
H => [qw(include/sombok.h include/sombok_constants.h $(PERL_INC)/config.h)],
C => [qw(lib/break.c lib/charprop.c lib/gcstring.c lib/linebreak.c lib/southeastasian.c lib/utf8.c lib/utils.c lib/@[email protected])]
);
sub MY::constants {
package MY;
my $self = shift;
$self->{INST_STATIC} = 'libsombok$(LIB_EXT)';
return $self->SUPER::constants();
}
sub MY::top_targets {
my $r = '
all :: static
$(NOECHO) $(NOOP)
config ::
$(NOECHO) $(NOOP)
lint:
lint -abchx $(LIBSRCS)
pure_all ::
$(NOECHO) $(NOOP)
';
if ($ExtUtils::MakeMaker::VERSION >= 7.16) { #https://rt.cpan.org/Ticket/Display.html?id=117800
#when it would be fixed in EUMM, <= condition should be added
$r .= '
dynamic ::
$(NOECHO) $(NOOP)
';
}
$r .= '
# This is a workaround, the problem is that our old GNU make exports
# variables into the environment so $(MYEXTLIB) is set in here to this
# value which can not be built.
sombok/libsombok.a:
$(NOECHO) $(NOOP)
' unless $^O eq 'VMS';
return $r;
}
sub MY::c_o {
package MY;
my $self = shift;
my $inherited = $self->SUPER::c_o(@_);
$inherited =~ s{(:\n\t)(.*(?:\n\t.*)*)}
{ $1 . $self->cd('lib', split /(?<!\\)\n\t/, $2) }eg;
$inherited =~ s{(\s)(\$\*\.c\s)}
{ "$1..\$(DIRFILESEP)$2" }eg;
$inherited =~ s{(-o\s)(\$\*\$\(OBJ_EXT\))}
{ "$1..\$(DIRFILESEP)$2" }eg;
$inherited;
}