| 1 | use ExtUtils::MakeMaker;
|
|---|
| 2 |
|
|---|
| 3 | create_constants(); # Make a module
|
|---|
| 4 |
|
|---|
| 5 | # See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
|---|
| 6 | # the contents of the Makefile that is written.
|
|---|
| 7 | WriteMakefile(
|
|---|
| 8 | 'NAME' => 'OS2::Process',
|
|---|
| 9 | VERSION_FROM=> 'Process.pm',
|
|---|
| 10 | MAN3PODS => {}, # Pods will be built by installman.
|
|---|
| 11 | 'LIBS' => [''], # e.g., '-lm'
|
|---|
| 12 | 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
|
|---|
| 13 | 'INC' => '', # e.g., '-I/usr/include/other'
|
|---|
| 14 | IMPORTS => { _16_DosSmSetTitle => 'sesmgr.DOSSMSETTITLE',
|
|---|
| 15 | # _16_Win16SetTitle => 'pmshapi.93',
|
|---|
| 16 | },
|
|---|
| 17 | );
|
|---|
| 18 |
|
|---|
| 19 | sub create_constants {
|
|---|
| 20 | return if -d 'Process_constants';
|
|---|
| 21 | my $src_dir;
|
|---|
| 22 | my @try = qw(.. ../.. ../../.. ../../../..);
|
|---|
| 23 | for (@try) {
|
|---|
| 24 | $src_dir = $_, last if -d "$_/utils" and -r "$_/utils/h2xs";
|
|---|
| 25 | }
|
|---|
| 26 | warn("Can't find \$PERL_SRC/utils/h2xs in @try, falling back to no constants"),
|
|---|
| 27 | return unless defined $src_dir;
|
|---|
| 28 | # Can't name it *::Constants, otherwise constants.xs would overwrite it...
|
|---|
| 29 | # This produces warnings from PSZ-conversion on WS_* constants.
|
|---|
| 30 | system $^X, "-I$src_dir/lib", "$src_dir/utils/h2xs", '-fn', 'OS2::Process::Const',
|
|---|
| 31 | '--skip-exporter', '--skip-autoloader', # too large memory overhead
|
|---|
| 32 | '--skip-strict', '--skip-warnings', # likewise
|
|---|
| 33 | '--skip-ppport', # will not work without dynaloading.
|
|---|
| 34 | # Most useful for OS2::Process:
|
|---|
| 35 | '-M^(HWND|WM|SC|SWP|WC|PROG|QW|EDI|WS|QWS|QWP|QWL|FF|FI|LS|FS|FCF|BS|MS|TBM|CF|CFI|FID|MB|MBID|CF|CFI|SPTR)_',
|
|---|
| 36 | '-F', '-DINCL_NLS -DINCL_BASE -DINCL_PM', # Define more symbols
|
|---|
| 37 | 'os2emx.h' # EMX version of OS/2 API
|
|---|
| 38 | and warn("Can't build module with contants, falling back to no constants"),
|
|---|
| 39 | return;
|
|---|
| 40 | rename 'OS2/Process/Const', 'Process_constants'
|
|---|
| 41 | or warn("Error renaming module, falling back to no constants: $!"),
|
|---|
| 42 | return;
|
|---|
| 43 | return 1;
|
|---|
| 44 | }
|
|---|