www

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

commit 3bf1bd3ad81b6a14ac3103515ed674f2825f1c75
parent 9d585b1c16939abfbb4561947b6d95836f839529
Author: Matthew Flatt <mflatt@racket-lang.org>
Date:   Fri, 24 May 2013 21:57:31 -0600

reorganize into core plus packages

The "racket" directory contains a pared-back version of the
repository, roughly.

The "pkgs" directory everything else in the repository, but
organized into packages.

original commit: b2ebb0a28bf8136e75cd98316c22fe54c30eacb2

Diffstat:
Dcollects/meta/build/nsis/installer.nsi | 311-------------------------------------------------------------------------------
Dcollects/meta/build/unix-installer/installer-header | 411-------------------------------------------------------------------------------
Apkgs/distro-build/info.rkt | 4++++
Apkgs/distro-build/installer-dmg.rkt | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/distro-build/installer-exe.rkt | 416+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/distro-build/installer-sh.rkt | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/distro-build/installer.rkt | 31+++++++++++++++++++++++++++++++
Rcollects/meta/build/dmg/racket-rising.png -> pkgs/distro-build/macosx-installer/racket-rising.png | 0
Apkgs/distro-build/pack-built.rkt | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/distro-build/pack-collects.rkt | 20++++++++++++++++++++
Apkgs/distro-build/serve-catalog.rkt | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/distro-build/unix-installer/installer-header | 402+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkgs/distro-build/unpack-collects.rkt | 30++++++++++++++++++++++++++++++
Rcollects/meta/build/nsis/header-r.bmp -> pkgs/distro-build/windows-installer/header-r.bmp | 0
Rcollects/meta/build/nsis/header.bmp -> pkgs/distro-build/windows-installer/header.bmp | 0
Rcollects/meta/build/nsis/installer.ico -> pkgs/distro-build/windows-installer/installer.ico | 0
Rcollects/meta/build/nsis/uninstaller.ico -> pkgs/distro-build/windows-installer/uninstaller.ico | 0
Rcollects/meta/build/nsis/welcome.bmp -> pkgs/distro-build/windows-installer/welcome.bmp | 0
18 files changed, 1225 insertions(+), 722 deletions(-)

