Building november on Vista

1 view
Skip to first unread message

Lyle

unread,
Apr 6, 2009, 2:32:51 PM4/6/09
to november-wiki
Hi All,
I thought I'd have a stab at building november on Vista with the aim
to get it working through IIS.

I've managed to get so far. I had to update Makefile.in to have $
(PARROT_DIR)/parrot.exe instead of $(PARROT_DIR)/parrot, similar for
Makefile.PL.

I've includes patches for Makefile.in and .PL at the end of this
message.

nmake doesn't work with the error

"NMAKE : fatal error U1073: don't know how to make 'lib/
November.pir'"

But MinGW make works most of the way:-

mingw32-make

c:\temp\rakudo\parrot/parrot.exe c:\temp\rakudo/perl6.pbc --target=pir
--output=
lib/November.pir lib/November.pm
Can't find ./HTML/Template in @INC
... lots of other info ...


HTML/Template isn't in the lib folder with everything else:-
http://github.com/viklund/november/tree/3f8cb3ff8f81585de9b363929183707238947349/lib

Do I need to get it from somewhere else?


Thanks in advance for your help.


Lyle

P.S. Patches to follow...


--- Makefile.in.orig Mon Apr 06 19:21:47 2009
+++ Makefile.in Mon Apr 06 19:21:10 2009
@@ -1,3 +1,4 @@
+PARROT_EXEC=<PARROT_EXEC>
PARROT_DIR=<PARROT_DIR>
RAKUDO_DIR=<RAKUDO_DIR>

@@ -14,7 +15,7 @@
all: $(PIRS)

%.pir: %.pm
- $(PARROT_DIR)/parrot $(RAKUDO_DIR)/perl6.pbc --target=pir --output=
$@ $<
+ $(PARROT_DIR)/$(PARROT_EXEC) $(RAKUDO_DIR)/perl6.pbc --target=pir --
output=$@ $<

clean:
rm -f $(PIRS)
@@ -22,5 +23,5 @@
tests: test

test: all
- prove -e '$(PARROT_DIR)/parrot $(RAKUDO_DIR)/perl6.pbc'\
+ prove -e '$(PARROT_DIR)/$(PARROT_EXEC) $(RAKUDO_DIR)/perl6.pbc'\
-r --nocolor t/


--- Makefile.PL.orig Mon Apr 06 19:22:00 2009
+++ Makefile.PL Mon Apr 06 19:20:24 2009
@@ -15,10 +15,12 @@
$ENV{PERL6LIB}
or die 'Please set $PERL6LIB (see README).'."\n";

