www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 5c4c17e884e9992cb037ff4844feaf5d07a590a4
Author: Eli Barzilay <eli@barzilay.org>
Date:   Sat, 15 May 2010 10:45:15 -0400

existing version of build scripts

original commit: 83c2c283fd84a57f475f51385ebe6e189de630ae

Diffstat:
Acollects/meta/build/nsis/plt-header-r.bmp | 0
Acollects/meta/build/nsis/plt-header.bmp | 0
Acollects/meta/build/nsis/plt-installer.ico | 0
Acollects/meta/build/nsis/plt-installer.nsi | 305+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acollects/meta/build/nsis/plt-uninstaller.ico | 0
Acollects/meta/build/nsis/plt-welcome.bmp | 0
Acollects/meta/build/unix-installer/plt-installer-header | 485+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 790 insertions(+), 0 deletions(-)

diff --git a/collects/meta/build/nsis/plt-header-r.bmp b/collects/meta/build/nsis/plt-header-r.bmp Binary files differ. diff --git a/collects/meta/build/nsis/plt-header.bmp b/collects/meta/build/nsis/plt-header.bmp Binary files differ. diff --git a/collects/meta/build/nsis/plt-installer.ico b/collects/meta/build/nsis/plt-installer.ico Binary files differ. diff --git a/collects/meta/build/nsis/plt-installer.nsi b/collects/meta/build/nsis/plt-installer.nsi @@ -0,0 +1,305 @@ +!include "MUI2.nsh" +!include "WinVer.nsh" +!include "nsDialogs.nsh" + +;; ==================== Configuration + +;; The following should define: +;; PLTVersion, PLTVersionLong, PLTHumanName, +;; PLTDirName, PLTRegName + +!include plt-defs.nsh + +Name "${PLTHumanName}" +OutFile "installer.exe" + +BrandingText "${PLTHumanName}" +BGGradient 4040A0 101020 + +SetCompressor /SOLID "LZMA" + +InstallDir "$PROGRAMFILES\${PLTDirName}" +!ifndef SimpleInstaller + InstallDirRegKey HKLM "Software\${PLTRegName}" "" +!endif +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${PLTStartName}" +!define MUI_ICON "plt-installer.ico" +!define MUI_UNICON "plt-uninstaller.ico" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP "plt-header.bmp" +!define MUI_HEADERIMAGE_BITMAP_RTL "plt-header-r.bmp" +!define MUI_HEADERIMAGE_RIGHT + +!define MUI_WELCOMEFINISHPAGE_BITMAP "plt-welcome.bmp" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "plt-welcome.bmp" + +!define MUI_WELCOMEPAGE_TITLE "${PLTHumanName} Setup" +!define MUI_UNWELCOMEPAGE_TITLE "${PLTHumanName} Uninstall" +!ifdef SimpleInstaller + !define MUI_WELCOMEPAGE_TEXT "This is a simple installer for ${PLTHumanName}.$\r$\n$\r$\nIt will only create the PLT folder. To uninstall, simply remove the folder.$\r$\n$\r$\n$_CLICK" +!else + !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of ${PLTHumanName}.$\r$\n$\r$\nPlease close other PLT applications (DrScheme, MrEd, MzScheme) so the installer can update relevant system files.$\r$\n$\r$\n$_CLICK" +!endif +!define MUI_UNWELCOMEPAGE_TEXT "This wizard will guide you through the removal of ${PLTHumanName}.$\r$\n$\r$\nBefore starting, make sure PLT applications (DrScheme, MrEd, MzScheme) are not running.$\r$\n$\r$\n$_CLICK" + +!define MUI_FINISHPAGE_TITLE "${PLTHumanName}" +!ifdef SimpleInstaller + !define MUI_FINISHPAGE_RUN + !define MUI_FINISHPAGE_RUN_FUNCTION OpenInstDir + Function OpenInstDir + ExecShell "" "$INSTDIR" + FunctionEnd + !define MUI_FINISHPAGE_RUN_TEXT "Open the installation folder" +!else + !define MUI_FINISHPAGE_RUN "$INSTDIR\DrScheme.exe" + !define MUI_FINISHPAGE_RUN_TEXT "Run DrScheme" +!endif +!define MUI_FINISHPAGE_LINK "Visit the PLT Scheme web site" +!define MUI_FINISHPAGE_LINK_LOCATION "http://www.plt-scheme.org/" + +; !define MUI_UNFINISHPAGE_NOAUTOCLOSE ; to allow users see what was erased + +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PLTRegName}" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" + +; Doesn't work on some non-xp machines +; !define MUI_INSTFILESPAGE_PROGRESSBAR colored + +VIProductVersion "${PLTVersionLong}" +VIAddVersionKey "ProductName" "PLT Scheme" +VIAddVersionKey "Comments" "This is PLT Scheme, including DrScheme which is based on MrEd and MzScheme." +VIAddVersionKey "CompanyName" "PLT" +VIAddVersionKey "LegalCopyright" "© PLT" +VIAddVersionKey "FileDescription" "PLT Scheme Installer" +VIAddVersionKey "FileVersion" "${PLTVersion}" + +;; ==================== Variables + +!ifndef SimpleInstaller + Var MUI_TEMP + Var STARTMENU_FOLDER +!endif + +;; ==================== Interface + +!define MUI_ABORTWARNING + +; Install +!insertmacro MUI_PAGE_WELCOME +!define MUI_PAGE_CUSTOMFUNCTION_LEAVE myTestInstDir +!insertmacro MUI_PAGE_DIRECTORY +!ifndef SimpleInstaller + !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER +!endif +!insertmacro MUI_PAGE_INSTFILES + +; Uncheck and hide the "run" checkbox on vista, since it will run with +; elevated permissions (see also ../nsis-vista-note.txt) +!define MUI_PAGE_CUSTOMFUNCTION_SHOW DisableRunCheckBoxIfOnVista +!insertmacro MUI_PAGE_FINISH +Function DisableRunCheckBoxIfOnVista + ${If} ${AtLeastWinVista} + ; use EnableWindow instead of ShowWindow to just disable it + ShowWindow $mui.FinishPage.Run 0 + ${NSD_Uncheck} $mui.FinishPage.Run + ${EndIf} +FunctionEnd + +!ifndef SimpleInstaller + ; Uninstall + !define MUI_WELCOMEPAGE_TITLE "${MUI_UNWELCOMEPAGE_TITLE}" + !define MUI_WELCOMEPAGE_TEXT "${MUI_UNWELCOMEPAGE_TEXT}" + ; !insertmacro MUI_UNPAGE_WELCOME + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + ; !insertmacro MUI_UNPAGE_FINISH +!endif + +!ifndef SimpleInstaller + !define MUI_CUSTOMFUNCTION_UNGUIINIT un.myGUIInit +!endif + +!insertmacro MUI_LANGUAGE "English" + +!ifndef SimpleInstaller + !define UNINSTEXE "$INSTDIR\Uninstall.exe" +!endif + +;; ==================== Installer + +!ifdef SimpleInstaller +Function myTestInstDir + IfFileExists "$INSTDIR\*.*" +1 inst_dir_exists + MessageBox MB_YESNO "The directory '$INSTDIR' already exists, continue?" /SD IDYES IDYES inst_dir_exists + Abort + inst_dir_exists: +FunctionEnd +!else +Function myTestInstDir + ; The assumption is that users might have all kinds of ways to get a PLT + ; tree, plus, they might have an old wise-based installation, so it is better + ; to rely on files rather than test registry keys. Note: no version check. + ; if any of these exist, then we assume it's an old installation + IfFileExists "$INSTDIR\MzScheme.exe" plt_is_installed + IfFileExists "$INSTDIR\MrEd.exe" plt_is_installed + IfFileExists "$INSTDIR\DrScheme.exe" plt_is_installed + IfFileExists "$INSTDIR\collects" plt_is_installed + Goto plt_is_not_installed + plt_is_installed: + IfFileExists "${UNINSTEXE}" we_have_uninstall + MessageBox MB_YESNO "It appears that there is an existing PLT Scheme installation in '$INSTDIR', but no Uninstaller was found.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES maybe_remove_tree + Abort + we_have_uninstall: + MessageBox MB_YESNO "It appears that there is an existing PLT Scheme installation in '$INSTDIR'.$\r$\nDo you want to uninstall it first (recommended)?" /SD IDNO IDNO maybe_remove_tree + HideWindow + ClearErrors + ExecWait '"${UNINSTEXE}" _?=$INSTDIR' + IfErrors uninstaller_problematic + IfFileExists "$INSTDIR\MzScheme.exe" uninstaller_problematic + IfFileExists "$INSTDIR\MrEd.exe" uninstaller_problematic + BringToFront + Goto plt_is_not_installed + uninstaller_problematic: + MessageBox MB_YESNO "Errors in uninstallation!$\r$\nDo you want to quit and sort things out now (highly recommended)?" /SD IDNO IDNO maybe_remove_tree + Quit + maybe_remove_tree: + MessageBox MB_YESNO "Since you insist, do you want to simply remove the previous directory now?$\r$\n(It is really better if you sort this out manually.)" /SD IDYES IDNO plt_is_not_installed + RMDir /r $INSTDIR + plt_is_not_installed: +FunctionEnd +!endif + +Section "" + SetShellVarContext all + + SetDetailsPrint both + DetailPrint "Installing PLT Scheme..." + SetDetailsPrint listonly + SetOutPath "$INSTDIR" + File /a /r "plt\*.*" + !ifndef SimpleInstaller + WriteUninstaller "${UNINSTEXE}" ; Create uninstaller + !endif + + !ifndef SimpleInstaller + SetDetailsPrint both + DetailPrint "Creating Shortcuts..." + SetDetailsPrint listonly + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + SetOutPath "$INSTDIR" ; Make installed links run in INSTDIR + CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\DrScheme.lnk" "$INSTDIR\DrScheme.exe" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\PLT Documentation.lnk" "$INSTDIR\plt-help.exe" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MrEd.lnk" "$INSTDIR\MrEd.exe" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MzScheme.lnk" "$INSTDIR\MzScheme.exe" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\PLT Folder.lnk" "$INSTDIR" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "${UNINSTEXE}" + !insertmacro MUI_STARTMENU_WRITE_END + + SetDetailsPrint both + DetailPrint "Setting Registry Keys..." + SetDetailsPrint listonly + WriteRegStr HKLM "Software\${PLTRegName}" "" "$INSTDIR" ; Save folder location + WriteRegStr HKCR ".ss" "" "Scheme.Document" + WriteRegStr HKCR ".scm" "" "Scheme.Document" + WriteRegStr HKCR ".scrbl" "" "Scheme.Document" + WriteRegStr HKCR "Scheme.Document" "" "PLT Scheme Document" + WriteRegStr HKCR "Scheme.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico" + WriteRegStr HKCR "Scheme.Document\shell\open\command" "" '"$INSTDIR\DrScheme.exe" "%1"' + ; Example, in case we want some things like this in the future + ; WriteRegStr HKCR "Scheme.Document\shell\mzscheme" "" "Run with MzScheme" + ; WriteRegStr HKCR "Scheme.Document\shell\mzscheme\command" "" '"$INSTDIR\MzScheme.exe" "-r" "%1"' + WriteRegStr HKCR ".plt" "" "Setup PLT.Document" + WriteRegStr HKCR "Setup PLT.Document" "" "PLT Scheme Package" + WriteRegStr HKCR "Setup PLT.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico" + WriteRegStr HKCR "Setup PLT.Document\shell\open\command" "" '"$INSTDIR\Setup PLT.exe" -p "%1"' + + WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "UninstallString" '"${UNINSTEXE}"' + WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "DisplayName" "${PLTHumanName}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "DisplayIcon" "$INSTDIR\DrScheme.exe,0" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "DisplayVersion" "${PLTVersion}" + ; used to also have "VersionMajor" & "VersionMinor" but looks like it's not needed + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "HelpLink" "http://www.plt-scheme.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "URLInfoAbout" "http://www.plt-scheme.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "Publisher" "PLT Scheme Inc." + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "NoModify" "1" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" "NoRepair" "1" + !endif + + SetDetailsPrint both + DetailPrint "Installation complete." +SectionEnd + +;; ==================== Uninstaller + +!ifndef SimpleInstaller + +Function un.myGUIInit + ; if any of these exist, then we're fine + IfFileExists "$INSTDIR\MzScheme.exe" plt_is_installed_un + IfFileExists "$INSTDIR\MrEd.exe" plt_is_installed_un + IfFileExists "$INSTDIR\DrScheme.exe" plt_is_installed_un + IfFileExists "$INSTDIR\collects" plt_is_installed_un + MessageBox MB_YESNO "It does not appear that PLT Scheme is installed in '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES plt_is_installed_un + Abort "Uninstall aborted by user" + plt_is_installed_un: +FunctionEnd + +Section "Uninstall" + SetShellVarContext all + + SetDetailsPrint both + DetailPrint "Removing the PLT Scheme installation..." + SetDetailsPrint listonly + Delete "$INSTDIR\*.exe" + Delete "$INSTDIR\README*.*" + RMDir /r "$INSTDIR\collects" + RMDir /r "$INSTDIR\include" + RMDir /r "$INSTDIR\lib" + RMDir /r "$INSTDIR\doc" + ;; these exist in PLT-Full installations + RMDir /r "$INSTDIR\man" + RMDir /r "$INSTDIR\src" + Delete "${UNINSTEXE}" + RMDir "$INSTDIR" + ;; if the directory is opened, it will take some time to remove + Sleep 1000 + IfErrors +1 uninstall_inst_dir_ok + MessageBox MB_YESNO "The PLT Scheme installation at '$INSTDIR' was not completely removed.$\r$\nForce deletion?$\r$\n(Make sure no PLT applications are running.)" /SD IDYES IDNO uninstall_inst_dir_ok + RMDir /r "$INSTDIR" + IfErrors +1 uninstall_inst_dir_ok + MessageBox MB_OK "Forced deletion did not work either, you will need to clean up '$INSTDIR' manually." /SD IDOK + uninstall_inst_dir_ok: + + SetDetailsPrint both + DetailPrint "Removing Shortcuts..." + SetDetailsPrint listonly + !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP + Delete "$SMPROGRAMS\$MUI_TEMP\*.lnk" + ;; Delete empty start menu parent diretories + StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" + startMenuDeleteLoop: + RMDir $MUI_TEMP + GetFullPathName $MUI_TEMP "$MUI_TEMP\.." + IfErrors startMenuDeleteLoopDone + StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop + startMenuDeleteLoopDone: + + SetDetailsPrint both + DetailPrint "Removing Registry Keys..." + SetDetailsPrint listonly + DeleteRegKey /ifempty HKLM "Software\${PLTRegName}\Start Menu Folder" + DeleteRegKey /ifempty HKLM "Software\${PLTRegName}" + DeleteRegKey HKCR ".ss" + DeleteRegKey HKCR ".scm" + DeleteRegKey HKCR ".scrbl" + DeleteRegKey HKCR "Scheme.Document" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PLTRegName}" + + SetDetailsPrint both + DetailPrint "Uninstallation complete." +SectionEnd + +!endif diff --git a/collects/meta/build/nsis/plt-uninstaller.ico b/collects/meta/build/nsis/plt-uninstaller.ico Binary files differ. diff --git a/collects/meta/build/nsis/plt-welcome.bmp b/collects/meta/build/nsis/plt-welcome.bmp Binary files differ. diff --git a/collects/meta/build/unix-installer/plt-installer-header b/collects/meta/build/unix-installer/plt-installer-header @@ -0,0 +1,485 @@ + +############################################################################### +## Utilities + +PATH=/usr/bin:/bin + +if [ "x`echo -n`" = "x-n" ]; then + echon() { /bin/echo "$*\c"; } +else + echon() { echo -n "$*"; } +fi + +rm_on_abort="" +failwith() { + echo "Error: $*" 1>&2 + if test ! "x$rm_on_abort" = "x" && test -e "$rm_on_abort"; then + echon " (Removing installation files in $rm_on_abort)" + "$rm" -rf "$rm_on_abort" + echo "" + fi + exit 1 +} +exithandler() { + failwith "Aborting..." +} + +trap exithandler 2 3 9 15 + +lookfor() { + save_IFS="${IFS}" + IFS=":" + for dir in $PATH; do + if test -x "$dir/$1"; then + eval "$1=$dir/$1" + IFS="$save_IFS" + return + fi + done + IFS="$save_IFS" + failwith "could not find \"$1\"." +} + +link() { # args are source, target, where we are + "$rm" -f "$2" || failwith "could not remove \"$2\" in \"$3\"." + "$ln" -s "$1" "$2" || failwith "could not link \"$2\" in \"$3\"." +} + +lookfor rm +lookfor ls +lookfor ln +lookfor tail +lookfor cksum +lookfor tar +lookfor gunzip +lookfor mkdir +lookfor basename +lookfor dirname + +# Need this to make new `tail' respect old-style command-line arguments. Can't +# use `tail -n #' because some old tails won't know what to do with that. +_POSIX2_VERSION=199209 +export _POSIX2_VERSION + +origpwd="`pwd`" + +echo "This program will extract and install $DISTNAME." +echo "" +echo "Note: the required diskspace for this installation is about $ORIGSIZE." + +############################################################################### +## What kind of installation? + +echo "" +echo "Do you want a Unix-style distribution?" +echo " In this distribution mode files go into different directories according" +echo " to Unix conventions. A \"plt-uninstall\" script will be generated to" +echo " make it possible to remove the installation. If say 'no', the whole" +echo " PLT directory is kept as a single (movable and erasable) unit, possibly" +echo " with external links into it." +if test ! "x$RELEASED" = "xyes"; then + echo "*** This is a nightly build: such a distribution is not recommended" + echo "*** because it cannot be used to install multiple versions." +fi +unixstyle="x" +while test "$unixstyle" = "x"; do + echon "Enter yes/no (default: no) > " + read unixstyle + case "$unixstyle" in + [yY]* ) unixstyle="yes" ;; + [nN]* ) unixstyle="no" ;; + "" ) unixstyle="no" ;; + * ) unixstyle="x" ;; + esac +done + +############################################################################### +## Where do you want it? + +echo "" +if test "$unixstyle" = "yes"; then + echo "Where do you want to base your installation of $DISTNAME?" + echo " (Use an existing directory. If you've done such an installation in" + echo " the past, either use the same place, or manually run" + echo " 'plt-uninstaller' now.)" + TARGET1="..." +else + echo "Where do you want to install the \"$TARGET\" directory tree?" + TARGET1="$TARGET" +fi +echo " 1 - /usr/$TARGET1 [default]" +echo " 2 - /usr/local/$TARGET1" +echo " 3 - \$HOME/$TARGET1 ($HOME/$TARGET1)" +echo " 4 - ./$TARGET1 (here)" +if test "$unixstyle" = "yes"; then + echo " Or enter a different directory prefix to install in." +else + echo " Or enter a different \"plt\" directory to install in." +fi +echon "> " +read where +case "$where" in + "" | "1" ) where="/usr" ;; + "2" ) where="/usr/local" ;; + "3" ) where="$HOME" ;; + "4" | "." ) where="`pwd`" ;; + "/"* ) + if test "$unixstyle" = "no"; then + TARGET="`\"$basename\" \"$where\"`" + where="`\"$dirname\" \"$where\"`" + fi + ;; + * ) + if test "$unixstyle" = "no"; then + TARGET="`\"$basename\" \"$where\"`" + where="`\"$dirname\" \"$where\"`" + fi + if test -d "$where"; then cd "$where"; where="`pwd`"; cd "$origpwd" + else where="`pwd`/$where"; fi + ;; +esac + +if test "$unixstyle" = "no"; then + # can happen when choosing the root + if test "$TARGET" = "/"; then + failwith "refusing to remove your root" + fi +fi + +# WHERE1 can be used with "$WHERE1/$TARGET" to avoid a double slash +case "$where" in + "" ) failwith "internal error (empty \$where)" ;; + "/" ) WHERE1="" ;; + *"/" ) failwith "internal error (\$where ends in a slash)" ;; + "/"* ) WHERE1="$where" ;; + * ) failwith "internal error (\$where is not absolute)" ;; +esac + +if test ! -d "$where"; then + failwith "the directory \"$where\" does not exist." +fi +if test ! -w "$where"; then + failwith "cannot write to \"$where\"." +fi + +############################################################################### +## Deal with Unix-style path questions + +set_prefix() { + where="$1" + # default dirs -- mimic configure behavior + bindir="$WHERE1/bin" + collectsdir="$WHERE1/lib/plt/collects" + if test -d "$WHERE1/share"; then docdir="$WHERE1/share/plt/doc" + elif test -d "$WHERE1/doc"; then docdir="$WHERE1/doc/plt" + else docdir="$WHERE1/share/plt/doc" + fi + libdir="$WHERE1/lib" + includepltdir="$WHERE1/include/plt" + libpltdir="$WHERE1/lib/plt" + mandir="$WHERE1/man" + # The source tree is always removed -- no point keeping it if it won't work + # if test -d "$WHERE1/share"; then srcdir="$WHERE1/share/plt/src" + # elif test -d "$WHERE1/src"; then srcdir="$WHERE1/src/plt" + # else srcdir="$WHERE1/share/plt/src" + # fi +} + +dir_createable() { + test_dir="`\"$dirname\" \"$1\"`" + if test -d "$test_dir" && test -w "$test_dir"; then return 0 + elif test "$test_dir" = "/"; then return 1 + else dir_createable "$test_dir"; fi +} + +show_dir_var() { + if test -f "$2"; then dir_status="(error: not a directory!)"; err="yes" + elif test ! -d "$2"; then + if dir_createable "$2"; then dir_status="(will be created)" + else dir_status="(error: not writable!)"; err="yes"; fi + elif test ! -w "$2"; then dir_status="(error: not writable!)"; err="yes" + else dir_status="(exists)" + fi + echo " $1 $2 $dir_status" +} + +read_dir() { + read new_dir + case "$new_dir" in + "/"* ) echo "$new_dir" ;; + * ) echo "$WHERE1/$new_dir" ;; + esac +} + +if test "$unixstyle" = "yes"; then + set_prefix "$where" + # loop for possible changes + done="no" + while test ! "$done" = "yes"; do + echo "" + echo "Target Directories:" + err="no" + show_dir_var "[e] Executables " "$bindir" + show_dir_var "[s] Scheme Code " "$collectsdir" + show_dir_var "[d] Core Docs " "$docdir" + show_dir_var "[l] C Libraries " "$libdir" + show_dir_var "[h] C headers " "$includepltdir" + show_dir_var "[o] Extra C Objs " "$libpltdir" + show_dir_var "[m] Man Pages " "$mandir" + if test "$PNAME" = "full"; then + echo " (C sources are not kept)" + # show_dir_var "[r] Source Tree " "$srcdir" + fi + if test "$err" = "yes"; then echo "*** Errors in some paths ***"; fi + echo "Enter a new prefix, a letter to change an entry, enter to continue" + echon "> " + read change_what + case "$change_what" in + [eE]* ) echon "New directory: "; bindir="`read_dir`" ;; + [sS]* ) echon "New directory: "; collectsdir="`read_dir`" ;; + [dD]* ) echon "New directory: "; docdir="`read_dir`" ;; + [lL]* ) echon "New directory: "; libdir="`read_dir`" ;; + [hH]* ) echon "New directory: "; includepltdir="`read_dir`" ;; + [oO]* ) echon "New directory: "; libpltdir="`read_dir`" ;; + [mM]* ) echon "New directory: "; mandir="`read_dir`" ;; + # [rR]* ) if test "$PNAME" = "full"; then + # echon "New directory: "; srcdir="`read_dir`" + # else + # echo "Invalid response" + # fi ;; + "/"* ) set_prefix "$change_what" ;; + "" ) done="yes" ;; + * ) echo "Invalid response" ;; + esac + done + if test "$err" = "yes"; then failwith "errors in some paths"; fi +fi + +############################################################################### +## Integrity check + +echo "" +echon "Checking the integrity of the binary archive... " +SUM="`\"$tail\" +\"$BINSTARTLINE\" \"$0\" | \"$cksum\"`" \ + || failwith "problems running cksum." +SUM="`set $SUM; echo $1`" +test "$BINSUM" = "$SUM" || failwith "bad CRC checksum." +echo "ok." + +############################################################################### +## Unpacking into $where/$TARGET + +unpack_installation() { + # test that no TARGET exists + if test -d "$WHERE1/$TARGET" || test -f "$WHERE1/$TARGET"; then + echon "\"$WHERE1/$TARGET\" exists, delete? " + read yesno + case "$yesno" in + [yY]*) + echon "Deleting old \"$WHERE1/$TARGET\"... " + "$rm" -rf "$WHERE1/$TARGET" \ + || failwith "could not delete \"$WHERE1/$TARGET\"." + echo "done." + ;; + *) failwith "aborting because \"$WHERE1/$TARGET\" exists." ;; + esac + fi + # unpack + echon "Unpacking into \"$WHERE1/$TARGET\"... " + rm_on_abort="$WHERE1/$TARGET" + "$mkdir" "$WHERE1/$TARGET" + "$tail" +"$BINSTARTLINE" "$0" | "$gunzip" -c \ + | { cd "$WHERE1/$TARGET" + "$tar" xf - || failwith "problems during unpacking of binary archive." + } + cd "$WHERE1/$TARGET" + test -d "collects" \ + || failwith "unpack failed (could not find \"$WHERE1/$TARGET/collects\")." + echo "done." +} + +############################################################################### +## Whole-directory installations + +wholedir_install() { + +unpack_installation +rm_on_abort="" + +cd "$where" +if test -d "bin"; then + echo "Do you want to install new system links within the bin, lib, include," + echo " man, and doc subdirectories of \"$where\", possibly overriding" + echon " existing links? " + read yesno + case "$yesno" in + [yY]* ) sysdir="$where" ;; + * ) sysdir="" ;; + esac +else + cd "$origpwd" + echo "" + echo "If you want to install new system links within the bin, lib, include," + echo " man, and doc subdirectories of a common directory prefix (for" + echo " example, \"/usr/local\") then enter the prefix you want to use." + echon "(default: skip links) > " + read sysdir + if test ! "x$sysdir" = "x"; then + if test ! -d "$sysdir"; then + echo "Directory \"$sysdir\" does not exist, skipping links." + sysdir="" + elif test ! -w "$sysdir"; then + echo "Directory \"$sysdir\" is not writable, skipping links." + sysdir="" + else + cd "$sysdir" + sysdir="`pwd`" + fi + fi +fi + +if test ! "x$sysdir" = "x"; then + # binaries + cd "$sysdir" + if test -d "bin" && test -w "bin"; then + echo "Installing links in \"$sysdir/bin\"..." + printsep=" " + cd "bin" + for x in `cd "$WHERE1/$TARGET/bin"; ls`; do + if test -x "$WHERE1/$TARGET/bin/$x"; then + echon "${printsep}$x" + printsep=", " + link "$WHERE1/$TARGET/bin/$x" "$x" "$sysdir/bin" + fi + done + echo "" + echo "Done. (see \"$WHERE1/$TARGET/bin\" for other executables)" + else + echo "Skipping \"$sysdir/bin\" (does not exist or not writable)." + fi + # man pages + cd "$sysdir" + if test -d "man" && test -d "man/man1" && test -w "man/man1"; then + mandir="man/man1" + elif test -d "share" && test -d "share/man" && test -d "share/man/man1" \ + && test -w "share/man/man1"; then + mandir="share/man/man1" + else + mandir="" + fi + if test "x$mandir" = "x"; then + echo "Skipping \"$sysdir/man/man1\" (does not exist or not writable)." + else + cd "$mandir" + echo "Installing links in \"$sysdir/$mandir\"..." + printsep=" " + for x in `cd "$WHERE1/$TARGET/man/man1/"; "$ls"`; do + echon "${printsep}$x" + printsep=", " + link "$WHERE1/$TARGET/man/man1/$x" "$x" "$sysdir/$mandir" + done + echo "" + echo "Done" + fi + # lib link + cd "$sysdir" + if test -d "lib" && test -w "lib"; then + libdir="lib" + elif test -d "share" && test -d "share/lib" && test -w "share/lib"; then + libdir="share/lib" + else + libdir="" + fi + if test "x$libdir" = "x"; then + echo "Skipping \"$sysdir/lib\" (does not exist or not writable)." + else + cd "$libdir" + echo "Installing \"$sysdir/$libdir/$TARGET\"." + link "$WHERE1/$TARGET/lib" "$TARGET" "$sysdir/$libdir" + fi + # include link + cd "$sysdir" + if test -d "include" && test -w "include"; then + incdir="include" + elif test -d "share" && test -d "share/include" \ + && test -w "share/include"; then + incdir="share/include" + else + incdir="" + fi + if test "x$incdir" = "x"; then + echo "Skipping \"$sysdir/include\" (does not exist or not writable)." + else + cd "$incdir" + echo "Installing \"$sysdir/$incdir/$TARGET\"." + link "$WHERE1/$TARGET/include" "$TARGET" "$sysdir/$incdir" + fi + # doc link + cd "$sysdir" + if test -d "doc" && test -w "doc"; then + docdir="doc" + elif test -d "share" && test -d "share/doc" && test -w "share/doc"; then + docdir="share/doc" + else + docdir="" + fi + if test "x$docdir" = "x"; then + echo "Skipping \"$sysdir/doc\" (does not exist or not writable)." + else + cd "$docdir" + echo "Installing \"$sysdir/$docdir/$TARGET\"." + link "$WHERE1/$TARGET/notes" "$TARGET" "$sysdir/$docdir" + fi +fi + +} + +############################################################################### +## Unix-style installations + +unixstyle_install() { + +TARGET="$TARGET-tmp-install" +if test -e "$WHERE1/$TARGET"; then + echo "\"$WHERE1/$TARGET\" already exists (needed for the installation)," + echon " ok to remove? " + read R + case "$R" in + [yY]* ) "$rm" -rf "$WHERE1/$TARGET" ;; + * ) failwith "abort..." ;; + esac +fi + +if test -x "$bindir/plt-uninstall"; then + echo "A previous PLT uninstaller is found at \"$bindir/plt-uninstall\"," + echon " ok to run it? " + read R + case "$R" in + [yY]* ) echon " running uninstaller..." + "$bindir/plt-uninstall" || failwith "problems during uninstall" + echo " done." ;; + * ) failwith "abort..." ;; + esac +fi + +unpack_installation + +cd "$where" +"$TARGET/bin/mzscheme" "$TARGET/collects/setup/unixstyle-install.ss" \ + "move" "$WHERE1/$TARGET" "$bindir" "$collectsdir" "$docdir" "$libdir" \ + "$includepltdir" "$libpltdir" "$mandir" \ +|| failwith "installation failed" + +} + +############################################################################### +## Done + +if test "$unixstyle" = "yes"; then unixstyle_install; else wholedir_install; fi + +echo "" +echo "All done." + +exit + +========== tar.gz file follows ==========