newsboat / stfl

stfl with Newsboat-related bugfixes
GNU Lesser General Public License v3.0
7 stars 3 forks source link

Some effort to compile on windows #7

Open Kreijstal opened 8 months ago

Kreijstal commented 8 months ago

This is some effort, complete compilation fails due to perl shenanigans and because I have no idea how perl works, but at least the example.c is compiled.

image

Minoru commented 8 months ago

Also, what Perl issues did you run into? Perhaps I'd be able to help.

Kreijstal commented 8 months ago

Also, what Perl issues did you run into? Perhaps I'd be able to help.

I guess mainly telling windows perl that using bash.exe is okay check this out

export PERL5SHELL="bash -l -c"
kreij@LAPTOP-31E3HV7R MINGW64 ~/stfl
$ make clean
gcc -pthread -I. -MM *.c > Makefile.deps_new
gcc -pthread -I. -MM widgets/*.c | sed 's,^wt_[^ ]*\.o: ,widgets/&,' >> Makefile.deps_new
mv -f Makefile.deps_new Makefile.deps
rm -f libstfl.a example core core.* *.o Makefile.deps
rm -f widgets/*.o spl/mod_stfl.so spl/example.db
cd perl5 && perl Makefile.PL && make clean && rm -f Makefile.old
mingw32-make[1]: *** No rule to make target 'C:\Users\kreij\scoop\apps\msys2\2022-01-28\mingw64\lib\perl5\core_perlConfig.pm', needed by 'Makefile'.  Stop.
mingw32-make[1]: *** No rule to make target 'C:\Users\kreij\scoop\apps\msys2\2022-01-28\mingw64\lib\perl5\core_perlConfig.pm', needed by 'Makefile'.  Stop.
mingw32-make[1]: *** No rule to make target 'C:\Users\kreij\scoop\apps\msys2\2022-01-28\mingw64\lib\perl5\core_perlConfig.pm', needed by 'Makefile'.  Stop.
Generating a make-style Makefile
Writing Makefile for stfl
Writing MYMETA.yml and MYMETA.json
make[1]: Entering directory '/home/kreij/stfl/perl5'
make[1]: *** No rule to make target 'C:\Users\kreij\scoop\apps\msys2\2022-01-28\mingw64\lib\perl5\core_perlConfig.pm', needed by 'Makefile'.  Stop.
make[1]: Leaving directory '/home/kreij/stfl/perl5'
make: *** [Makefile:73: clean] Error 2

I assume the file that it wants it's 'C:\Users\kreij\scoop\apps\msys2\2022-01-28\mingw64\lib\perl5\core_perl\Config.pm' but because of path conversion shenanigans it's hard to see :(, as for the reason for doing this, it's because it was a dependency of newsboat, and wanted to compile it for windows, and yeah, I'm excited about the new tool/library that is going to replace sftl

Minoru commented 8 months ago

it's because it was a dependency of newsboat, and wanted to compile it for windows

Wow! Okay, let's work on this then :)

The output here on Debian stable looks somewhat differently:

$ make clean
rm -f libstfl.a example core core.* *.o Makefile.deps
rm -f widgets/*.o spl/mod_stfl.so spl/example.db
cd perl5 && perl Makefile.PL && make clean && rm -f Makefile.old
Generating a Unix-style Makefile
Writing Makefile for stfl
Writing MYMETA.yml and MYMETA.json
make[1]: Entering directory '/dev/shm/stfl/perl5'
rm -f \
  stfl.bso stfl.def \
  stfl.exp stfl.x \
  stfl.bs blib/arch/auto/stfl/extralibs.all \
  blib/arch/auto/stfl/extralibs.ld Makefile.aperl \
  *.a *.o \
  *perl.core MYMETA.json \
  MYMETA.yml blibdirs.ts \
  core core.*perl.*.? \
  core.[0-9] core.[0-9][0-9] \
  core.[0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9] \
  core.[0-9][0-9][0-9][0-9][0-9] libstfl.def \
  mon.out perl \
  perl perl.exe \
  perlmain.c pm_to_blib \
  pm_to_blib.ts so_locations \
  tmon.out
rm -rf \
  blib
mv Makefile Makefile.old > /dev/null 2>&1
make[1]: Leaving directory '/dev/shm/stfl/perl5'
rm -f perl5/stfl_wrap.c perl5/stfl.pm perl5/build_ok
rm -f python/stfl.py python/stfl.pyc python/_stfl.so
rm -f python/stfl_wrap.c python/stfl_wrap.o
rm -f ruby/Makefile ruby/stfl_wrap.c ruby/stfl_wrap.o
rm -f ruby/stfl.so ruby/build_ok Makefile.deps_new
rm -f stfl.pc libstfl.so libstfl.so.*

I can run the Perl script manually and examine the Makefile:

$ cd perl5
$ perl Makefile.PL

In it, I see this line:

CONFIGDEP = $(PERL_ARCHLIBDEP)$(DFSEP)Config.pm $(PERL_INCDEP)$(DFSEP)config.h

Something's up with DFSEP then? The definitons are towards the beginning of the file:

DFSEP = $(DIRFILESEP)

and finally:

DIRFILESEP = /

So apparently the Perl module ExtUtils::MakeMaker doesn't support Windows. Quick websearch led me to https://stackoverflow.com/a/9455881/2350060, which claims that (back in 2012 at least) this module didn't support GNU Make (not by design, rather by coincidence), although the error message in that question was quite different. I think you'd have to delve deeper into that Perl module's issue tracker to find out how things stand today.

This is on Linux. On Windows, you might be running into ramifications of this one: https://stackoverflow.com/a/9455881/2350060 You're getting a different error, it looks like for you DIRFILESEP is just empty. Can you double-check that?

However, if we take a step back and re-examine the situation, then maybe you did enough already. Newsboat doesn't use Perl bindings to STFL. All it needs is libstf.so library and stfl.h header. You got that building already, so mission accomplished I guess?

(Edited once I realized that of course for me the separator is a slash -- I'm on Linux!)

Kreijstal commented 8 months ago

my DIRFILESEP is \ which makes sense, but is there a way to change it to / considering I am on bash on windows, but it looks like MakeMaker is unmantained :D (or more or less there are other tools for perl), anyway, you've been very helpful, thank you so much. And yeah I don't think anyone is looking to use sftl.. with perl... on windows.