aboutsummaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorpmichaud <pmichaud@pobox.com>2012-08-28 00:41:48 -0500
committerpmichaud <pmichaud@pobox.com>2012-08-28 00:41:48 -0500
commita8079a0a6615fc7d7fd4bc17aaa1aa2b6149bad6 (patch)
tree48ecd02b1eeaf914e3ffaf4e094473b0b1345e93 /ports
parentc012d8b882480151d8eb7da92c4cca80d1d9b814 (diff)
Move build/binary/darwin_dmg to ports/ .
Diffstat (limited to 'ports')
-rw-r--r--ports/darwin_dmg/2000px-Camelia.svg.icnsbin0 -> 150545 bytes
-rw-r--r--ports/darwin_dmg/HOW_TO_INSTALL.txt21
-rw-r--r--ports/darwin_dmg/README16
-rw-r--r--ports/darwin_dmg/SLA_rakudo_star.template.r452
-rw-r--r--ports/darwin_dmg/adjust_installation_window.scpt37
-rwxr-xr-xports/darwin_dmg/package_darwin_dmg.pl264
6 files changed, 790 insertions, 0 deletions
diff --git a/ports/darwin_dmg/2000px-Camelia.svg.icns b/ports/darwin_dmg/2000px-Camelia.svg.icns
new file mode 100644
index 0000000..cccd98d
--- /dev/null
+++ b/ports/darwin_dmg/2000px-Camelia.svg.icns
Binary files differ
diff --git a/ports/darwin_dmg/HOW_TO_INSTALL.txt b/ports/darwin_dmg/HOW_TO_INSTALL.txt
new file mode 100644
index 0000000..ac33a06
--- /dev/null
+++ b/ports/darwin_dmg/HOW_TO_INSTALL.txt
@@ -0,0 +1,21 @@
+1. Drag the Rakudo_Star folder onto the Applications folder.
+2. In a Terminal window, type this command:
+ alias p6='/Applications/Rakudo_Star/bin/perl6'
+ ( This step only affects this one window; to make available to all
+ future sessions, add the line to your ~/.bash_profile file. )
+
+You can now run a Perl 6 program like this:
+ p6 filename
+or run code directly from the command-line with the -e option:
+ p6 -e 'your code here'
+
+Try this:
+ p6 -e 'say "Hello, world!";'
+
+You can always skip the alias and use the full path:
+ /Applications/Rakudo_Star/bin/perl6 -e 'say "Hello, world!";'
+or alternately, add Rakudo Star to your path:
+ PATH=$PATH:/Applications/Rakudo_Star/bin
+ perl6 -e 'say "Hello, world!";'
+
+See also README in /Applications/Rakudo_Star/docs/rakudo/README .
diff --git a/ports/darwin_dmg/README b/ports/darwin_dmg/README
new file mode 100644
index 0000000..70d7d5a
--- /dev/null
+++ b/ports/darwin_dmg/README
@@ -0,0 +1,16 @@
+This directory contains the Perl script and supporting files to:
+* Compile Parrot and Rakudo in a way that removes embedded dependencies on
+ the builder's home directory; such dependencies have been a problem on
+ Darwin.
+* Package the compiled binaries into a .dmg disk image for Mac OS X.
+ Users can open the .dmg file, then just drag the Rakudo_Star folder onto
+ the /Applications folder to install.
+
+The process currently depends on first downloading the official R* tarball
+for the month, rather than being part of building the tarball itself. This
+may seem non-optimal, but it helps limit the chance of the binary varying
+too much from a end-user's source build, and it keeps the R* release
+manager from needing the same platform as the binary build person. Also,
+it is the way I designed and wrote it before realizing there might be any
+other way :)
+
diff --git a/ports/darwin_dmg/SLA_rakudo_star.template.r b/ports/darwin_dmg/SLA_rakudo_star.template.r
new file mode 100644
index 0000000..1ff734d
--- /dev/null
+++ b/ports/darwin_dmg/SLA_rakudo_star.template.r
@@ -0,0 +1,452 @@
+data 'LPic' (5000) {
+ // Default language
+ $"0002"
+ $"0011"
+ $"0003 0001 0000"
+ $"0000 0002 0000"
+ $"0008 0003 0000"
+ $"0001 0004 0000"
+ $"0004 0005 0000"
+ $"000E 0006 0001"
+ $"0005 0007 0000"
+ $"0007 0008 0000"
+ $"0047 0009 0000"
+ $"0034 000A 0001"
+ $"0035 000B 0001"
+ $"0020 000C 0000"
+ $"0011 000D 0000"
+ $"005B 0004 0000"
+ $"0033 000F 0001"
+ $"000C 0010 0000"
+ $"000B 000E 0000"
+
+};
+
+
+data 'TEXT' (5002, "English") {
+[% ENGLISH_LICENSE %]
+};
+
+
+resource 'STR#' (5001, "German") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Deutsch",
+ /* [2] */
+ "Akzeptieren",
+ /* [3] */
+ "Ablehnen",
+ /* [4] */
+ "Drucken",
+ /* [5] */
+ "Sichern...",
+ /* [6] */
+ "Klicken Sie auf “Akzeptieren”, wenn Sie mit den Bestimmungen des "
+ "Software-Lizenzvertrages einverstanden sind. Falls nicht, klicken "
+ "Sie bitte “Ablehnen” an. Sie können die Software nur installieren, "
+ "wenn Sie “Akzeptieren” angeklickt haben.",
+ /* [7] */
+ "Software-Lizenzvertrag",
+ /* [8] */
+ "Dieser Text kann nicht gesichert werden. Diese Festplatte ist "
+ "möglicherweise voll oder geschützt oder der Ordner ist geschützt.",
+ /* [9] */
+ "Es kann nicht gedruckt werden. Bitte stellen Sie sicher, daß ein "
+ "Drucker ausgewählt ist."
+ }
+};
+
+resource 'STR#' (5002, "English") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "English",
+ /* [2] */
+ "Agree",
+ /* [3] */
+ "Disagree",
+ /* [4] */
+ "Print",
+ /* [5] */
+ "Save...",
+ /* [6] */
+ "IMPORTANT - Read this License Agreement carefully before clicking on "
+ "the \"Agree\" button. By clicking on the \"Agree\" button, you agree "
+ "to be bound by the terms of the License Agreement.",
+ /* [7] */
+ "Software License Agreement",
+ /* [8] */
+ "This text cannot be saved. This disk may be full or locked, or the file "
+ "may be locked.",
+ /* [9] */
+ "Unable to print. Make sure you’ve selected a printer."
+ }
+};
+
+resource 'STR#' (5003, "Spanish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Español",
+ /* [2] */
+ "Aceptar",
+ /* [3] */
+ "No aceptar",
+ /* [4] */
+ "Imprimir",
+ /* [5] */
+ "Guardar...",
+ /* [6] */
+ "Si está de acuerdo con los términos de esta licencia, pulse \"Aceptar\" "
+ "para instalar el software. En el supuesto de que no esté de acuerdo con "
+ "los términos de esta licencia, pulse \"No aceptar.\"",
+ /* [7] */
+ "Licencia de Software",
+ /* [8] */
+ "Este texto no se puede guardar. El disco puede estar lleno o bloqueado, "
+ "o el archivo puede estar bloqueado.",
+ /* [9] */
+ "No se puede imprimir. Compruebe que ha seleccionado una impresora."
+ }
+};
+
+resource 'STR#' (5004, "French") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Français",
+ /* [2] */
+ "Accepter",
+ /* [3] */
+ "Refuser",
+ /* [4] */
+ "Imprimer",
+ /* [5] */
+ "Enregistrer...",
+ /* [6] */
+ "Si vous acceptez les termes de la présente licence, cliquez sur "
+ "\"Accepter\" afin d'installer le logiciel. Si vous n'êtes pas d'accord "
+ "avec les termes de la licence, cliquez sur \"Refuser\".",
+ /* [7] */
+ "Contrat de licence de logiciel",
+ /* [8] */
+ "Ce texte ne peut être sauvegardé. Le disque est peut-être saturé ou "
+ "verrouillé, ou bien le fichier est peut-être verrouillé.",
+ /* [9] */
+ "Impression impossible. Assurez-vous d’avoir sélectionné une imprimante."
+ }
+};
+
+resource 'STR#' (5005, "Italian") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Italiano",
+ /* [2] */
+ "Accetto",
+ /* [3] */
+ "Rifiuto",
+ /* [4] */
+ "Stampa",
+ /* [5] */
+ "Registra...",
+ /* [6] */
+ "Se accetti le condizioni di questa licenza, fai clic su \"Accetto\" per "
+ "installare il software. Altrimenti fai clic su \"Rifiuto\".",
+ /* [7] */
+ "Licenza Software",
+ /* [8] */
+ "Non posso registrare il testo. Il disco potrebbe essere pieno o protetto "
+ "oppure il documento potrebbe essere protetto.",
+ /* [9] */
+ "Non posso stampare. Assicurati di aver selezionato una stampante."
+ }
+};
+
+resource 'STR#' (5006, "Japanese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Japanese",
+ /* [2] */
+ "ìØà”ǵNjÇ∑",
+ /* [3] */
+ "ìØà”ǵNjÇπÇÒ",
+ /* [4] */
+ "àÛç¸Ç∑ÇÈ",
+ /* [5] */
+ "ï€ë∂...",
+ /* [6] */
+ "ñ{É\\ÉtÉgÉEÉGÉAégópãñë¯å_ñÒÇÃèåèÇ…ìØà”Ç≥"
+ "ÇÍÇÈèÍçáÇ…ÇÕÅAÉ\\ÉtÉgÉEÉGÉAÇÉCÉìÉXÉgÅ[Éã"
+ "Ç∑ÇÈÇΩÇflÇ…ÅuìØà”ǵNjÇ∑ÅvÇâüǵǃÇ≠ÇæÇ≥Ç¢"
+ "ÅBÅ@ìØà”Ç≥Ç",
+/* XXX Line above should have been two lines below; truncated by Pascal string limits */
+/* "ÅBÅ@ìØà”Ç≥ÇÍǻǢèÍçáÇ…ÇÕÅAÅuìØà”ǵNjÇπÇÒ" */
+/* "ÅvÇâüǵǃÇ≠ÇæÇ≥Ç¢ÅB", */
+ /* [7] */
+ "É\\ÉtÉgÉEÉFÉAégópãñë¯å_ñÒ",
+ /* [8] */
+ "DZÇÃÉeÉLÉXÉgÇÕÅAï€ë∂Ç≈Ç´Ç‹ÇπÇÒÅBDZÇÃÉfÉB"
+ "ÉXÉNÇ…ãÛÇ´Ç™ñ≥ǢǩÉçÉbÉNÇ≥ÇÍǃǢÇÈâ¬î\\ê´"
+ "ǙdžÇËÇ‹Ç∑ÅBÇ‹ÇΩÇÕÅADZÇÃÉtÉ@ÉCÉãÇ™ÉçÉbÉN"
+ "Ç≥ÇÍǃǢÇÈ",
+/* XXX Line above should have been line below; truncated by Pascal string limits */
+/* "Ç≥ÇÍǃǢÇÈâ¬î\\ê´Ç™Ç†ÇËÇ‹Ç∑ÅB", */
+ /* [9] */
+ "àÛç¸Ç≈Ç´Ç‹ÇπÇÒÅBÉvÉäÉìÉ^Ç™ê≥ǵÇ≠ëIëÇ≥ÇÍ"
+ "ǃǢÇÈDZÇ∆ÇämîFǵǃÇ≠ÇæÇ≥Ç¢ÅB"
+ }
+};
+
+resource 'STR#' (5007, "Dutch") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Nederlands",
+ /* [2] */
+ "Ja",
+ /* [3] */
+ "Nee",
+ /* [4] */
+ "Print",
+ /* [5] */
+ "Bewaar...",
+ /* [6] */
+ "Indien u akkoord gaat met de voorwaarden van deze licentie, kunt u op 'Ja' "
+ "klikken om de programmatuur te installeren. Indien u niet akkoord gaat, "
+ "klikt u op 'Nee'.",
+ /* [7] */
+ "Softwarelicentie",
+ /* [8] */
+ "De tekst kan niet worden bewaard. Het kan zijn dat uw schijf vol of "
+ "beveiligd is of dat het bestand beveiligd is.",
+ /* [9] */
+ "Afdrukken niet mogelijk. Zorg dat er een printer is geselecteerd."
+ }
+};
+
+resource 'STR#' (5008, "Swedish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Svensk",
+ /* [2] */
+ "Godkänns",
+ /* [3] */
+ "Avböjs",
+ /* [4] */
+ "Skriv ut",
+ /* [5] */
+ "Spara...",
+ /* [6] */
+ "Om Du godkänner licensvillkoren klicka på \"Godkänns\" för att installera "
+ "programprodukten. Om Du inte godkänner licensvillkoren, klicka på \"Avböjs\".",
+ /* [7] */
+ "Licensavtal för Programprodukt",
+ /* [8] */
+ "Den här texten kan inte sparas eftersom antingen skivan är full eller skivan "
+ "och/eller dokumentet är låst.",
+ /* [9] */
+ "Kan inte skriva ut. Kontrollera att du har valt en skrivare. "
+ }
+};
+
+resource 'STR#' (5009, "Brazilian Portuguese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Português, Brasil",
+ /* [2] */
+ "Concordar",
+ /* [3] */
+ "Discordar",
+ /* [4] */
+ "Imprimir",
+ /* [5] */
+ "Salvar...",
+ /* [6] */
+ "Se está de acordo com os termos desta licença, pressione \"Concordar\" para "
+ "instalar o software. Se não está de acordo, pressione \"Discordar\".",
+ /* [7] */
+ "Licença de Uso de Software",
+ /* [8] */
+ "Este texto não pode ser salvo. O disco pode estar cheio ou\nbloqueado, ou o "
+ "arquivo pode estar bloqueado.",
+ /* [9] */
+ "Não é possível imprimir. Comprove que você selecionou uma impressora."
+ }
+};
+
+resource 'STR#' (5010, "Simplified Chinese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Simplified Chinese",
+ /* [2] */
+ "Õ¨“‚",
+ /* [3] */
+ "≤ªÕ¨“‚",
+ /* [4] */
+ "¥Ú”°",
+ /* [5] */
+ "¥Ê¥¢°≠",
+ /* [6] */
+ "»Áπ˚ƒ˙Õ¨“‚±æ–Ìø…–≠“ȵƒÃıøÓ£¨«Î∞¥°∞Õ¨“‚°±"
+ "¿¥∞≤◊∞¥À»Ìº˛°£»Áπ˚ƒ˙≤ªÕ¨“‚£¨«Î∞¥°∞≤ªÕ¨“‚"
+ "°±°£",
+ /* [7] */
+ "»Ìº˛–Ìø…–≠“È",
+ /* [8] */
+ "≤ªƒ‹¥Ê¥¢’‚∏ˆŒƒº˛°£¥≈≈Ãø…ƒ‹±ªÀ¯∂®ªÚ“—¬˙£¨"
+ "“≤–Ì «Œƒº˛±ªÀ¯∂®¡À°£",
+ /* [9] */
+ "Œfi∑®¥Ú”°°£«Î»∑∂®ƒ˙“——°‘Ò¡À“ªÃ®¥Ú”°ª˙°£"
+ }
+};
+
+resource 'STR#' (5011, "Traditional Chinese") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Traditional Chinese",
+ /* [2] */
+ "¶P∑N",
+ /* [3] */
+ "§£¶P∑N",
+ /* [4] */
+ "¶C¶L",
+ /* [5] */
+ "¿x¶s°K",
+ /* [6] */
+ "¶p™G±z¶P∑N•ª≥\\•i√“∏Ù∫±¯¥⁄°AΩ–´ˆ°ß¶P∑N°®"
+ "•H¶w∏À≥n≈È°C¶p™G§£¶P∑N°AΩ–´ˆ°ß§£¶P∑N°®°C",
+ /* [7] */
+ "≥n≈È≥\\•i®Ûƒ≥",
+ /* [8] */
+ "•ª§Â¶rµL™k¿x¶s°C≥o≠”∫œ∫–•i؇§w∫°©Œ¨O¬Í©w"
+ "°A©Œ¿…Æ◊§w∏g¬Í©w°C",
+ /* [9] */
+ "µL™k¶C¶L°CΩ–ΩT©w±z§w∏gøÔ拧F¶L™Ì昰C"
+ }
+};
+
+resource 'STR#' (5012, "Danish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Dansk",
+ /* [2] */
+ "Enig",
+ /* [3] */
+ "Uenig",
+ /* [4] */
+ "Udskriv",
+ /* [5] */
+ "Arkiver...",
+ /* [6] */
+ "Hvis du accepterer betingelserne i licensaftalen, skal du klikke på “Enig” "
+ "for at installere softwaren. Klik på “Uenig” for at annullere installeringen.",
+ /* [7] */
+ "Licensaftale for software",
+ /* [8] */
+ "Teksten kan ikke arkiveres. Disken er evt. fuld eller låst, eller også er "
+ "arkivet låst.",
+ /* [9] */
+ "Kan ikke udskrive. Sørg for, at der er valgt en printer."
+ }
+};
+
+resource 'STR#' (5013, "Finnish") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Suomi",
+ /* [2] */
+ "Hyväksyn",
+ /* [3] */
+ "En hyväksy",
+ /* [4] */
+ "Tulosta",
+ /* [5] */
+ "Tallenna…",
+ /* [6] */
+ "Hyväksy lisenssisopimuksen ehdot osoittamalla ’Hyväksy’. Jos et hyväksy "
+ "sopimuksen ehtoja, osoita ’En hyväksy’.",
+ /* [7] */
+ "Lisenssisopimus",
+ /* [8] */
+ "Tekstiä ei voida tallentaa. Levy voi olla täynnä tai lukittu.",
+ /* [9] */
+ "Tekstiä ei voida tulostaa. Varmista, että kirjoitin on valittu."
+ }
+};
+
+resource 'STR#' (5014, "French Canadian") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Français canadien",
+ /* [2] */
+ "Accepter",
+ /* [3] */
+ "Refuser",
+ /* [4] */
+ "Imprimer",
+ /* [5] */
+ "Enregistrer...",
+ /* [6] */
+ "Si vous acceptez les termes de la présente licence, cliquez sur \"Accepter\" "
+ "afin d'installer le logiciel. Si vous n'êtes pas d'accord avec les termes de "
+ "la licence, cliquez sur \"Refuser\".",
+ /* [7] */
+ "Contrat de licence de logiciel",
+ /* [8] */
+ "Ce texte ne peut être sauvegardé. Le disque est peut-être saturé ou verrouillé, "
+ "ou bien le fichier est peut-être verrouillé.",
+ /* [9] */
+ "Impression impossible. Assurez-vous d’avoir sélectionné une imprimante."
+ }
+};
+
+resource 'STR#' (5015, "Korean") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Korean",
+ /* [2] */
+ "µø¿«",
+ /* [3] */
+ "µø¿« 滫‘",
+ /* [4] */
+ "«¡∏∞∆Æ",
+ /* [5] */
+ "¿˙¿Â...",
+ /* [6] */
+ "ªÁøÎ ∞Ë懺≠¿« ≥ªøÎø° µø¿««œ∏È, \"µø¿«\" ¥‹"
+ "√fl∏¶ ¥≠∑Ø º“«¡∆Æø˛æÓ∏¶ º≥ƒ°«œΩ Ω√ø¿. µø¿"
+ "««œ¡ˆ æ ¥¬¥Ÿ∏È, \"µø¿« 滫‘\" ¥‹√fl∏¶ ¥©∏£Ω"
+ " Ω√ø¿.",
+ /* [7] */
+ "ªÁøÎ ∞Ëæ‡ µø¿«º≠",
+ /* [8] */
+ "¿Ã ≈ÿΩ∫∆Æ∏¶ ¿˙¿Â«“ ºˆ æ¯Ω¿¥œ¥Ÿ. ¿Ã µΩ∫≈"
+ "©¥¬ ≤À √°∞≈≥™ ¿·∞‹ ¿÷Ω¿¥œ¥Ÿ. ∂«¥¬ ∆ƒ¿œ¿Ã"
+ " ¿·∞‹ ¿÷¿ª ºˆµµ ¿÷Ω¿¥œ¥Ÿ.",
+ /* [9] */
+ "«¡∏∞∆Æ«“ ºˆ æ¯Ω¿¥œ¥Ÿ. «¡∏∞≈Õ∏¶ º±≈√«fl¥¬¡"
+ "ˆ »Æ¿Œ«œΩ Ω√ø¿."
+ }
+};
+
+resource 'STR#' (5016, "Norwegian") {
+ { /* array StringArray: 9 elements */
+ /* [1] */
+ "Norsk",
+ /* [2] */
+ "Enig",
+ /* [3] */
+ "Ikke enig",
+ /* [4] */
+ "Skriv ut",
+ /* [5] */
+ "Arkiver...",
+ /* [6] */
+ "Hvis De er enig i bestemmelsene i denne lisensavtalen, klikker De på "
+ "\"Enig\"-knappen for å installere programvaren. Hvis De ikke er enig, "
+ "klikker De på \"Ikke enig\".",
+ /* [7] */
+ "Programvarelisensavtale",
+ /* [8] */
+ "Denne teksten kan ikke arkiveres. Disken kan være full eller låst, "
+ "eller filen kan være låst. ",
+ /* [9] */
+ "Kan ikke skrive ut. Forsikre deg om at du har valgt en skriver. "
+ }
+};
diff --git a/ports/darwin_dmg/adjust_installation_window.scpt b/ports/darwin_dmg/adjust_installation_window.scpt
new file mode 100644
index 0000000..fa29745
--- /dev/null
+++ b/ports/darwin_dmg/adjust_installation_window.scpt
@@ -0,0 +1,37 @@
+tell application "Finder"
+ tell disk "Rakudo_Star"
+ open
+
+ set top_left_X to 100
+ set top_left_Y to 100
+ set bottom_right_X to 600
+ set bottom_right_Y to 500
+
+ tell container window
+ set current view to icon view
+ set toolbar visible to false
+ set statusbar visible to false
+ set bounds to { top_left_X, top_left_Y, bottom_right_X, bottom_right_Y }
+ end tell
+
+ make new alias file at container window to POSIX file "/Applications" with properties { name:"Applications" }
+
+ set opts to the icon view options of container window
+ tell opts
+ set icon size to 128
+ set text size to 16
+ set arrangement to not arranged
+ end tell
+
+ set position of item "Rakudo_Star" to {120, 74}
+ set position of item "Applications" to {360, 74}
+ set position of item "HOW_TO_INSTALL.txt" to {120, 264}
+
+ delay 5
+ close
+ delay 5
+ open
+ delay 5
+
+ end tell
+end tell
diff --git a/ports/darwin_dmg/package_darwin_dmg.pl b/ports/darwin_dmg/package_darwin_dmg.pl
new file mode 100755
index 0000000..3989cad
--- /dev/null
+++ b/ports/darwin_dmg/package_darwin_dmg.pl
@@ -0,0 +1,264 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Carp;
+use Getopt::Long;
+use Data::Dumper; $Data::Dumper::Useqq = 1;
+
+my $USAGE = <<"END_OF_USAGE";
+$0 [-q|--quiet] yyyy mm
+ --build
+ Build Parrot and Rakudo from the tarball.
+ Defaults to only packaging what is already built.
+ -q, --quiet
+ Suppress pausing for "OK" input.
+ (Not yet implemented)
+ -v
+ --verbose
+ Report each command that is run.
+ --time
+ Report timings for each step.
+ YYYY
+ 4 digit year
+ MM
+ 2 digit month, 01..12
+END_OF_USAGE
+
+=begin comments
+
+(Note: The build process below (except downloading the tarball) is automated in this script)
+Note: For this .dmg packaging procedure work, Rakudo Star must be built like this:
+XXX Can we use .app to automatically have them look in the right place, even when uninstalled in .dmg?
+Here are the key parts of the build process, the parts that you might not expect from your normal build experience with Parrot and Rakudo:
+ Rather than having Rakudo automatically build Parrot, we must build Parrot ourselves, to configure it specially.
+ Configure Parrot with --optimize, --prefix with the installation dir, and --without any libs that any user might not have on their system.
+ Configure Rakudo pointing --parrot-config to the parrot_config in the installation dir.
+ Rename the build dir (to anything else) after building.
+ Run `install_name_tool` on all the exes in the installation dir, updating the location in which they will look for libparrot.dylib.
+ (This part will get merged into pbc_to_exe soon)
+
+Failure to follow this packaging procedure will result in a `perl6` executable that runs fine, *until* the original build directory is removed.
+Therefore, the `perl6` executable would test fine on your system, but fail on every system that installed it from the .dmg!
+
+Run this to make sure that all is well so far.
+ $src_dir/bin/perl6 -e 'say "OK so far"'
+
+At this point, you can run this script.
+ perl package_star.pl
+
+Does the .dmg packaging procedure really need to be this complex?
+Yes! The single-line process that we *wish* we could use does not allow:
+ * symlink to /Applications (so they have to know to drag-and-drop outside the window)
+ * background images
+ * click-through licenses
+ * auto-open the Finder window after .dmg is opened.
+
+TODO:
+ Add background images
+ Camelia
+ Arrow to show drag-and-drop to Applications (like in DMGs from Processing.org)
+ Add a .dmg-specific HOW_TO_INSTALL.txt
+ Demo code (as opposed to Example code that we already have)
+ Click on .app for REPL
+ Remove the underscore from /Applications/Rakudo_Star, changing it to a space.
+ This will require upstream changes to Rakudo, but Parrot itself seems OK with an embedded space.
+ Include all the dependent libs; gmp, pcre, opengl, zlib, gettext, icu, libffi,readline
+ So far, we build with these libs disabled to allow Rakudo to run on systems that lack the libs.
+
+=end comments
+
+=cut
+
+
+GetOptions(
+ 'build' => \( my $opt_build_parrot_and_rakudo ),
+ 'time' => \( my $opt_time ),
+ 'quiet' => \( my $opt_quiet ),
+ 'verbose|v' => \( my $opt_verbose ),
+ 'help|h' => \( my $opt_help ),
+) or die $USAGE;
+
+print $USAGE and exit(0) if $opt_help;
+
+my ( $yyyy, $mm ) = @ARGV; # Version
+
+die $USAGE if @ARGV != 2
+ or $yyyy !~ m{ \A \d{4} \z }msx
+ or $mm !~ m{ \A \d{2} \z }msx
+ or $mm < 1 or $mm > 12;
+
+sub run {
+ croak if not @_;
+ my (@command) = @_;
+
+ print "> @command\n" if $opt_verbose;
+
+ my $start = time;
+ my $rc = system(@command);
+ die if $rc != 0;
+ my $stop = time;
+
+ printf ">! %4d\t%s\n", $stop-$start, "@command" if $opt_time;
+ return;
+}
+
+
+my $temp_dir = 'Temp_build';
+my $temp_dmg = 'temp';
+my $vol_name = 'Rakudo_Star';
+# XXX rename to install_dir?
+my $src_dir = '/Applications/Rakudo_Star';
+
+my $vol_dir = "/Volumes/$vol_name";
+my $tar_dir = "rakudo-star-$yyyy.$mm";
+my $tar_file = "rakudo-star-$yyyy.$mm.tar.gz";
+my $final_dmg = "Rakudo_Star_$yyyy-$mm";
+my $license_path = "$src_dir/share/doc/rakudo/LICENSE";
+
+
+if ( $opt_build_parrot_and_rakudo ) {
+ my $full_parrot_path;
+
+ run "rm -rf '$src_dir'";
+ run "rm -rf $tar_dir";
+ run "tar zxf $tar_file";
+
+ chdir $tar_dir or die;
+
+ my ($parrot_dir) = glob 'parrot-*';
+ chdir $parrot_dir or die;
+ chomp( $full_parrot_path = `pwd` );
+ run "perl Configure.pl --prefix=/Applications/Rakudo_Star --optimize"
+ . " --without-gettext --without-gmp --without-libffi --without-opengl"
+ . " --without-readline --without-pcre --without-zlib --without-icu"
+ . " > conf.1 2>conf.2";
+ run "make > make.1 2>make.2";
+ run "make install > inst.1 2>inst.2";
+ chdir '..';
+
+ run "perl Configure.pl --parrot-config=/Applications/Rakudo_Star/bin/parrot_config"
+ . " > conf.1 2>conf.2";
+ run "make > make.1 2>make.2";
+ run "make install > inst.1 2>inst.2";
+
+# run "make blizkost-install > bliz.1 2>bliz.2";
+# XXX Not running for now, because OS X 10.5 comes with Perl 5.8.8, and blizkost requires 5.10.
+
+ run "cp -r docs /Applications/Rakudo_Star/";
+ run "mv /Applications/Rakudo_Star/parrot /Applications/Rakudo_Star/docs/";
+ run "mv /Applications/Rakudo_Star/rakudo /Applications/Rakudo_Star/docs/";
+
+ chdir '..';
+
+ run "rm -rf $tar_dir-renamed_for_testing";
+ run "mv -i $tar_dir $tar_dir-renamed_for_testing";
+
+ my @exe_paths = map {"$src_dir/bin/$_"} qw(
+ ops2c
+ parrot
+ parrot-nqp
+ parrot-prove
+ parrot_config
+ parrot_debugger
+ parrot_nci_thunk_gen
+ pbc_disassemble
+ pbc_dump
+ pbc_merge
+ pbc_to_exe
+ perl6
+ );
+ die if grep { not -e $_ } @exe_paths;
+
+ for my $exe_path (@exe_paths) {
+ run "install_name_tool -change $full_parrot_path/blib/lib/libparrot.dylib $src_dir/lib/libparrot.dylib $exe_path";
+ }
+}
+
+
+if ( `$src_dir/bin/perl6 -e 42.say` ne "42\n" ) {
+ die "The perl6 exe will not run, so we cannot make a .dmg for it! ($src_dir/bin/perl6)\n";
+}
+
+if ( -e $vol_dir ) {
+ run "diskutil eject $vol_dir";
+}
+if ( -e $temp_dir ) {
+ run "rm -rf '$temp_dir'";
+}
+mkdir $temp_dir or die;
+chdir $temp_dir or die;
+
+my $size = `du -ks '$src_dir'`;
+$size =~ s{ \A \s* (\d+) \t \S.* \z }{$1}msx or die;
+$size += int( $size * 0.05 ); # Add 5% for file system
+run "hdiutil create '$temp_dmg' -ov -size ${size}k -fs HFS+ -volname '$vol_name' -attach";
+
+
+print "Copying Rakudo files\n";
+run "CpMac -r '$src_dir' '$vol_dir'";
+run "cp ../HOW_TO_INSTALL.txt '$vol_dir'";
+
+run "touch '$vol_dir/Rakudo_Star/Icon\r'";
+run "cp ../2000px-Camelia.svg.icns $vol_dir/.VolumeIcon.icns";
+run "sips -i $vol_dir/.VolumeIcon.icns";
+run "DeRez -only icns $vol_dir/.VolumeIcon.icns > tempicns.rsrc";
+run "Rez -append tempicns.rsrc -o '$vol_dir/Rakudo_Star/bin/perl6'";
+run "Rez -append tempicns.rsrc -o '$vol_dir/Rakudo_Star/Icon\r'";
+run "SetFile -c icnC '$vol_dir/.VolumeIcon.icns'";
+run "SetFile -a C '$vol_dir'";
+run "SetFile -a C '$vol_dir/Rakudo_Star'";
+run "SetFile -a C '$vol_dir/Rakudo_Star/bin/perl6'";
+run "SetFile -a V '$vol_dir/Rakudo_Star/Icon\r'";
+run "rm tempicns.rsrc";
+
+
+print ">>> Adjusting sizes and positions in installation window\n";
+run "osascript ../adjust_installation_window.scpt";
+
+
+print ">>> Waiting on .DS_STORE to be written\n";
+sleep 1 while not -s "$vol_dir/.DS_STORE";
+
+print ">>> Compressing\n";
+run "diskutil eject $vol_dir";
+run "hdiutil convert '$temp_dmg.dmg' -format UDBZ -o '$final_dmg'";
+unlink "$temp_dmg.dmg" or die;
+
+
+print ">>> Adding click-thru license and auto-open\n";
+my $r_path = './SLA_rakudo_star.r';
+my $template_path = '../SLA_rakudo_star.template.r';
+create_sla_file( $license_path, $template_path, $r_path );
+
+run "hdiutil unflatten '$final_dmg.dmg'";
+run "Rez Carbon.r '$r_path' -append -o '$final_dmg.dmg'"; # Carbon.r has type definitions.
+run "hdiutil flatten '$final_dmg.dmg'";
+unlink $r_path or die;
+
+chdir '..' or die;
+
+
+sub create_sla_file {
+ croak 'Wrong number of arguments' if @_ != 3;
+ my ( $license_path, $template_path, $output_r_path ) = @_;
+
+ my $license_munged = '';
+ open my $license_fh, '<', $license_path or die;
+ while (<$license_fh>) {
+ s{"}{\\"}g;
+ s{\n}{\\n};
+ $license_munged .= qq{ "$_"\n};
+ }
+ close $license_fh or warn;
+
+ open my $template_fh, '<', $template_path or die;
+ open my $r_fh, '>', $output_r_path or die;
+ {
+ local $/ = undef; # Slurp mode
+ local $_ = <$template_fh>;
+ s{\[% ENGLISH_LICENSE %\]}{$license_munged} or die;
+ print {$r_fh} $_;
+ }
+ close $template_fh or warn;
+ close $r_fh or warn;
+}