+my $parrot_exec = 'parrot';
+$parrot_exec = 'parrot.exe' if ( $^O eq 'MSWin32' );
if ( ! -d $parrot_dir ) {
print STDERR "Not a directory $parrot_dir, exiting...\n";
exit 1;
-} elsif ( ! -x File::Spec->catfile( $parrot_dir, 'parrot' )) {
+} elsif ( ! -x File::Spec->catfile( $parrot_dir, $parrot_exec )) {
print STDERR "Couldn't find parrot executable in $parrot_dir, "
. "have you compiled?\n";
exit 1;
@@ -37,6 +39,7 @@
my @infiles = map { $_.'.in' } qw< Makefile test_wiki.sh wiki.sh >;

my %replacements = (
+ PARROT_EXEC => $parrot_exec,
PARROT_DIR => $parrot_dir,
RAKUDO_DIR => $rakudo_dir,
);


Lyle

unread,
Apr 6, 2009, 3:12:33 PM4/6/09
to november-wiki
On Apr 6, 7:32 pm, Lyle <webmas...@cosmicperl.com> wrote:
> Hi All,
>   I thought I'd have a stab at building november on Vista with the aim
> to get it working through IIS.

Just noticed the other thread pointing to the HTML-Template port on
github. I had to do similar patches again to get the Makefile (patches
at bottom of this message). Win32 doesn't support symlinks but it does
hardlinks. I also changed it so that it looks for RAKUDO_DIR like
november does as following the current Rakudo install guide it doesn't
end up in PARROT_DIR/languages/rakudo

Also I noticed that PERL6LIB only seems to check the last folder. Such
as setting PERL6LIB to multiple folders such as:-
set PERL6LIB=/folder1;/folder2;/folder3

It only looks in /folder3 for the files. Not sure if it's supposed to
do that but it seems wrong. Is that an issue with Rakudo?

After building HTML-Template I copied the lib folder over to november.
Now I'm getting the error

mingw32-make
c:\temp\rakudo\parrot/parrot.exe c:\temp\rakudo/perl6.pbc --target=pir
--output=
lib/November.pir lib/November.pm
Statement not terminated properly at line 33, near ":[\n "

I don't know any Parrot code and hardly any Perl 6 at this time. So
I'm stumpped.


Patches:-



--- Makefile.PL.orig Mon Apr 06 20:01:15 2009
+++ Makefile.PL Mon Apr 06 19:48:57 2009
@@ -9,27 +9,51 @@
my $parrot_dir = $ENV{PARROT_DIR}
or die 'Please set $PARROT_DIR (see README).'."\n";

+my $rakudo_dir = $ENV{RAKUDO_DIR}
+ or die 'Please set $RAKUDO_DIR (see README).'."\n";
+
$ENV{PERL6LIB}
or die 'Please set $PERL6LIB (see README).'."\n";

+my $parrot_exec = 'parrot';
+$parrot_exec = 'parrot.exe' if ( $^O eq 'MSWin32' );
if ( ! -d $parrot_dir ) {
print STDERR "Not a directory $parrot_dir, exiting...\n";
exit 1;
-} elsif ( ! -x File::Spec->catfile( $parrot_dir, 'parrot' )) {
+} elsif ( ! -x File::Spec->catfile( $parrot_dir, $parrot_exec )) {
print STDERR "Couldn't find parrot executable in $parrot_dir, "
. "have you compiled?";
exit 1;
}

+if ( ! -d $rakudo_dir ) {
+ print STDERR "Not a directory $rakudo_dir, exiting...\n";
+ exit 1;
+} elsif ( ! -f File::Spec->catfile( $rakudo_dir, 'perl6.pbc' )) {
+ print STDERR "Couldn't find perl6.pbc file in $rakudo_dir, "
+ . "have you compiled?\n";
+ exit 1;
+}
+
+
my @infiles = map { $_.'.in' } qw< Makefile >;

my %replacements = (
+ PARROT_EXEC => $parrot_exec,
PARROT_DIR => $parrot_dir,
+ RAKUDO_DIR => $rakudo_dir,
);

if ( !-e 'lib/Test.pm' ) {
- !system("ln -s $parrot_dir/languages/rakudo/Test.pm lib/") or die
@!;
- print "Symlinked Test.pm from the Rakudo directory \n";
+ ### Windows only support hard links are requires backslash \
+ if ( $^O eq 'MSWin32' ) {
+ !system("ln $rakudo_dir\\Test.pm lib\\") or die @!;
+ print "Hard linked Test.pm from the Rakudo directory \n";
+ }#if
+ else {
+ !system("ln -s $parrot_dir/languages/rakudo/Test.pm lib/") or
die @!;
+ print "Symlinked Test.pm from the Rakudo directory \n";
+ }#else
}

for my $infile (@infiles) {





--- Makefile.in.orig Mon Apr 06 20:00:40 2009
+++ Makefile.in Mon Apr 06 19:51:32 2009
@@ -1,4 +1,6 @@
+PARROT_EXEC=<PARROT_EXEC>
PARROT_DIR=<PARROT_DIR>
+RAKUDO_DIR=<RAKUDO_DIR>

SOURCES=lib/HTML/Template/Grammar.pm lib/HTML/Template.pm

@@ -7,11 +9,11 @@
all: $(PIRS)

%.pir: %.pm
- $(PARROT_DIR)/parrot $(PARROT_DIR)/languages/rakudo/perl6.pbc --
target=pir --output=$@ $<
+ $(PARROT_DIR)/$(PARROT_EXEC) $(RAKUDO_DIR)/perl6.pbc --target=pir --
output=$@ $<

clean:
rm -f $(PIRS)

test: all
- prove -e '$(PARROT_DIR)/parrot $(PARROT_DIR)/languages/rakudo/

Carl Mäsak

unread,
Apr 7, 2009, 1:56:54 AM4/7/09
to novemb...@googlegroups.com
Lyle (>):

> Hi All,
> I thought I'd have a stab at building november on Vista with the aim
> to get it working through IIS.

Cool!

> I've managed to get so far. I had to update Makefile.in to have $
> (PARROT_DIR)/parrot.exe instead of $(PARROT_DIR)/parrot, similar for
> Makefile.PL.
>
> I've includes patches for Makefile.in and .PL at the end of this
> message.

Applied, with slight modifications. Thanks!

> nmake doesn't work with the error
>
> "NMAKE : fatal error U1073: don't know how to make 'lib/
> November.pir'"

Don't know enough about nmake to know why it fails here. Maybe someone
else on the list does.

> Just noticed the other thread pointing to the HTML-Template port on
> github.

I added some of the explanations from that thread in the README file
of November.

> I had to do similar patches again to get the Makefile (patches
> at bottom of this message). Win32 doesn't support symlinks but it does
> hardlinks. I also changed it so that it looks for RAKUDO_DIR like
> november does as following the current Rakudo install guide it doesn't
> end up in PARROT_DIR/languages/rakudo

Also applied. Thanks!

The whole build system of the different Perl 6 projects out there is
going through a speedy evolution. November's build system, despite
having been updated quite recently, is already completely outdated. :)
Druid's is currently the most modern one; when I have the tuits, I'll
look into cross-pollinating the Windows-detection improvements with
the improved build system of Druid.

> Also I noticed that PERL6LIB only seems to check the last folder. Such
> as setting PERL6LIB to multiple folders such as:-
> set PERL6LIB=/folder1;/folder2;/folder3
>
> It only looks in /folder3 for the files. Not sure if it's supposed to
> do that but it seems wrong. Is that an issue with Rakudo?

Worksforme. But I use colons where you use semicolons -- maybe try the
former instead?

> After building HTML-Template I copied the lib folder over to november.
> Now I'm getting the error
>
> mingw32-make
> c:\temp\rakudo\parrot/parrot.exe c:\temp\rakudo/perl6.pbc --target=pir
> --output=
> lib/November.pir lib/November.pm
> Statement not terminated properly at line 33, near ":[\n       "
>
> I don't know any Parrot code and hardly any Perl 6 at this time. So
> I'm stumpped.

That was a syntax error due to a missing space. All fixed now.

Again, thanks! Best of luck.

// Carl

Lyle

unread,
Apr 7, 2009, 10:24:03 AM4/7/09
to novemb...@googlegroups.com
Carl Mäsak wrote:
> Lyle (>):

>
>> Also I noticed that PERL6LIB only seems to check the last folder. Such
>> as setting PERL6LIB to multiple folders such as:-
>> set PERL6LIB=/folder1;/folder2;/folder3
>>
>> It only looks in /folder3 for the files. Not sure if it's supposed to
>> do that but it seems wrong. Is that an issue with Rakudo?
>>
>
> Worksforme. But I use colons where you use semicolons -- maybe try the
> former instead?
>

Yes colons work. But the standard windows way is to use semi-colons.
Maybe I should submit that to Rakudo as a bug.

>> I don't know any Parrot code and hardly any Perl 6 at this time. So
>> I'm stumpped.
>>
>
> That was a syntax error due to a missing space. All fixed now.
>
> Again, thanks! Best of luck.
>

That's fixed it :) I had to create a .bat version of test_wiki.sh, here:-

set QS=%1
set PARROT_DIR=c:\temp\rakudo\parrot
set RAKUDO_DIR=c:\temp\rakudo
set REQUEST_METHOD=GET
set SERVER_NAME=test.foo
set SERVER_PORT=80
set REQUEST_URI=%QS%
%PARROT_DIR%/parrot %RAKUDO_DIR%/perl6.pbc wiki


Which works :) Although I'm not sure how I can get it working through
apache. I tried creating wiki.bat:-