diff --git a/collects/meta/build/nsis/installer.nsi b/collects/meta/build/nsis/installer.nsi @@ -1,311 +0,0 @@ -!include "MUI2.nsh" -!include "WinVer.nsh" -!include "nsDialogs.nsh" - -;; ==================== Configuration - -;; The following should define: -;; RKTVersion, RKTVersionLong, RKTHumanName, RKTShortName, -;; RKTStartName, RKTDirName, RKTRegName, RKTProgFiles - -!include racket-defs.nsh - -Name "${RKTHumanName}" -OutFile "installer.exe" - -BrandingText "${RKTHumanName}" -BGGradient 4040A0 101020 - -SetCompressor /SOLID "LZMA" - -InstallDir "${RKTProgFiles}\${RKTDirName}" -!ifndef SimpleInstaller - InstallDirRegKey HKLM "Software\${RKTRegName}" "" -!endif -!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${RKTStartName}" -!define MUI_ICON "installer.ico" -!define MUI_UNICON "uninstaller.ico" -!define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_BITMAP "header.bmp" -!define MUI_HEADERIMAGE_BITMAP_RTL "header-r.bmp" -!define MUI_HEADERIMAGE_RIGHT - -!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "welcome.bmp" - -!define MUI_WELCOMEPAGE_TITLE "${RKTHumanName} Setup" -!define MUI_UNWELCOMEPAGE_TITLE "${RKTHumanName} Uninstall" -!ifdef SimpleInstaller - !define MUI_WELCOMEPAGE_TEXT "This is a simple installer for ${RKTShortName}.$\r$\n$\r$\nIt will only create the Racket 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 ${RKTShortName}.$\r$\n$\r$\nPlease close any running Racket applications so the installer can update the relevant system files.$\r$\n$\r$\n$_CLICK" -!endif -!define MUI_UNWELCOMEPAGE_TEXT "This wizard will guide you through the removal of ${RKTShortName}.$\r$\n$\r$\nBefore starting, make sure no Racket applications are running.$\r$\n$\r$\n$_CLICK" - -!define MUI_FINISHPAGE_TITLE "${RKTHumanName}" -!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\DrRacket.exe" - !define MUI_FINISHPAGE_RUN_TEXT "Run DrRacket" -!endif -!define MUI_FINISHPAGE_LINK "Visit the Racket web site" -!define MUI_FINISHPAGE_LINK_LOCATION "http://racket-lang.org/" - -; !define MUI_UNFINISHPAGE_NOAUTOCLOSE ; to allow users see what was erased - -!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" -!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${RKTRegName}" -!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - -; Doesn't work on some non-xp machines -; !define MUI_INSTFILESPAGE_PROGRESSBAR colored - -VIProductVersion "${RKTVersionLong}" -VIAddVersionKey "ProductName" "Racket" -VIAddVersionKey "Comments" "This is the Racket language, see http://racket-lang.org/." -VIAddVersionKey "CompanyName" "PLT" -VIAddVersionKey "LegalCopyright" "© PLT" -VIAddVersionKey "FileDescription" "Racket Installer" -VIAddVersionKey "FileVersion" "${RKTVersion}" - -;; ==================== 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 Racket - ; 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\Racket.exe" racket_is_installed - IfFileExists "$INSTDIR\GRacket.exe" racket_is_installed - IfFileExists "$INSTDIR\DrRacket.exe" racket_is_installed - IfFileExists "$INSTDIR\collects" racket_is_installed - Goto racket_is_not_installed - racket_is_installed: - IfFileExists "${UNINSTEXE}" we_have_uninstall - MessageBox MB_YESNO "It appears that there is an existing Racket 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 Racket 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\Racket.exe" uninstaller_problematic - IfFileExists "$INSTDIR\GRacket.exe" uninstaller_problematic - BringToFront - Goto racket_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 racket_is_not_installed - RMDir /r $INSTDIR - racket_is_not_installed: -FunctionEnd -!endif - -Section "" - SetShellVarContext all - - SetDetailsPrint both - DetailPrint "Installing Racket..." - SetDetailsPrint listonly - SetOutPath "$INSTDIR" - File /a /r "racket\*.*" - !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\DrRacket.lnk" "$INSTDIR\DrRacket.exe" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket Documentation.lnk" "$INSTDIR\Racket Documentation.exe" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GRacket.lnk" "$INSTDIR\GRacket.exe" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket.lnk" "$INSTDIR\Racket.exe" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket 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\${RKTRegName}" "" "$INSTDIR" ; Save folder location - WriteRegStr HKCR ".rkt" "" "Racket.Document" - WriteRegStr HKCR ".rktl" "" "Racket.Document" - WriteRegStr HKCR ".rktd" "" "Racket.Document" - WriteRegStr HKCR ".ss" "" "Racket.Document" - WriteRegStr HKCR ".scm" "" "Racket.Document" - WriteRegStr HKCR ".scrbl" "" "Racket.Document" - WriteRegStr HKCR "Racket.Document" "" "Racket Document" - WriteRegStr HKCR "Racket.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico" - WriteRegStr HKCR "Racket.Document\shell\open\command" "" '"$INSTDIR\DrRacket.exe" "%1"' - ; Example, in case we want some things like this in the future - ; WriteRegStr HKCR "Racket.Document\shell\racket" "" "Run with Racket" - ; WriteRegStr HKCR "Racket.Document\shell\racket\command" "" '"$INSTDIR\Racket.exe" "-r" "%1"' - WriteRegStr HKCR ".plt" "" "Racket Setup.Document" - WriteRegStr HKCR "Racket Setup.Document" "" "Racket Package" - WriteRegStr HKCR "Racket Setup.Document\DefaultIcon" "" "$INSTDIR\collects\icons\schemedoc.ico" - WriteRegStr HKCR "Racket Setup.Document\shell\open\command" "" '"$INSTDIR\raco.exe" setup -p "%1"' - - WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "UninstallString" '"${UNINSTEXE}"' - WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "InstallLocation" "$INSTDIR" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayName" "${RKTHumanName}" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayIcon" "$INSTDIR\DrRacket.exe,0" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayVersion" "${RKTVersion}" - ; used to also have "VersionMajor" & "VersionMinor" but looks like it's not needed - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "HelpLink" "http://racket-lang.org/" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "URLInfoAbout" "http://racket-lang.org/" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "Publisher" "PLT Design Inc." - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "NoModify" "1" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "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\Racket.exe" racket_is_installed_un - IfFileExists "$INSTDIR\GRacket.exe" racket_is_installed_un - IfFileExists "$INSTDIR\DrRacket.exe" racket_is_installed_un - IfFileExists "$INSTDIR\collects" racket_is_installed_un - MessageBox MB_YESNO "It does not appear that Racket is installed in '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES racket_is_installed_un - Abort "Uninstall aborted by user" - racket_is_installed_un: -FunctionEnd - -Section "Uninstall" - SetShellVarContext all - - SetDetailsPrint both - DetailPrint "Removing the Racket 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 Racket-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 Racket installation at '$INSTDIR' was not completely removed.$\r$\nForce deletion?$\r$\n(Make sure no Racket 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\${RKTRegName}\Start Menu Folder" - DeleteRegKey /ifempty HKLM "Software\${RKTRegName}" - DeleteRegKey HKCR ".rkt" - DeleteRegKey HKCR ".rktl" - DeleteRegKey HKCR ".rktd" - DeleteRegKey HKCR ".ss" - DeleteRegKey HKCR ".scm" - DeleteRegKey HKCR ".scrbl" - DeleteRegKey HKCR "Racket.Document" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" - - SetDetailsPrint both - DetailPrint "Uninstallation complete." -SectionEnd - -!endif diff --git a/collects/meta/build/unix-installer/installer-header b/collects/meta/build/unix-installer/installer-header @@ -1,411 +0,0 @@ - -############################################################################### -## Utilities - -PATH=/usr/bin:/bin - -if test "x`echo -n`" = "x-n"; then - echon() { /bin/echo "$*\c"; } -else - echon() { echo -n "$*"; } -fi - -rm_on_abort="" -failwith() { - err="Error: " - if test "x$1" = "x-noerror"; then err=""; shift; fi - echo "$err$*" 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 -} -# intentional aborts -abort() { failwith -noerror "Aborting installation."; } -# unexpected exits -exithandler() { echo ""; failwith "Aborting..."; } - -trap exithandler 2 3 9 15 - -lookfor() { - saved_IFS="${IFS}" - IFS=":" - for dir in $PATH; do - if test -x "$dir/$1"; then - eval "$1=$dir/$1" - IFS="$saved_IFS" - return - fi - done - IFS="$saved_IFS" - failwith "could not find \"$1\"." -} - -lookfor rm -lookfor ls -lookfor ln -lookfor tail -lookfor cksum -lookfor tar -lookfor gunzip -lookfor mkdir -lookfor basename -lookfor dirname - -# substitute env vars and tildes -expand_path_var() { - eval "expanded_val=\"\$$1\"" - first_part="${expanded_val%%/*}" - if [ "x$first_part" = "x$expanded_val" ]; then - rest_parts="" - else - rest_parts="/${expanded_val#*/}" - fi - case "x$first_part" in - x*" "* ) ;; - x~* ) expanded_val="`eval \"echo $first_part\"`$rest_parts" ;; - esac - eval "$1=\"$expanded_val\"" -} - -# 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 - -origwd="`pwd`" -installer_file="$0" -cat_installer() { - oldwd="`pwd`"; cd "$origwd" - "$tail" +"$BINSTARTLINE" "$installer_file" - cd "$oldwd" -} - -echo "This program will extract and install $DISTNAME." -echo "" -echo "Note: the required diskspace for this installation is $ORIGSIZE." -echo "" - -############################################################################### -## What kind of installation? - -echo "Do you want a Unix-style distribution?" -echo " In this distribution mode files go into different directories according" -echo " to Unix conventions. A \"racket-uninstall\" script will be generated" -echo " to be used when you want to remove the installation. If you say 'no'," -echo " the whole Racket directory is kept in a single installation directory" -echo " (movable and erasable), possibly with external links into it -- this is" -echo " often more convenient, especially if you want to install multiple" -echo " versions or keep it in your home directory." -if test ! "x$RELEASED" = "xyes"; then - echo "*** This is a nightly build: such a unix-style distribution is *not*" - echo "*** recommended 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="Y" ;; - [nN]* ) unixstyle="N" ;; - "" ) unixstyle="N" ;; - * ) unixstyle="x" ;; - esac -done -echo "" - -############################################################################### -## Where do you want it? -## sets $where to the location: target path for wholedir, prefix for unixstyle - -if test "$unixstyle" = "Y"; then - echo "Where do you want to base your installation of $DISTNAME?" - echo " (If you've done such an installation in the past, either" - echo " enter the same directory, or run 'racket-uninstall' manually.)" - 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 - ~/$TARGET1 ($HOME/$TARGET1)" -echo " 4 - ./$TARGET1 (here)" -if test "$unixstyle" = "Y"; then - echo " Or enter a different directory prefix to install in." -else - echo " Or enter a different \"racket\" directory to install in." -fi -echon "> " -read where - -# numeric choice (make "." and "./" synonym for 4) -if test "$unixstyle" = "Y"; then TARGET1="" -else TARGET1="/$TARGET"; fi -case "x$where" in - x | x1 ) where="/usr$TARGET1" ;; - x2 ) where="/usr/local${TARGET1}" ;; - x3 ) where="${HOME}${TARGET1}" ;; - x4 | x. | x./ ) where="`pwd`${TARGET1}" ;; - * ) expand_path_var where ;; -esac - -############################################################################### -## Default system directories prefixed by $1, mimic configure behavior -## used for unixstyle targets and for wholedir links - -set_dirs() { - # unixstyle: uses all of these - # wholedir: uses only bindir & mandir, no need for the others - bindir="$1/bin" - libdir="$1/lib" - incrktdir="$1/include/$TARGET" - librktdir="$1/lib/$TARGET" - collectsdir="$1/lib/$TARGET/collects" - has_share="N" - if test -d "$1/share"; then has_share="Y"; fi - if test "$has_share" = "N" && test -d "$1/doc"; then docdir="$1/doc/$TARGET" - else docdir="$1/share/$TARGET/doc" - fi - if test "$has_share" = "N" && test -d "$1/man"; then mandir="$1/man" - else mandir="$1/share/man" - fi - # The source tree is always removed -- no point keeping it if it won't work - # if test "$has_share" = "N" && test -d "$1/src"; then srcdir="$1/src/$TARGET" - # else srcdir="$1/share/$TARGET/src" - # fi -} - -############################################################################### -## Integrity check and unpack into $1 -## also sets $INSTDIR to the directory in its canonical form - -unpack_installation() { - T="$1" - # integrity check - echo "" - echon "Checking the integrity of the binary archive... " - SUM="`cat_installer | \"$cksum\"`" || failwith "problems running cksum." - SUM="`set $SUM; echo $1`" - test "$BINSUM" = "$SUM" || failwith "bad CRC checksum." - echo "ok." - # test that the target does not exists - here="N" - if test -d "$T" || test -f "$T"; then - if test -d "$T" && test -x "$T"; then - # use the real name, so "/foo/.." shows as an explicit "/" - oldwd="`pwd`"; cd "$T"; T="`pwd`"; cd "$oldwd" - fi - if test -f "$T"; then echon "\"$T\" exists (as a file)" - elif test ! "`pwd`" = "$T"; then echon "\"$T\" exists" - else here="Y"; echon "\"$T\" is where you ran the installer from" - fi - echon ", delete? " - read R - case "$R" in - [yY]* ) - echon "Deleting old \"$T\"... " - "$rm" -rf "$T" || failwith "could not delete \"$T\"." - echo "done." - ;; - * ) abort ;; - esac - fi - # unpack - rm_on_abort="$T" - "$mkdir" -p "$T" || failwith "could not create directory: $T" - if test "$here" = "Y"; then - cd "$T"; INSTDIR="$T" - echo "*** Note: your original directory was deleted, so you will need" - echo "*** to 'cd' back into it when the installer is done, otherwise" - echo "*** it will look like you have an empty directory." - sleep 1 - else oldwd="`pwd`"; cd "$T"; INSTDIR="`pwd`"; cd "$oldwd" - fi - rm_on_abort="$INSTDIR" - echo "Unpacking into \"$INSTDIR\" (Ctrl+C to abort)..." - cat_installer | "$gunzip" -c \ - | { cd "$INSTDIR" - "$tar" xf - || failwith "problems during unpacking of binary archive." - } - test -d "$INSTDIR/collects" \ - || failwith "unpack failed (could not find \"$T/collects\")." - echo "Done." -} - -############################################################################### -## Whole-directory installations - -wholedir_install() { - - unpack_installation "$where" - rm_on_abort="" - - echo "" - echo "If you want to install new system links within the \"bin\" and" - echo " \"man\" subdirectories of a common directory prefix (for example," - echo " \"/usr/local\") then enter the prefix of an existing directory" - echo " that you want to use. This might overwrite existing symlinks," - echo " but not files." - echon "(default: skip links) > " - read SYSDIR - if test "x$SYSDIR" = "x"; then : - elif test ! -d "$SYSDIR"; then - echo "\"$SYSDIR\" does not exist, skipping links." - elif test ! -x "$SYSDIR" || test ! -w "$SYSDIR"; then - echo "\"$SYSDIR\" is not writable, skipping links." - else - oldwd="`pwd`"; cd "$SYSDIR"; SYSDIR="`pwd`"; cd "$oldwd" - set_dirs "$SYSDIR" - install_links() { # tgtdir(absolute) srcdir(relative to INSTDIR) - if ! test -d "$1"; then - echo "\"$1\" does not exist, skipping." - elif ! test -x "$1" || ! test -w "$1"; then - echo "\"$1\" is not writable, skipping" - else - echo "Installing links in \"$1\"..." - printsep=" " - cd "$1" - for x in `cd "$INSTDIR/$2"; ls`; do - echon "${printsep}$x"; printsep=", " - if test -h "$x"; then rm -f "$x"; fi - if test -d "$x" || test -f "$x"; then - echon " skipped (non-link exists)" - elif ! "$ln" -s "$INSTDIR/$2/$x" "$x"; then - echon " skipped (symlink failed)" - fi - done - echo ""; echo " done." - fi - } - install_links "$bindir" "bin" - install_links "$mandir/man1" "man/man1" - fi - -} - -############################################################################### -## Unix-style installations - -dir_createable() { - tdir="`\"$dirname\" \"$1\"`" - if test -d "$tdir" && test -x "$tdir" && test -w "$tdir"; then return 0 - elif test "$tdir" = "/"; then return 1 - else dir_createable "$tdir"; fi -} -show_dir_var() { - if test -f "$2"; then status="error: not a directory!"; err="Y" - elif test ! -d "$2"; then - if dir_createable "$2"; then status="will be created" - else status="error: not writable!"; err="Y"; fi - elif test ! -w "$2"; then status="error: not writable!"; err="Y" - else status="exists" - fi - echo " $1 $2 ($status)" -} - -unixstyle_install() { - - if test -f "$where"; then - failwith "The entered base directory exists as a file: $where" - elif test ! -d "$where"; then - echo "Base directory does not exist: $where" - echon " should I create it? (default: yes) " - read R; case "$R" in [nN]* ) abort ;; esac - "$mkdir" -p "$where" || failwith "could not create directory: $where" - elif test ! -w "$where"; then - failwith "The entered base directory is not writable: $where" - fi - cd "$where" || failwith "Base directory does not exist: $where" - where="`pwd`"; cd "$origwd" - - set_dirs "$where" - # loop for possible changes - done="N"; retry="N" - while test ! "$done" = "Y" || test "x$err" = "xY" ; do - err="N" - if test "$retry" = "N"; then - echo "" - echo "Target Directories:" - show_dir_var "[e] Executables " "$bindir" - show_dir_var "[r] Racket Code " "$collectsdir" - show_dir_var "[d] Core Docs " "$docdir" - show_dir_var "[l] C Libraries " "$libdir" - show_dir_var "[h] C headers " "$incrktdir" - show_dir_var "[o] Extra C Objs " "$librktdir" - show_dir_var "[m] Man Pages " "$mandir" - if test "$PNAME" = "full"; then - echo " (C sources are not kept)" - # show_dir_var "[s] Source Tree " "$srcdir" - fi - echo "Enter a letter to change an entry, or enter to continue." - fi - retry="N" - echon "> "; read change_what - read_dir() { - echon "New directory (absolute or relative to $where): "; read new_dir - expand_path_var new_dir - case "$new_dir" in - "/"* ) eval "$1=\"$new_dir\"" ;; - * ) eval "$1=\"$where/$new_dir\"" ;; - esac - } - case "$change_what" in - [eE]* ) read_dir bindir ;; - [rR]* ) read_dir collectsdir ;; - [dD]* ) read_dir docdir ;; - [lL]* ) read_dir libdir ;; - [hH]* ) read_dir incrktdir ;; - [oO]* ) read_dir librktdir ;; - [mM]* ) read_dir mandir ;; - # [sS]* ) if test "$PNAME" = "full"; then read_dir srcdir - # else echo "Invalid response"; fi ;; - "" ) if test "$err" = "N"; then done="Y" - else echo "*** Please fix erroneous paths to proceed"; fi ;; - * ) retry="Y" ;; - esac - done - - if test -x "$bindir/racket-uninstall"; then - echo "" - echo "A previous Racket uninstaller is found at" - echo " \"$bindir/racket-uninstall\"," - echon " should I run it? (default: yes) " - read R - case "$R" in - [nN]* ) abort ;; - * ) echon " running uninstaller..." - "$bindir/racket-uninstall" || failwith "problems during uninstall" - echo " done." ;; - esac - fi - - tmp="$where/$TARGET-tmp-install" - if test -f "$tmp" || test -d "$tmp"; then - echo "\"$tmp\" already exists (needed for the installation)," - echon " ok to remove it? " - read R; case "$R" in [yY]* ) "$rm" -rf "$tmp" ;; * ) abort ;; esac - fi - unpack_installation "$tmp" - - cd "$where" - "$tmp/bin/racket" "$tmp/collects/setup/unixstyle-install.rkt" \ - "move" "$tmp" "$bindir" "$collectsdir" "$docdir" "$libdir" \ - "$incrktdir" "$librktdir" "$mandir" \ - || failwith "installation failed" - -} - -############################################################################### -## Run the right installer now - -if test "$unixstyle" = "Y"; then unixstyle_install; else wholedir_install; fi - -echo "" -echo "Installation complete." - -exit - -========== tar.gz file follows ========== diff --git a/pkgs/distro-build/info.rkt b/pkgs/distro-build/info.rkt @@ -0,0 +1,4 @@ +#lang setup/infotab + +(define deps '("at-exp-lib" + "web-server-lib")) diff --git a/pkgs/distro-build/installer-dmg.rkt b/pkgs/distro-build/installer-dmg.rkt @@ -0,0 +1,114 @@ +#lang at-exp racket/base +(require racket/system + racket/file + racket/format + racket/runtime-path) + +(provide installer-dmg) + +(define hdiutil "/usr/bin/hdiutil") + +(define-runtime-path bg-image "macosx-installer/racket-rising.png") + +(define (system*/show . l) + (displayln (apply ~a #:separator " " l)) + (unless (apply system* l) + (error "failed"))) + +(define (make-dmg volname src-dir dmg bg) + (define tmp-dmg (make-temporary-file "~a.dmg")) + (define work-dir + (let-values ([(base name dir?) (split-path src-dir)]) + (build-path base "work"))) + (when (file-exists? dmg) (delete-file dmg)) + (delete-directory/files work-dir #:must-exist? #f) + (make-directory* work-dir) + (printf "Copying ~a\n" src-dir) + (copy-directory/files src-dir (build-path work-dir volname) + #:keep-modify-seconds? #t) + (when bg + (copy-file bg (build-path work-dir "bg.png"))) + ;; The following command should work fine, but it looks like hdiutil in 10.4 + ;; is miscalculating the needed size, making it too big in our case (and too + ;; small with >8GB images). It seems that it works to first generate an + ;; uncompressed image and then convert it to a compressed one. + ;; hdiutil create -format UDZO -imagekey zlib-level=9 -ov \ + ;; -mode 555 -volname volname -srcfolder . dmg + ;; So, first create an uncompressed image... + (parameterize ([current-directory work-dir]) + (system*/show hdiutil + "create" "-format" "UDRW" "-ov" + "-mode" "755" "-volname" volname "-srcfolder" "." + tmp-dmg)) + ;; Then do the expected dmg layout... + (when bg + (dmg-layout tmp-dmg volname "bg.png")) + ;; And create the compressed image from the uncompressed image: + (system*/show hdiutil + "convert" "-format" "UDBZ" "-imagekey" "zlib-level=9" "-ov" + tmp-dmg "-o" dmg) + (delete-file tmp-dmg)) + +(define (dmg-layout dmg volname bg) + (define mnt (make-temporary-file "~a-mnt" 'directory)) + (system*/show hdiutil + "attach" "-readwrite" "-noverify" "-noautoopen" + "-mountpoint" mnt dmg) + (define mnt-name (let-values ([(base name dir?) (split-path mnt)]) (path->string name))) + ;; see also https://github.com/andreyvit/yoursway-create-dmg + (define script + @~a{ + tell application "Finder" + -- look for a single disk with the mount point as its name + -- (maybe this works only on newer osx versions?) + set myDisks to every disk + set theDMGDisk to "" + repeat with d in myDisks + if name of d = "@mnt-name" + if theDMGDisk = "" + set theDMGDisk to d + else + error "Too many attached DMGs found!" + end if + end if + end repeat + if theDMGDisk = "" then error "Attached DMG not found!" + -- found a single matching disk, continue + tell theDMGDisk + open + set current view of container window to icon view + set toolbar visible of container window to false + set statusbar visible of container window to false + set bounds of container window to {320, 160, 1000, 540} + set theViewOptions to the icon view options of container window + set arrangement of theViewOptions to not arranged + set icon size of theViewOptions to 128 + set text size of theViewOptions to 16 + set background picture of theViewOptions to file "@bg" + make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} + set position of item "@volname" of container window to {170, 180} + set position of item "@bg" of container window to {900, 180} + set position of item "Applications" of container window to {500, 180} + set name of file "@bg" to ".@bg" + close + open + update without registering applications + delay 5 + close + end tell + end tell + }) + (printf "~a\n" script) + (parameterize ([current-input-port (open-input-string script)]) + (system* "/usr/bin/osascript")) + (system*/show "/bin/sync") + (system*/show "/bin/sync") + (system*/show "/bin/sync") + (system*/show "/bin/sync") + (system*/show hdiutil "detach" mnt) + (delete-directory mnt)) + +(define (installer-dmg human-name dir-name) + (define dmg-name (format "bundle/~a-~a.dmg" dir-name (system-library-subpath #f))) + (make-dmg human-name "bundle/racket" dmg-name bg-image) + dmg-name) diff --git a/pkgs/distro-build/installer-exe.rkt b/pkgs/distro-build/installer-exe.rkt @@ -0,0 +1,416 @@ +#lang at-exp racket/base +(require racket/format + racket/list + racket/system + racket/path + racket/runtime-path + setup/getinfo) + +(provide installer-exe) + +(define-runtime-path installer-dir "windows-installer") + +(define (get-exe-actions src-dir filename combine) + (define f (build-path src-dir "lib" filename)) + (for/list ([(k v) (if (file-exists? f) + (call-with-input-file* f read) + (hash))]) + (combine k v))) + +(define (get-extreg src-dir) + (apply + append + (get-exe-actions src-dir "extreg.rktd" + (lambda (k v) + (for/list ([v (in-list v)]) + (append v (list k))))))) + +(define (get-startmenu src-dir) + (get-exe-actions src-dir "startmenu.rktd" + (lambda (k v) k))) + +(define (try-exe f) + (and (file-exists? f) f)) + +(define (nsis-generate dest distname version winplatform + makensis + #:extension-registers [extregs null] + #:start-menus [startmenus null] + #:release [release? #t] + #:simple? [simple? #f] + #:auto-launch [auto-launch #f]) + (define distdir (regexp-replace* #rx" " distname "-")) + (define destfilename (file-name-from-path dest)) + (define-values (version1 version2 version3 version4) + (apply + values + (take (cdr (regexp-match #rx"^([0-9]*)[.]([0-9]*)[.]([0-9]*)[.]([0-9]*)" + (string-append version ".0.0.0"))) + 4))) + (define got-files (make-hash)) + (define (get-file s) + (unless (hash-ref got-files s #f) + (define dest (build-path "bundle" s)) + (unless (file-exists? dest) + (hash-set! got-files s #t) + (copy-file (build-path installer-dir s) dest))) + s) + (define script + @~a{ +!include "MUI2.nsh" +!include "WinVer.nsh" +!include "nsDialogs.nsh" + +;; ==================== Configuration + +!define RKTVersion "@|version|" +!define RKTVersionLong "@|version1|.@|version2|.@|version3|.@|version4|" +;; Full name for the package, and a short name for installer texts +!define RKTHumanName "@|distname| v@|version| (@|winplatform|)" +!define RKTShortName "@|distname|" +!define RKTStartName "@|distname|@(if release? "" @~a{ v@|version|})" +!define RKTDirName "@|distdir|@(if release? "" @~a{-@|version|})" +!define RKTRegName "@|distdir|-@|winplatform|-@|version|" +!define RKTProgFiles "$PROGRAMFILES@(if (equal? winplatform "x86_64") "64" "")" +@(if simple? @~a{!define SimpleInstaller} "") +@(if auto-launch @~a{!define RKTLaunchProgram "@|auto-launch|"} "") + +Name "${RKTHumanName}" +OutFile "@|destfilename|" + +BrandingText "${RKTHumanName}" +BGGradient 4040A0 101020 + +SetCompressor /SOLID "LZMA" + +InstallDir "${RKTProgFiles}\${RKTDirName}" +!ifndef SimpleInstaller + InstallDirRegKey HKLM "Software\${RKTRegName}" "" +!endif +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${RKTStartName}" +!define MUI_ICON "@(get-file "installer.ico")" +!define MUI_UNICON "@(get-file "uninstaller.ico")" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP "@(get-file "header.bmp")" +!define MUI_HEADERIMAGE_BITMAP_RTL "@(get-file "header-r.bmp")" +!define MUI_HEADERIMAGE_RIGHT + +!define MUI_WELCOMEFINISHPAGE_BITMAP "@(get-file "welcome.bmp")" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "@(get-file "welcome.bmp")" + +!define MUI_WELCOMEPAGE_TITLE "${RKTHumanName} Setup" +!define MUI_UNWELCOMEPAGE_TITLE "${RKTHumanName} Uninstall" +!ifdef SimpleInstaller + !define MUI_WELCOMEPAGE_TEXT "This is a simple installer for ${RKTShortName}.$\r$\n$\r$\nIt will only create the @|distname| 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 ${RKTShortName}.$\r$\n$\r$\nPlease close any running Racket applications so the installer can update the relevant system files.$\r$\n$\r$\n$_CLICK" +!endif +!define MUI_UNWELCOMEPAGE_TEXT "This wizard will guide you through the removal of ${RKTShortName}.$\r$\n$\r$\nBefore starting, make sure no Racket applications are running.$\r$\n$\r$\n$_CLICK" + +!define MUI_FINISHPAGE_TITLE "${RKTHumanName}" +!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" +@(if auto-launch + @~a{ + !else + !define MUI_FINISHPAGE_RUN "$INSTDIR\${RKTLaunchProgram}.exe" + !define MUI_FINISHPAGE_RUN_TEXT "Run ${RKTLaunchProgram}"} + "") +!endif +!define MUI_FINISHPAGE_LINK "Visit the Racket web site" +!define MUI_FINISHPAGE_LINK_LOCATION "http://racket-lang.org/" + +; !define MUI_UNFINISHPAGE_NOAUTOCLOSE ; to allow users see what was erased + +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${RKTRegName}" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" + +; Doesn't work on some non-xp machines +; !define MUI_INSTFILESPAGE_PROGRESSBAR colored + +VIProductVersion "${RKTVersionLong}" +VIAddVersionKey "ProductName" "Racket" +VIAddVersionKey "Comments" "This is the Racket language, see http://racket-lang.org/." +VIAddVersionKey "CompanyName" "PLT Design Inc." +VIAddVersionKey "LegalCopyright" "© PLT Design Inc." +VIAddVersionKey "FileDescription" "Racket Installer" +VIAddVersionKey "FileVersion" "${RKTVersion}" + +;; ==================== 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 Racket + ; 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\Racket.exe" racket_is_installed + @(if auto-launch @~a{IfFileExists "$INSTDIR\${RKTLaunchProgram}.exe" racket_is_installed} "") + IfFileExists "$INSTDIR\collects" racket_is_installed + IfFileExists "$INSTDIR\lib\collects" racket_is_installed + Goto racket_is_not_installed + racket_is_installed: + IfFileExists "${UNINSTEXE}" we_have_uninstall + MessageBox MB_YESNO "It appears that there is an existing Racket 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 Racket 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\Racket.exe" uninstaller_problematic + BringToFront + Goto racket_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 racket_is_not_installed + RMDir /r $INSTDIR + racket_is_not_installed: +FunctionEnd +!endif + +Section "" + SetShellVarContext all + + SetDetailsPrint both + DetailPrint "Installing Racket..." + SetDetailsPrint listonly + SetOutPath "$INSTDIR" + File /a /r "racket\*.*" + !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" + @apply[~a + #:separator "\n" + (for/list ([exe-str (in-list startmenus)]) + (define exe exe-str) + (define lnk (path->string (path-replace-suffix exe-str #".lnk"))) + @~a{ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\@|lnk|" "$INSTDIR\@|exe|"})] + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket.lnk" "$INSTDIR\Racket.exe" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Racket 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\${RKTRegName}" "" "$INSTDIR" ; Save folder location + @apply[~a + #:separator "\n" + (apply + append + (for/list ([extreg (in-list extregs)]) + (define kind (list-ref extreg 1)) + (define icon (list-ref extreg 3)) + (define cmd (list-ref extreg 4)) + (define exe-name (list-ref extreg 5)) + (append + (for/list ([ext (in-list (list-ref extreg 2))]) + @~a{ WriteRegStr HKCR ".@|ext|" "" "@|kind|"}) + (list + @~a{ WriteRegStr HKCR "@|kind|" "" "@(list-ref extreg 0)"} + @~a{ WriteRegStr HKCR "@|kind|\DefaultIcon" "" "$INSTDIR\lib\@|icon|"}) + (if cmd + (list + @~a{ WriteRegStr HKCR "@|kind|\shell\open\command" "" '"$INSTDIR\@|exe-name|" @|cmd|'}) + null))))] + ; Example, in case we want some things like this in the future + ; WriteRegStr HKCR "Racket.Document\shell\racket" "" "Run with Racket" + ; WriteRegStr HKCR "Racket.Document\shell\racket\command" "" '"$INSTDIR\Racket.exe" "-r" "%1"' + + WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "UninstallString" '"${UNINSTEXE}"' + WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayName" "${RKTHumanName}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayIcon" "$INSTDIR\DrRacket.exe,0" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "DisplayVersion" "${RKTVersion}" + ; used to also have "VersionMajor" & "VersionMinor" but looks like it's not needed + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "HelpLink" "http://racket-lang.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "URLInfoAbout" "http://racket-lang.org/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "Publisher" "PLT Design Inc." + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "NoModify" "1" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" "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\Racket.exe" racket_is_installed_un + IfFileExists "$INSTDIR\lib\GRacket.exe" racket_is_installed_un + @(if auto-launch @~a{IfFileExists "$INSTDIR\${RKTLaunchProgram}.exe" racket_is_installed_un} "") + IfFileExists "$INSTDIR\lib\collects" racket_is_installed_un + MessageBox MB_YESNO "It does not appear that Racket is installed in '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" /SD IDYES IDYES racket_is_installed_un + Abort "Uninstall aborted by user" + racket_is_installed_un: +FunctionEnd + +Section "Uninstall" + SetShellVarContext all + + SetDetailsPrint both + DetailPrint "Removing the Racket installation..." + SetDetailsPrint listonly + Delete "$INSTDIR\*.exe" + Delete "$INSTDIR\README*.*" + RMDir /r "$INSTDIR\include" + RMDir /r "$INSTDIR\lib" + RMDir /r "$INSTDIR\etc" + RMDir /r "$INSTDIR\doc" + ;; these exist in Racket-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 Racket installation at '$INSTDIR' was not completely removed.$\r$\nForce deletion?$\r$\n(Make sure no Racket 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\${RKTRegName}\Start Menu Folder" + DeleteRegKey /ifempty HKLM "Software\${RKTRegName}" + @apply[~a + #:separator "\n" + (append + (for*/list ([extreg (in-list extregs)] + [ext (in-list (list-ref extreg 2))]) + @~a{ DeleteRegKey HKCR ".@|ext|"}) + (for/list ([extreg (in-list extregs)]) + @~a{ DeleteRegKey HKCR ".@(list-ref extreg 1)"}))] + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${RKTRegName}" + + SetDetailsPrint both + DetailPrint "Uninstallation complete." +SectionEnd + +!endif +}) + (call-with-output-file* + "bundle/installer.nsi" + #:mode 'text + #:exists 'truncate + (lambda (o) + (display script o) + (newline o))) + (parameterize ([current-directory "bundle"]) + (system* makensis "/V3" "installer.nsi"))) + +(define (installer-exe human-name dir-name release?) + (define makensis (or (find-executable-path "makensis.exe") + (try-exe "c:\\Program Files\\NSIS\\makensis.exe") + (try-exe "c:\\Program Files (x86)\\NSIS\\makensis.exe") + (error 'installer-exe "cannot find \"makensis.exe\""))) + (define platform (let-values ([(base name dir?) (split-path (system-library-subpath #f))]) + (path->string name))) + (define exe-path (format "bundle/~a-win32-~a.exe" dir-name platform)) + (nsis-generate exe-path + human-name + (version) + platform + makensis + #:release release? + #:extension-registers (get-extreg "bundle/racket") + #:start-menus (get-startmenu "bundle/racket")) + exe-path) diff --git a/pkgs/distro-build/installer-sh.rkt b/pkgs/distro-build/installer-sh.rkt @@ -0,0 +1,78 @@ +#lang at-exp racket/base +(require racket/system + racket/file + racket/port + racket/format + racket/runtime-path + file/tar) + +(provide installer-sh) + +(define-runtime-path installer-header "unix-installer/installer-header") + +(define (system/show . l) + (displayln (apply ~a #:separator " " l)) + (unless (apply system* (find-executable-path (car l)) (cdr l)) + (error "failed"))) + +(define (system/read . l) + (displayln (apply ~a #:separator " " l)) + (define o (open-output-bytes)) + (parameterize ([current-output-port o]) + (apply system* (find-executable-path (car l)) (cdr l))) + (read (open-input-bytes (get-output-bytes o)))) + +(define (count-lines i) + (if (input-port? i) + (for/sum ([l (in-lines i)]) 1) + (call-with-input-file* i count-lines))) + +(define (generate-installer-sh src-dir dest target-dir-name human-name release?) + (system/show "chmod" + "-R" "g+w" src-dir) + (define tmp-tgz (make-temporary-file "~a.tgz")) + (delete-file tmp-tgz) + (printf "Tarring to ~s\n" tmp-tgz) + (parameterize ([current-directory src-dir]) + (apply tar-gzip tmp-tgz (directory-list))) + (define tree-size (system/read "du" "-hs" src-dir)) + (define archive-cksum (system/read "cksum" tmp-tgz)) + (define script + @~a{#!/bin/sh + + # This is a self-extracting shell script for @|human-name|. + # To use it, just run it, or run "sh" with it as an argument. + + DISTNAME="@|human-name|" + TARGET="@|target-dir-name|" + BINSUM="@|archive-cksum|" + ORIGSIZE="@|tree-size|" + RELEASED="@(if release? "yes" "no")"}) + (define installer-lines (+ (count-lines (open-input-string script)) + (count-lines installer-header) + 2)) + (call-with-output-file* + dest + #:exists 'truncate + (lambda (o) + (display script o) + (newline o) + (fprintf o "BINSTARTLINE=\"~a\"\n" installer-lines) + (call-with-input-file* + installer-header + (lambda (i) + (copy-port i o))) + (call-with-input-file* + tmp-tgz + (lambda (i) + (copy-port i o))))) + (system/show "chmod" "+x" dest) + (delete-file tmp-tgz)) + +(define (installer-sh human-name dir-name release?) + (define sh-path (format "bundle/~a-~a.sh" dir-name (system-library-subpath #f))) + (generate-installer-sh "bundle/racket" sh-path + dir-name human-name + release?) + sh-path) + diff --git a/pkgs/distro-build/installer.rkt b/pkgs/distro-build/installer.rkt @@ -0,0 +1,31 @@ +#lang racket/base +(require racket/cmdline + "installer-sh.rkt" + "installer-dmg.rkt" + "installer-exe.rkt") + +(define release? #f) + +(define-values (short-human-name human-name dir-name) + (command-line + #:once-each + [("--release") "Create a release installer" + (set! release? #t)] + #:args + (human-name dir-name) + (values human-name + (format "~a v~a" human-name (version)) + (if release? + dir-name + (format "~a-~a" dir-name (version)))))) + +(define installer-file + (case (system-type) + [(unix) (installer-sh human-name dir-name release?)] + [(macosx) (installer-dmg human-name dir-name)] + [(windows) (installer-exe short-human-name dir-name release?)])) + +(call-with-output-file* + (build-path "bundle" "installer.txt") + #:exists 'truncate/replace + (lambda (o) (fprintf o "~a\n" installer-file))) diff --git a/collects/meta/build/dmg/racket-rising.png b/pkgs/distro-build/macosx-installer/racket-rising.png Binary files differ. diff --git a/pkgs/distro-build/pack-built.rkt b/pkgs/distro-build/pack-built.rkt @@ -0,0 +1,49 @@ +#lang racket/base +(require pkg + pkg/lib + racket/format + net/url + racket/set + racket/file + openssl/sha1 + racket/cmdline) + +(define create-mode 'built) + +(command-line + #:once-each + [("--mode") mode "Create package archives for <mode>" + (set! create-mode (string->symbol mode))] + #:args () + (void)) + +(define build-dir "build") +(define dest-dir (build-path build-dir (~a create-mode))) +(define native-dir (build-path build-dir "native" "pkgs")) +(define pkg-dest-dir (path->complete-path (build-path dest-dir "pkgs"))) +(define catalog-dir (build-path dest-dir "catalog" "pkg")) +(make-directory* pkg-dest-dir) +(make-directory* catalog-dir) + +(for ([pkg (in-list (installed-pkg-names))]) + (define native-zip (build-path native-dir (path-add-suffix pkg ".zip"))) + (unless (file-exists? native-zip) + (define dest-zip (build-path pkg-dest-dir (~a pkg ".zip"))) + (pkg-create 'zip pkg + #:source 'name + #:dest pkg-dest-dir + #:mode create-mode) + (call-with-output-file* + (build-path catalog-dir pkg) + #:exists 'truncate + (lambda (o) + (write (hash 'source (path->string dest-zip) + 'checksum (call-with-input-file* dest-zip sha1) + 'name pkg + 'author "plt@racket-lang.org" + 'description "library" + 'tags '() + 'dependencies '() + 'modules '()) + o) + (newline o))))) diff --git a/pkgs/distro-build/pack-collects.rkt b/pkgs/distro-build/pack-collects.rkt @@ -0,0 +1,19 @@ +#lang racket/base +(require file/tar + file/gzip + racket/file) + +(define origin-dir (build-path "build" "origin")) + +(make-directory* origin-dir) + +(define tgz-file + (path->complete-path (build-path origin-dir "collects.tgz"))) + +(when (file-exists? tgz-file) + (delete-file tgz-file)) + +(parameterize ([current-directory (build-path "racket/lib")]) + (tar-gzip tgz-file "collects")) + + +\ No newline at end of file diff --git a/pkgs/distro-build/serve-catalog.rkt b/pkgs/distro-build/serve-catalog.rkt @@ -0,0 +1,81 @@ +#lang racket/base +(require web-server/servlet-env + web-server/dispatch + web-server/http/response-structs + web-server/http/request-structs + net/url + racket/format + racket/cmdline) + +(define from-dir "built") + +(command-line + #:once-each + [("--mode") dir "Serve package archives from <dir> subdirectory" + (set! from-dir dir)] + #:args () + (void)) + + +(define build-dir (path->complete-path "build")) +(define built-dir (build-path build-dir from-dir)) +(define native-dir (build-path build-dir "native")) + +(define dirs (list built-dir native-dir)) + +(define (pkg-name->info req name) + (define (extract-host-header sel) + (for/or ([h (in-list (request-headers/raw req))]) + (and (equal? (header-field h) #"Host") + (let ([m (regexp-match #rx#"^(.*):([0-9]+)$" + (header-value h))]) + (and m + (sel (list (bytes->string/utf-8 (cadr m)) + (string->number (bytes->string/utf-8 (caddr m)))))))))) + (for/or ([d (in-list dirs)]) + (define f (build-path d "catalog" "pkg" name)) + (and (file-exists? f) + (let ([h (call-with-input-file* + f + read)]) + (define s (hash-ref h 'source)) + (hash-set h + 'source + (url->string + (url "http" + #f + (or (extract-host-header car) + (let ([h (request-host-ip req)]) + (if (equal? h "::1") + "localhost" + h))) + (or (extract-host-header cadr) + (request-host-port req)) + #t + (list (path/param (~a name ".zip") null)) + null + #f))))))) + +(define (response/sexpr v) + (response 200 #"Okay" (current-seconds) + #"text/s-expr" null + (λ (op) (write v op)))) + +(define (write-info req pkg-name) + (response/sexpr (pkg-name->info req pkg-name))) + +(define-values (dispatch main-url) + (dispatch-rules + [("pkg" (string-arg)) write-info])) + +(serve/servlet + dispatch + #:command-line? #t + #:listen-ip #f + #:extra-files-paths + (cons + (build-path build-dir "origin") + (for/list ([d (in-list dirs)]) + (path->complete-path (build-path d "pkgs")))) + #:servlet-regexp #rx"" + #:port 9440) diff --git a/pkgs/distro-build/unix-installer/installer-header b/pkgs/distro-build/unix-installer/installer-header @@ -0,0 +1,402 @@ + +############################################################################### +## Utilities + +PATH=/usr/bin:/bin + +if test "x`echo -n`" = "x-n"; then + echon() { /bin/echo "$*\c"; } +else + echon() { echo -n "$*"; } +fi + +rm_on_abort="" +failwith() { + err="Error: " + if test "x$1" = "x-noerror"; then err=""; shift; fi + echo "$err$*" 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 +} +# intentional aborts +abort() { failwith -noerror "Aborting installation."; } +# unexpected exits +exithandler() { echo ""; failwith "Aborting..."; } + +trap exithandler 2 3 9 15 + +lookfor() { + saved_IFS="${IFS}" + IFS=":" + for dir in $PATH; do + if test -x "$dir/$1"; then + eval "$1=$dir/$1" + IFS="$saved_IFS" + return + fi + done + IFS="$saved_IFS" + failwith "could not find \"$1\"." +} + +lookfor rm +lookfor ls +lookfor ln +lookfor tail +lookfor cksum +lookfor tar +lookfor gunzip +lookfor mkdir +lookfor basename +lookfor dirname + +# substitute env vars and tildes +expand_path_var() { + eval "expanded_val=\"\$$1\"" + first_part="${expanded_val%%/*}" + if [ "x$first_part" = "x$expanded_val" ]; then + rest_parts="" + else + rest_parts="/${expanded_val#*/}" + fi + case "x$first_part" in + x*" "* ) ;; + x~* ) expanded_val="`eval \"echo $first_part\"`$rest_parts" ;; + esac + eval "$1=\"$expanded_val\"" +} + +# 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 + +origwd="`pwd`" +installer_file="$0" +cat_installer() { + oldwd="`pwd`"; cd "$origwd" + "$tail" +"$BINSTARTLINE" "$installer_file" + cd "$oldwd" +} + +echo "This program will extract and install $DISTNAME." +echo "" +echo "Note: the required diskspace for this installation is $ORIGSIZE." +echo "" + +############################################################################### +## What kind of installation? + +echo "Do you want a Unix-style distribution?" +echo " In this distribution mode files go into different directories according" +echo " to Unix conventions. A \"racket-uninstall\" script will be generated" +echo " to be used when you want to remove the installation. If you say 'no'," +echo " the whole Racket directory is kept in a single installation directory" +echo " (movable and erasable), possibly with external links into it -- this is" +echo " often more convenient, especially if you want to install multiple" +echo " versions or keep it in your home directory." +if test ! "x$RELEASED" = "xyes"; then + echo "*** This is a non-release build: such a Unix-style distribution is NOT" + echo "*** recommended, because it cannot be used to install multiple versions" + echo "*** in the default location." +fi +unixstyle="x" +while test "$unixstyle" = "x"; do + echon "Enter yes/no (default: no) > " + read unixstyle + case "$unixstyle" in + [yY]* ) unixstyle="Y" ;; + [nN]* ) unixstyle="N" ;; + "" ) unixstyle="N" ;; + * ) unixstyle="x" ;; + esac +done +echo "" + +############################################################################### +## Where do you want it? +## sets $where to the location: target path for wholedir, prefix for unixstyle + +if test "$unixstyle" = "Y"; then + echo "Where do you want to base your installation of $DISTNAME?" + echo " (If you've done such an installation in the past, either" + echo " enter the same directory, or run 'racket-uninstall' manually.)" + 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 - ~/$TARGET1 ($HOME/$TARGET1)" +echo " 4 - ./$TARGET1 (here)" +if test "$unixstyle" = "Y"; then + echo " Or enter a different directory prefix to install in." +else + echo " Or enter a different \"racket\" directory to install in." +fi +echon "> " +read where + +# numeric choice (make "." and "./" synonym for 4) +if test "$unixstyle" = "Y"; then TARGET1="" +else TARGET1="/$TARGET"; fi +case "x$where" in + x | x1 ) where="/usr$TARGET1" ;; + x2 ) where="/usr/local${TARGET1}" ;; + x3 ) where="${HOME}${TARGET1}" ;; + x4 | x. | x./ ) where="`pwd`${TARGET1}" ;; + * ) expand_path_var where ;; +esac + +############################################################################### +## Default system directories prefixed by $1, mimic configure behavior +## used for unixstyle targets and for wholedir links + +set_dirs() { + # unixstyle: uses all of these + # wholedir: uses only bindir & mandir, no need for the others + bindir="$1/bin" + libdir="$1/lib" + incrktdir="$1/include/$TARGET" + librktdir="$1/lib/$TARGET" + configdir="$1/etc/$TARGET" + has_share="N" + if test -d "$1/share"; then has_share="Y"; fi + if test "$has_share" = "N" && test -d "$1/doc"; then docdir="$1/doc/$TARGET" + else docdir="$1/share/$TARGET/doc" + fi + if test "$has_share" = "N" && test -d "$1/man"; then mandir="$1/man" + else mandir="$1/share/man" + fi +} + +############################################################################### +## Integrity check and unpack into $1 +## also sets $INSTDIR to the directory in its canonical form + +unpack_installation() { + T="$1" + # integrity check + echo "" + echon "Checking the integrity of the binary archive... " + SUM="`cat_installer | \"$cksum\"`" || failwith "problems running cksum." + SUM="`set $SUM; echo $1`" + test "$BINSUM" = "$SUM" || failwith "bad CRC checksum." + echo "ok." + # test that the target does not exists + here="N" + if test -d "$T" || test -f "$T"; then + if test -d "$T" && test -x "$T"; then + # use the real name, so "/foo/.." shows as an explicit "/" + oldwd="`pwd`"; cd "$T"; T="`pwd`"; cd "$oldwd" + fi + if test -f "$T"; then echon "\"$T\" exists (as a file)" + elif test ! "`pwd`" = "$T"; then echon "\"$T\" exists" + else here="Y"; echon "\"$T\" is where you ran the installer from" + fi + echon ", delete? " + read R + case "$R" in + [yY]* ) + echon "Deleting old \"$T\"... " + "$rm" -rf "$T" || failwith "could not delete \"$T\"." + echo "done." + ;; + * ) abort ;; + esac + fi + # unpack + rm_on_abort="$T" + "$mkdir" -p "$T" || failwith "could not create directory: $T" + if test "$here" = "Y"; then + cd "$T"; INSTDIR="$T" + echo "*** Note: your original directory was deleted, so you will need" + echo "*** to 'cd' back into it when the installer is done, otherwise" + echo "*** it will look like you have an empty directory." + sleep 1 + else oldwd="`pwd`"; cd "$T"; INSTDIR="`pwd`"; cd "$oldwd" + fi + rm_on_abort="$INSTDIR" + echo "Unpacking into \"$INSTDIR\" (Ctrl+C to abort)..." + cat_installer | "$gunzip" -c \ + | { cd "$INSTDIR" + "$tar" xf - || failwith "problems during unpacking of binary archive." + } + test -d "$INSTDIR/lib/collects" \ + || failwith "unpack failed (could not find \"$T/lib/collects\")." + echo "Done." +} + +############################################################################### +## Whole-directory installations + +wholedir_install() { + + unpack_installation "$where" + rm_on_abort="" + + echo "" + echo "If you want to install new system links within the \"bin\" and" + echo " \"man\" subdirectories of a common directory prefix (for example," + echo " \"/usr/local\") then enter the prefix of an existing directory" + echo " that you want to use. This might overwrite existing symlinks," + echo " but not files." + echon "(default: skip links) > " + read SYSDIR + if test "x$SYSDIR" = "x"; then : + elif test ! -d "$SYSDIR"; then + echo "\"$SYSDIR\" does not exist, skipping links." + elif test ! -x "$SYSDIR" || test ! -w "$SYSDIR"; then + echo "\"$SYSDIR\" is not writable, skipping links." + else + oldwd="`pwd`"; cd "$SYSDIR"; SYSDIR="`pwd`"; cd "$oldwd" + set_dirs "$SYSDIR" + install_links() { # tgtdir(absolute) srcdir(relative to INSTDIR) + if ! test -d "$1"; then + echo "\"$1\" does not exist, skipping." + elif ! test -x "$1" || ! test -w "$1"; then + echo "\"$1\" is not writable, skipping" + else + echo "Installing links in \"$1\"..." + printsep=" " + cd "$1" + for x in `cd "$INSTDIR/$2"; ls`; do + echon "${printsep}$x"; printsep=", " + if test -h "$x"; then rm -f "$x"; fi + if test -d "$x" || test -f "$x"; then + echon " skipped (non-link exists)" + elif ! "$ln" -s "$INSTDIR/$2/$x" "$x"; then + echon " skipped (symlink failed)" + fi + done + echo ""; echo " done." + fi + } + install_links "$bindir" "bin" + install_links "$mandir/man1" "man/man1" + fi + +} + +############################################################################### +## Unix-style installations + +dir_createable() { + tdir="`\"$dirname\" \"$1\"`" + if test -d "$tdir" && test -x "$tdir" && test -w "$tdir"; then return 0 + elif test "$tdir" = "/"; then return 1 + else dir_createable "$tdir"; fi +} +show_dir_var() { + if test -f "$2"; then status="error: not a directory!"; err="Y" + elif test ! -d "$2"; then + if dir_createable "$2"; then status="will be created" + else status="error: not writable!"; err="Y"; fi + elif test ! -w "$2"; then status="error: not writable!"; err="Y" + else status="exists" + fi + echo " $1 $2 ($status)" +} + +unixstyle_install() { + + if test -f "$where"; then + failwith "The entered base directory exists as a file: $where" + elif test ! -d "$where"; then + echo "Base directory does not exist: $where" + echon " should I create it? (default: yes) " + read R; case "$R" in [nN]* ) abort ;; esac + "$mkdir" -p "$where" || failwith "could not create directory: $where" + elif test ! -w "$where"; then + failwith "The entered base directory is not writable: $where" + fi + cd "$where" || failwith "Base directory does not exist: $where" + where="`pwd`"; cd "$origwd" + + set_dirs "$where" + # loop for possible changes + done="N"; retry="N" + while test ! "$done" = "Y" || test "x$err" = "xY" ; do + err="N" + if test "$retry" = "N"; then + echo "" + echo "Target Directories:" + show_dir_var "[e] Executables " "$bindir" + show_dir_var "[o] Libraries " "$librktdir" + show_dir_var "[c] Configuration" "$configdir" + show_dir_var "[d] Documentation" "$docdir" + show_dir_var "[l] C Libraries " "$libdir" + show_dir_var "[h] C headers " "$incrktdir" + show_dir_var "[m] Man Pages " "$mandir" + echo "Enter a letter to change an entry, or enter to continue." + fi + retry="N" + echon "> "; read change_what + read_dir() { + echon "New directory (absolute or relative to $where): "; read new_dir + expand_path_var new_dir + case "$new_dir" in + "/"* ) eval "$1=\"$new_dir\"" ;; + * ) eval "$1=\"$where/$new_dir\"" ;; + esac + } + case "$change_what" in + [eE]* ) read_dir bindir ;; + [dD]* ) read_dir docdir ;; + [lL]* ) read_dir libdir ;; + [hH]* ) read_dir incrktdir ;; + [oO]* ) read_dir librktdir ;; + [cC]* ) read_dir configdir ;; + [mM]* ) read_dir mandir ;; + "" ) if test "$err" = "N"; then done="Y" + else echo "*** Please fix erroneous paths to proceed"; fi ;; + * ) retry="Y" ;; + esac + done + + if test -x "$bindir/racket-uninstall"; then + echo "" + echo "A previous Racket uninstaller is found at" + echo " \"$bindir/racket-uninstall\"," + echon " should I run it? (default: yes) " + read R + case "$R" in + [nN]* ) abort ;; + * ) echon " running uninstaller..." + "$bindir/racket-uninstall" || failwith "problems during uninstall" + echo " done." ;; + esac + fi + + tmp="$where/$TARGET-tmp-install" + if test -f "$tmp" || test -d "$tmp"; then + echo "\"$tmp\" already exists (needed for the installation)," + echon " ok to remove it? " + read R; case "$R" in [yY]* ) "$rm" -rf "$tmp" ;; * ) abort ;; esac + fi + unpack_installation "$tmp" + + cd "$where" + "$tmp/bin/racket" "$tmp/lib/collects/setup/unixstyle-install.rkt" \ + "move" "$tmp" "$bindir" "$librktdir/collects" "$docdir" "$libdir" \ + "$incrktdir" "$librktdir" "$configdir" "$mandir" \ + || failwith "installation failed" + +} + +############################################################################### +## Run the right installer now + +if test "$unixstyle" = "Y"; then unixstyle_install; else wholedir_install; fi + +echo "" +echo "Installation complete." + +exit + +========== tar.gz file follows ========== diff --git a/pkgs/distro-build/unpack-collects.rkt b/pkgs/distro-build/unpack-collects.rkt @@ -0,0 +1,30 @@ +#lang racket/base +(require racket/cmdline + racket/file + racket/port + net/url + file/untgz) + +(define dest-dir "bundle/racket") + +(define server + (command-line + #:args (server) + server)) + +(define zip-content + (port->bytes + (get-pure-port + (combine-url/relative + (string->url server) + "collects.tgz")))) + +(define lib-dir (build-path dest-dir "lib")) +(make-directory* lib-dir) + +(define collects-dir (build-path lib-dir "collects")) +(when (directory-exists? collects-dir) + (delete-directory/files collects-dir)) + +(untgz (open-input-bytes zip-content) + #:dest lib-dir) diff --git a/collects/meta/build/nsis/header-r.bmp b/pkgs/distro-build/windows-installer/header-r.bmp Binary files differ. diff --git a/collects/meta/build/nsis/header.bmp b/pkgs/distro-build/windows-installer/header.bmp Binary files differ. diff --git a/collects/meta/build/nsis/installer.ico b/pkgs/distro-build/windows-installer/installer.ico Binary files differ. diff --git a/collects/meta/build/nsis/uninstaller.ico b/pkgs/distro-build/windows-installer/uninstaller.ico Binary files differ. diff --git a/collects/meta/build/nsis/welcome.bmp b/pkgs/distro-build/windows-installer/welcome.bmp Binary files differ.