OS X installer deletes old versions, breaks symlinks
The .pkg installer for ghc removes previous versions of ghc and leaves broken stale symlinks in /usr/bin
The symlink issue can be fixed with a new create-links script, included. The old script links through the Current symlink, which is updated to point to the latest version. So every new install breaks the symlinks for the old one. The new script links through the version directory, so it doesn't get broken when Current changes.
There are other binaries which are unversioned, like hsc2hs and haddock. I guess this was a conscious decision so I didn't try to make versioned symlinks to those, they just get overwritten with the last installed version.
I also changed create-links to put a version on /usr/share/doc/ghc. I left the man pages unversioned because 'man ghc' should work.
The deletion problem is due to the fact that the OS X installer always wants to delete an old version when installing a new one. It makes more sense for a compiler to allow multiple concurrent versions. The way around this is to append the version to the package name (the python installer does this). Unfortunately, there are lots of places you can set the "bundle ID" and as far as I can tell no documentation for it. So based on trial and error, I appended the version to distrib/MacOS/Info.plist and the -i flag to packagemaker. Both seem to be necessary. I use the PackageVersionInt, so reinstalling a ghc with the same major and minor version but a different patchelevel will overwrite it, as before, which seems reasonable.
This means the Uninstaller isn't so useful, since it's designed to only work with a single installed version. I did a bit of work to extend it to remove a certain version, but decided it's not really worth it. OS X programmers don't generally have installers. The old uninstaller was also removing the incorrect package receipt (it removes org.haskell.glasgowHaskellCompiler.ghc.pkg.bom, which on my machine, is what
- 12.1 used, but not anything newer).
I reckon the simplest thing is to just remove the uninstaller (and update the doc in the installer to not mention it). If there are people who really like it, I can finish off my fancy uninstall one version thing.
I left the uninstaller but can remove it in a separate patch if people agree.
I also changed occurrences of 'org.haskell.glasgowHaskellCompiler.ghc.pkg' to 'org.haskell.ghc.pkg'. It doesn't seem to have any effect, but older versions named the package glasgowHaskellCompiler.ghc and it seems messy and confusing to have multiple versions of the same identifier around.
I tested these changes on my machine, and they seem to work fine, but it would be good to get a few more people to try it on their macs. After the changes, installing the new .pkg should create /Library/Receipts/boms/org.haskell.ghc.700.bom, and of course a Versions/700 and not overwrite any previous versions. GHC packages going forward should no longer overwrite each other.