#!c:\windows\system32\command.com
PARROT_DIR=c:\temp\rakudo\parrot
RAKUDO_DIR=c:\temp\rakudo
%PARROT_DIR%/parrot.exe %RAKUDO_DIR%/perl6.pbc wiki

Then updated Apache with:-

AddHandler cgi-script .bat
RewriteEngine On
RewriteRule ^/([^\.]*)$ /cgi-bin/wiki.bat [PT]

But it just tries to download wiki.bat instead of running it.

Shouldn't wiki.sh be replaced with a Perl 6 cgi script? Then we could
easily have something that should work all over? Such as

'wiki.p6'
#!c:\temp\rakudo\perl6.exe
use v6;
### Code to run wiki

Apache:-
AddHandler cgi-script .p6
RewriteEngine On
RewriteRule ^/([^\.]*)$ /cgi-bin/wiki.p6 [PT]

Or simply name wiki.p6 index.p6 and have DirectoryIndex point to it.
That way it could easily be setup in IIS as well.


Lyle

Lyle

unread,
Apr 7, 2009, 5:56:39 PM4/7/09
to novemb...@googlegroups.com
Lyle wrote:
> Shouldn't wiki.sh be replaced with a Perl 6 cgi script? Then we could
> easily have something that should work all over? Such as
>
> 'wiki.p6'
> #!c:\temp\rakudo\perl6.exe
> use v6;
> ### Code to run wiki
>
> Apache:-
> AddHandler cgi-script .p6
> RewriteEngine On
> RewriteRule ^/([^\.]*)$ /cgi-bin/wiki.p6 [PT]
>

