Open randen opened 7 years ago
adding switches for all things sounds good.
Good, then we shall add switches for the currently-positional parameters, as well.
The new command line arguments:
>hptool.exe --X?
usage: hptool --info
hptool --help
hptool [args] [target...]
where target is one of:
build-all -- build everything (default)
build-source -- build the source tar ball
build-target -- build the target tree
build-product -- build the os specific installer
build-package-<pkg> -- build the package (name or name-ver)
build-local -- build the local GHC environment
build-website -- build the website
and args may be:
--X? Show command line flags and options.
--Xb=PATH Path to the cabal executable to use during build.
--Xc Perform a core-only HP build.
--Xf Perform a full HP build.
--Xg=TAR Path to the GHC distribution tarfile.
--Xh=TAR WINDOWS: Path to Haddock documentation tarfile.
--Xi Show details on packages are in this HP release.
--Xl=TAR WINDOWS: Path to GHC library docs tarfile.
--Xp=PDF WINDOWS: Path to the GHC User's Guide (PDF file).
--Xs=PATH Path to the stack installer or executable.
--Xu=TAR WINDOWS: Path to GHC User's Guide (HTML) tarfile.
--Xx=DIR Set a custom install prefix (only Posix builds).
NOTE:
The GHC binary distro, the cabal executable, and the
stack installer/executable are *required*.
Further, for the Windows platform, four additional
arguments are also required:
* the GHC Library documentation (tarfile)
* the GHC User's Guide (HTML format, tarfile)
* the GHC User's Guide (single PDF file)
* the Haddock documentation (HTML format, tarfile)
Most of these are for the Windows builds, but the main ones will affect the other platforms. Here is an example for building Windows 64-bit core HP:
./windows-platform.sh --Xc --Xg ../../haskell/ghc-8.4.3/x86_64/ghc-8.4.3-x86_64-unknown-mingw32.tar --Xb ../../haskell/ghc-8.4.3/x86_64/cabal-install-2.2.0.0-x86_64-unknown-mingw32/cabal.exe --Xs ../../haskell/ghc-8.4.3/x86_64/stack-1.7.1-windows-x86_64-installer.exe --Xh ../../haskell/ghc-8.4.3/haddock.html.tar --Xl ../../haskell/ghc-8.4.3/libraries.html.tar --Xu ../../haskell/ghc-8.4.3/users_guide.html.tar --Xp ../../haskell/ghc-8.4.3/users_guide.pdf -VV -j6 2>&1 | tee hptool.txt
Background:
The Windows build of Haskell Platform has always used some static (but relative to the build) directory locations for ghc documentation, which itself is due to the fact that we do not build ghc for the Windows HP but instead use a pre-built archive (which does not include all the documentation). The hptool continued that tradition of using the static locations. Well, that has bit us on a couple of releases, when I forgot to manually update those directories with the latest docs.
We should add some additional command line switches, applicable to the Windows version of the hptool, which will be used to designate archive files for the ghc docs.
There are 4 files needed:
Uncompressing and untarring these additional archives will take a more execution time for hptool when building HP releases.
Another thing to note is that the hptool currently uses some positional arguments for the ghc archive, stack installer, and the cabal executable. Rather than continue this positional parameters (which is a bit unsafe and might result, e.g., in the cabal and stack files being swapped), I will at least add switches for the new pieces needed for Windows. I could make switches for the other 3 which are currently positional, but it would mean hptool user's would need to change their scripts or hand-written notes, etc.
The changes visible to the hptool user would be these switches. Internally, the Windows specifics in the hptool would need to add to the configuration to store these new parameters, rules to do the uncompression and untarring, and a place to invoke those rules (within an existing rule that allows build platform-specific behavior).