Skip to content
This repository
Browse code

adapt shebang line on installing

  • Loading branch information...
commit 089584d3577b72ed3fb405a32f35469ca7b939ab 1 parent c4afc58
Moritz Lenz authored August 20, 2012
7  skel/tools/build/Makefile.in
@@ -97,12 +97,9 @@ rakudo-install: rakudo
97 97
 
98 98
 modules-install: rakudo
99 99
 	@echo "== Installing 'ufo'"
100  
-	$(CP)    modules/ufo/bin/ufo $(DESTDIR)$(PARROT_BIN_DIR)/ufo
101  
-	$(CHMOD) 755                 $(DESTDIR)$(PARROT_BIN_DIR)/ufo
102 100
 	$(PERL) tools/build/module-install.pl $(DESTDIR)$(PARROT_BIN_DIR)/$(PERL6_EXE) $(DESTDIR)$(PERL6_LANG_DIR)/lib $(MODULES)
103  
-	@echo "Installing 'panda'"
104  
-	$(CP)    modules/panda/bin/panda $(DESTDIR)$(PARROT_BIN_DIR)/panda
105  
-	$(CHMOD) 755                    $(DESTDIR)$(PARROT_BIN_DIR)/panda
  101
+	@echo "== Installing binaries"
  102
+	$(PERL) tools/build/bin-install.pl $(DESTDIR)$(PARROT_BIN_DIR)/$(PERL6_EXE) $(DESTDIR)$(PARROT_BIN_DIR) modules/ufo/bin/ufo modules/panda/bin/panda
106 103
 
107 104
 install: rakudo-install modules-install
108 105
 
28  skel/tools/build/bin-install.pl
... ...
@@ -0,0 +1,28 @@
  1
+#! perl
  2
+
  3
+use strict;
  4
+use warnings;
  5
+use File::Spec;
  6
+
  7
+my ($p6bin, $dest, @files) = @ARGV;
  8
+die "Usage: $0 <perl6_binary> <destination_path> <source_files>"
  9
+    unless $p6bin && $dest;
  10
+
  11
+for my $filename (@files) {
  12
+    open my $IN, '<', $filename
  13
+        or die "Cannot read file '$filename' for installing it: $!";
  14
+    my $basename = (File::Spec->splitpath($filename))[2];
  15
+    open my $OUT, '>', "$dest/$basename"
  16
+        or die "Cannot write file '$dest/$basename' for installing it: $!";
  17
+    while (<$IN>) {
  18
+        if ($. == 1 && /^#!/) {
  19
+            print { $OUT } "#!$p6bin\n";
  20
+        }
  21
+        else {
  22
+            print { $OUT } $_;
  23
+        }
  24
+    }
  25
+    close $OUT or die "Error while closing file '$dest/$basename': $!";
  26
+    close $IN;
  27
+    chmod 0755, "$dest/$basename";
  28
+}

0 notes on commit 089584d

Please sign in to comment.
Something went wrong with that request. Please try again.