I tried this. It was as simple as renaming wiki to wiki.p6 and adding

#!c:\temp\rakudo\perl6.exe
to the top. But unfortunately it doesn't work. Apache just hangs. Trying to run it directly from the command prompt works fine, if I modify test_wiki.bat to read:-

set QS=%1


set REQUEST_METHOD=GET
set SERVER_NAME=test.foo
set SERVER_PORT=80
set REQUEST_URI=%QS%

c:\temp\rakudo\perl6.exe wiki.p6

I get the expected output.

I'm led to believe this is a problem with Rakudo on windows when it is invoked from another program such as Apache or IIS.

I'm not sure how I can figure out what the problem is though, so I've hit a bit of a dead end :( Pretty frustrating as having it work on the command prompt means I'm very close...

I'll see if I can find some windows programmer forums and do some kind of trace to find out what's actually happening. If anyone has any ideas then please let me know.


Lyle


Lyle

unread,
Apr 8, 2009, 8:14:40 AM4/8/09
to november-wiki
Yeah! Got there in the end :)


I created a wiki.p6 based on wiki:-
#!c:\temp\rakudo\perl6.exe

BEGIN {
push @*INC, 'c:/htdocs/cgi-bin/lib';
}


use v6;

use CGI;
use November;
use Config;

my $c = Config.new(
markup => 'Text::Markup::Wiki::MediaWiki',
skin => 'CleanAndSoft'
);
my November $wiki = November.new(
config => $c,
);
$wiki.init();
my $cgi = CGI.new;
$cgi.init();
$wiki.handle_request($cgi);


Then in apache conf:-

AddHandler cgi-script .p6
RewriteEngine On
RewriteRule ^/([^\.]*)$ /cgi-bin/wiki.p6 [PT]


Lyle

Johan Viklund

unread,
Apr 8, 2009, 10:24:57 AM4/8/09
to novemb...@googlegroups.com
Great Work Lyle!

Could you add this information to the README and send in a patch, OR,
I could give you a commit bit, just give me your github username.

/Johan
--
Johan Viklund
Reply all
Reply to author
Forward
0 new messages