@@ -6,40 +6,73 @@ class RakudoStar < Formula
66 license "Artistic-2.0"
77
88 bottle do
9- sha256 arm64_sequoia : "523d234bf059e1ea81d7633b3caafd94973b9e42f1df746a694b1ccd0d2e1368"
10- sha256 arm64_sonoma : "6413d986f8f733757258d15ab38de86f8046fb8c312f4d107212b8ab3bf5e6f0"
11- sha256 arm64_ventura : "a1ca5dbba61fe6a6c8b2e333e59f5db3e5e7751d4ac07a212599ea7b65dc2734"
12- sha256 sonoma : "766709a05b53bcad5ee13ce700159a589ff6ccf6fcb68d0e11c3235f78542a2a"
13- sha256 ventura : "2030e6969c29ad77c123946f46172e42786a4cb21140aab0bc9ccee0f9bb0088"
14- sha256 x86_64_linux : "94d39d2e72eb57c4afc4a1bb4733b6cae96d77618cc4a997b495e7cbd728dca7"
9+ rebuild 1
10+ sha256 arm64_sequoia : "5f333665dfe2213e47659de5c105161f240f0b451907a3041996cec27975db3c"
11+ sha256 arm64_sonoma : "f8fe89c21b5a88b97144615679ce401d28249ed1e4b9e692d5224aded1ca7068"
12+ sha256 arm64_ventura : "05e6ee91230256c4e845ecb13005dc39eead7bc11c4c85cc3ed492673ef74850"
13+ sha256 sonoma : "3ca9539f0917ca056c321887a9d848d608310f61dae42ef2b756a4f700227968"
14+ sha256 ventura : "24ce60a9c53bdd182b70b308dabdf32c2932656f52cf292bc583e3b90f813c89"
15+ sha256 x86_64_linux : "1187c0324314df2a54a8e37352f2578b5c70d7899abf8eb351d47472c40b863c"
1516 end
1617
1718 depends_on "bash" => :build
18- depends_on "gmp"
19- depends_on "icu4c@76"
20- depends_on "openssl@3"
21- depends_on "pcre"
22- depends_on "readline"
19+ depends_on "pkgconf" => :build
20+ depends_on "sqlite" => [ :build , :test ]
21+ depends_on "libtommath"
22+ depends_on "libuv"
23+ depends_on "mimalloc"
24+ depends_on "openssl@3" # for OpenSSL module, loaded by path
25+ depends_on "readline" # for Readline module, loaded by path
26+ depends_on "zstd"
27+
28+ uses_from_macos "perl" => :build
2329 uses_from_macos "libffi" , since : :catalina
30+ uses_from_macos "libxml2"
2431
2532 conflicts_with "moar" , because : "both install `moar` binaries"
2633 conflicts_with "moarvm" , "nqp" , because : "rakudo-star currently ships with moarvm and nqp included"
2734 conflicts_with "parrot"
2835 conflicts_with "rakudo"
2936
37+ # Apply open Config::Parser::json PR to fix unittests run during install
38+ # Ref: https://github.com/arjancwidlak/p6-Config-Parser-json/pull/1
39+ patch do
40+ url "https://github.com/arjancwidlak/p6-Config-Parser-json/commit/ca1a355c95178034b08ff9ebd1516a2e9d5bc067.patch?full_index=1"
41+ sha256 "d13230dc7d8ec0b72c21bd17e99a62d959fb3559d483eb43ce6be7ded8a0492a"
42+ directory "src/rakudo-star-modules/Config-Parser-json"
43+ end
44+
45+ # Allow adding arguments via inreplace to unbundle libraries in MoarVM
46+ patch :DATA
47+
3048 def install
31- if !OS . mac? || MacOS . version < :catalina
32- libffi = Formula [ "libffi" ]
33- ENV . remove "CPPFLAGS" , "-I#{ libffi . include } "
34- ENV . prepend "CPPFLAGS" , "-I#{ libffi . lib } /libffi-#{ libffi . version } /include"
35- end
49+ # Unbundle libraries in MoarVM
50+ moarvm_3rdparty = buildpath . glob ( "src/moarvm-*/MoarVM-*/3rdparty" ) . first
51+ %w[ dyncall libatomicops libtommath libuv mimalloc ] . each { |dir | rm_r ( moarvm_3rdparty /dir ) }
52+ moarvm_configure_args = %W[
53+ --c11-atomics
54+ --has-libffi
55+ --has-libtommath
56+ --has-libuv
57+ --has-mimalloc
58+ --pkgconfig=#{ Formula [ "pkgconf" ] . opt_bin } /pkgconf
59+ ]
60+ inreplace "lib/actions/install.bash" , "@@MOARVM_CONFIGURE_ARGS@@" , moarvm_configure_args . join ( " " )
61+
62+ # Help Readline module find brew `readline` on Linux
63+ inreplace "src/rakudo-star-modules/Readline/lib/Readline.pm" ,
64+ %r{\( (\n *)('/lib/x86_64-linux-gnu',)} ,
65+ "(\\ 1'#{ Formula [ "readline" ] . opt_lib } ',\\ 1\\ 2"
3666
3767 ENV . deparallelize # An intermittent race condition causes random build failures.
3868
3969 # make install runs tests that can hang on sierra
4070 # set this variable to skip those tests
4171 ENV [ "NO_NETWORK_TESTING" ] = "1"
4272
73+ # Help DBIish module find sqlite shared library
74+ ENV [ "DBIISH_SQLITE_LIB" ] = Formula [ "sqlite" ] . opt_lib /shared_library ( "libsqlite3" )
75+
4376 # openssl module's brew --prefix openssl probe fails so
4477 # set value here
4578 openssl_prefix = Formula [ "openssl@3" ] . opt_prefix
@@ -57,8 +90,75 @@ def install
5790 share . install prefix /"man" if ( prefix /"man" ) . directory?
5891 end
5992
93+ def post_install
94+ ( share /"perl6/vendor/short" ) . mkpath
95+ end
96+
6097 test do
6198 out = shell_output ( "#{ bin } /raku -e 'loop (my $i = 0; $i < 10; $i++) { print $i }'" )
6299 assert_equal "0123456789" , out
100+
101+ # Test OpenSSL module
102+ ( testpath /"openssl.raku" ) . write <<~PERL
103+ use OpenSSL::CryptTools;
104+ my $ciphertext = encrypt("brew".encode, :aes256, :iv(("0" x 16).encode), :key(('x' x 32).encode));
105+ print decrypt($ciphertext, :aes256, :iv(("0" x 16).encode), :key(('x' x 32).encode)).decode;
106+ PERL
107+ assert_equal "brew" , shell_output ( "#{ bin } /raku openssl.raku" )
108+
109+ # Test Readline module
110+ ( testpath /"readline.raku" ) . write <<~PERL
111+ use Readline;
112+ my $response = Readline.new.readline("test> ");
113+ print "[$response]";
114+ PERL
115+ assert_equal "test> brew\n [brew]" , pipe_output ( "#{ bin } /raku readline.raku" , "brew\n " , 0 )
116+
117+ # Test LibXML module
118+ ( testpath /"libxml.raku" ) . write <<~PERL
119+ use LibXML::Document;
120+ my LibXML::Document $doc .= parse: :string('<Hello/>');
121+ $doc.root.nodeValue = 'World!';
122+ print $doc<Hello>;
123+ PERL
124+ assert_equal "<Hello>World!</Hello>" , shell_output ( "#{ bin } /raku libxml.raku" )
125+
126+ # Test DBIish module
127+ ( testpath /"sqlite.raku" ) . write <<~PERL
128+ use DBIish;
129+ my $dbh = DBIish.connect("SQLite", :database<test.sqlite3>, :RaiseError);
130+ $dbh.execute("create table students (name text, age integer)");
131+ $dbh.execute("insert into students (name, age) values ('Bob', 14)");
132+ $dbh.execute("insert into students (name, age) values ('Sue', 12)");
133+ say $dbh.execute("select name from students order by age asc").allrows();
134+ $dbh.dispose;
135+ PERL
136+ assert_equal "([Sue] [Bob])\n " , shell_output ( "#{ bin } /raku sqlite.raku" )
137+
138+ # Test Config::Parser::json module
139+ ( testpath /"test.json" ) . write <<~JSON
140+ { "foo": { "bar": [0, 1] } }
141+ JSON
142+ ( testpath /"parser.raku" ) . write <<~PERL
143+ use Config;
144+ use Config::Parser::json;
145+ my $config = Config.new();
146+ $config.=read("test.json");
147+ print $config.get('foo.bar');
148+ PERL
149+ assert_equal "0 1" , shell_output ( "#{ bin } /raku parser.raku" )
63150 end
64151end
152+
153+ __END__
154+ --- a/lib/actions/install.bash
155+ +++ b/lib/actions/install.bash
156+ @@ -168,7 +168,7 @@ build_moarvm() {
157+ fi
158+
159+ {
160+ - perl Configure.pl "$@" \
161+ + perl Configure.pl @@MOARVM_CONFIGURE_ARGS@@ "$@" \
162+ && make \
163+ && make install \
164+ > "$logfile" \
0 commit comments