From 71b1431b882919d85d165324e8d1df6313266641 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sat, 4 Dec 2004 17:29:34 +0100
Subject: [PATCH] Forward ported from Pike 7.4.

Rev: packaging/windows/installer.vbs:1.1
---
 .gitattributes                  |  1 +
 packaging/windows/installer.vbs | 60 +++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 packaging/windows/installer.vbs

diff --git a/.gitattributes b/.gitattributes
index cf1989e08a..f8c03b1cbf 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -281,6 +281,7 @@ testfont binary
 /packaging/debian/prerm foreign_ident
 /packaging/debian/rules foreign_ident
 /packaging/fink/README foreign_ident
+/packaging/windows/installer.vbs foreign_ident
 /refdoc/Makefile foreign_ident
 /refdoc/presentation/tree-split-autodoc.pike foreign_ident
 /refdoc/presentation/wiki.pike foreign_ident
diff --git a/packaging/windows/installer.vbs b/packaging/windows/installer.vbs
new file mode 100644
index 0000000000..cae682d462
--- /dev/null
+++ b/packaging/windows/installer.vbs
@@ -0,0 +1,60 @@
+'
+' $Id: installer.vbs,v 1.1 2004/12/04 16:29:34 grubba Exp $
+'
+' Companion file to bin/install.pike for custom actions.
+'
+' 2004-12-01 Henrik Grubbstr�m
+'
+
+' At call time the CustomActionData property has been set to [TARGETDIR]
+'
+' First make a new master.
+'
+' Then start a pike to Finalize Pike.
+Function FinalizePike()
+  Dim fso, targetdir, targetdir_unix, source, dest, re
+  targetdir = Session.Property("CustomActionData")
+
+  Set fso = CreateObject("Scripting.FileSystemObject")
+
+  Set source = fso.OpenTextFile(targetdir & "lib\master.pike.in", 1, False, 0)
+
+  Set dest = fso.CreateTextFile(targetdir & "lib\master.pike", True)
+
+  source = source.ReadAll
+
+  Set re = New RegExp
+  re.Global = True
+
+  re.Pattern = "\"
+  targetdir_unix = re.Replace(targetdir, "/")
+
+  re.Pattern = "�lib_prefix�"
+  source = re.Replace(source, targetdir_unix & "lib")
+
+  re.Pattern = "�include_prefix�"
+  source = re.Replace(source, targetdir_unix & "include/pike")
+
+  're.Pattern = "�share_prefix�"
+  'source = re.Replace(source, "�share_prefix�")
+
+  dest.Write(source)
+  dest.Close
+
+  ' FIXME: Is there no support for binary files in vbs?
+
+  Dim WshShell
+
+  Set WshShell = CreateObject("WScript.Shell")
+  WshShell.CurrentDirectory = targetdir
+  WshShell.Run "bin\pike" &_
+    " -mlib\master.pike" &_
+    " bin\install.pike" &_
+    " --finalize BASEDIR=." &_
+    " TMP_BUILDDIR=bin", 0, True
+
+  ' Extra cleanup.
+  fso.DeleteFile(targetdir & "bin\pike.exe.old")
+
+  FinalizePike = 1
+End Function
-- 
GitLab