jonathanstowe / TermReadKey

Character mode terminal access for Perl
12 stars 27 forks source link

Make ReadKey.o depend upon ReadKey.c and cchars.h #30

Closed zmughal closed 7 years ago

zmughal commented 7 years ago

This explicit rule ensures that cchars.h is available when compiling ReadKey.o.

This build issue was uncovered when installing under MSYS2/MinGW64 and using dmake. Without this fix, the cchars.h file gets deleted right before it is needed by the compilation as follows:

$ cpanm --verbose Term::ReadKey
[ ...snip... ]
"C:\msys64\mingw64\bin\perl.exe" -I. -IC:\msys64\mingw64\lib\perl5\core_perl genchars.pl

Writing termio/termios section of cchars.h... Done.
Checking for sgtty...
        Sgtty NOT found.
Writing sgtty section of cchars.h... Done.
"C:\msys64\mingw64\bin\perl.exe" "C:\msys64\mingw64\lib\perl5\core_perl\ExtUtils\xsubpp" -noprototypes -typemap C:\msys64\mingw64\lib\perl5\core_perl\ExtUtils\typemap  ReadKey.xs > ReadKey.xsc
"C:\msys64\mingw64\bin\perl.exe" -MExtUtils::Command -e mv -- ReadKey.xsc ReadKey.c
del  cchars.h
gcc -c          -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2      -DVERSION=\"2.33\"    -DXS_VERSION=\"2.33\"  "-IC:\msys64\mingw64\lib\perl5\core_perl\CORE"   ReadKey.c
ReadKey.xs:375:20: fatal error: cchars.h: No such file or directory
compilation terminated.
dmake.exe:  Error code 129, while making 'ReadKey.o'
! Installing Term::ReadKey failed.
FAIL

Fixes https://github.com/jonathanstowe/TermReadKey/issues/16.

zmughal commented 7 years ago

I have tested this under MSYS2/MinGW64 and Strawberry Perl. And GNU/Linux, but we'll see if Travis CI is happy as well.

jonathanstowe commented 7 years ago

Cheers for this. I'll have to have a look at what else is to be released.

zmughal commented 6 years ago

Mind pushing out a release with this? I just happened to notice the bug again while I was manually putting together a new VM.

zmughal commented 6 years ago

Hello @jonathanstowe, sorry to bother you again. I was building another VM just now and came across this again. I'd appreciate a new release so I can remove the bugfix from my long-term memory, haha! :-D