|
| 1 | ++++ |
| 2 | +title = "What's new in Cabal/cabal-install 2.0" |
| 3 | +date = 2017-09-11 |
| 4 | +[taxonomies] |
| 5 | +authors = ["23Skidoo"] |
| 6 | +categories = ["Cabal"] |
| 7 | +tags = ["Announcement"] |
| 8 | ++++ |
| 9 | + |
| 10 | +This release brings improved new-build, Backpack and foreign libraries. |
| 11 | + |
| 12 | +<!-- more --> |
| 13 | + |
| 14 | +A couple of weeks ago we've quietly released versions 2.0 of both |
| 15 | +Cabal and `cabal-install` after approximately a year of |
| 16 | +development. The 2.0 release incorporates more than 1500 commits by |
| 17 | +[64 different |
| 18 | +contributors](https://gist.github.com/23Skidoo/7109479c43a8de44f8e29fa335e9645c). This |
| 19 | +post serves as a formal release announcement and describes what's new |
| 20 | +and improved in version 2.0. |
| 21 | + |
| 22 | +There is a number of backwards-incompatible Cabal library API changes |
| 23 | +in this release that affect packages with Custom setup |
| 24 | +scripts. Therefore `cabal-install` will by default use a previous |
| 25 | +version of Cabal to build setup scripts that don't [explicitly declare |
| 26 | +compatibility with Cabal |
| 27 | +2.0](https://www.well-typed.com/blog/2015/07/cabal-setup-deps/). The |
| 28 | +[2.0 migration |
| 29 | +guide](https://github.com/haskell/cabal/wiki/2.0-migration-guide) |
| 30 | +gives advice for package authors on how to adapt Custom setup scripts |
| 31 | +to backwards-incompatible changes in this release. |
| 32 | + |
| 33 | +## Major new features |
| 34 | + |
| 35 | +- Much improved [`new-build` |
| 36 | + feature](https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html) |
| 37 | + (also known as nix-style local builds), that solves many |
| 38 | + long-standing problems and is going to become the default mode of |
| 39 | + operation of `cabal-install` in version 3.0 (tentative release date: |
| 40 | + Autumn 2018). Killer features of `new-build` are reproducible |
| 41 | + isolated builds with global dependency caching and multi-package |
| 42 | + projects. For a more extensive introduction to `new-build`, see |
| 43 | + [this blog post by Edward |
| 44 | + Z. Yang](http://blog.ezyang.com/2016/05/announcing-cabal-new-build-nix-style-local-builds/). |
| 45 | + |
| 46 | +- Support for Backpack, a new system for mix-in packages. See [this |
| 47 | + article by Edward |
| 48 | + Z. Yang](https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst) |
| 49 | + for an introduction to Backpack and its features. |
| 50 | + |
| 51 | +- Native suport for [foreign |
| 52 | + libraries](https://github.com/haskell/cabal/pull/2540): Haskell |
| 53 | + libraries that are intended to be used by non-Haskell code. See |
| 54 | + [this section of the user |
| 55 | + guide](https://www.haskell.org/cabal/users-guide/developing-packages.html#foreign-libraries) |
| 56 | + for an introduction to this feature. |
| 57 | + |
| 58 | +- Convenience/internal libraries are now supported |
| 59 | + ([#269](https://github.com/haskell/cabal/issues/269)). An internal |
| 60 | + library is declared using the stanza `library 'libname'` and can be |
| 61 | + only used by other components inside a package. |
| 62 | + |
| 63 | +- Package components can be now built and installed in parallel. This |
| 64 | + is especially handy when compiling packages with large numbers of |
| 65 | + independent components (usually those are executables). As a |
| 66 | + consequence, the `Setup.hs` command-line interface [now allows to |
| 67 | + specify the component to be |
| 68 | + configured](https://github.com/ghc-proposals/ghc-proposals/pull/4). |
| 69 | + |
| 70 | +- [Nix package manager integration](https://www.haskell.org/cabal/users-guide/nix-integration.html) |
| 71 | + ([#3651](https://github.com/haskell/cabal/issues/3651)). |
| 72 | + |
| 73 | +- [New `cabal-install` command: `outdated`](https://www.haskell.org/cabal/users-guide/developing-packages.html?highlight=outdated#listing-outdated-dependency-version-bounds), for listing outdated |
| 74 | + version bounds in a `.cabal` file or a freeze file |
| 75 | + ([#4201](https://github.com/haskell/cabal/issues/4207)). Work on |
| 76 | + this feature was sponsored by [Scrive AB](https://scrive.com/). |
| 77 | + |
| 78 | +- [New `cabal-install` command |
| 79 | + `reconfigure`](https://www.haskell.org/cabal/users-guide/installing-packages.html?highlight=reconfigure), |
| 80 | + which re-runs `configure` with the most recently used flags |
| 81 | + ([#2214](https://github.com/haskell/cabal/issues/2214)). |
| 82 | + |
| 83 | +- Package repos are now assumed to be `hackage-security`-enabled by |
| 84 | + default. If a `remote-repo` section in `~/.cabal/config` doesn't |
| 85 | + have an explicit `secure` field, it now defaults to `secure: True`, |
| 86 | + unlike in `cabal-install` 1.24. See [this post on the Well-Typed |
| 87 | + blog](https://www.well-typed.com/blog/2015/04/improving-hackage-security/) |
| 88 | + for an introduction to `hackage-security` and what benefits it |
| 89 | + brings. |
| 90 | + |
| 91 | +- New caret-style version range operator `^>=` |
| 92 | + ([#3705](https://github.com/haskell/cabal/issues/3705)) that is |
| 93 | + equivalent to `>=` intersected with an automatically inferred major |
| 94 | + upper bound. For example, `foo ^>= 1.3.1` is equivalent to `foo >= |
| 95 | +1.3.1 && < 1.4`. Besides being a convenient syntax sugar, `^>=` |
| 96 | + allows to distinguish "strong" and "weak" upper bounds: `foo >= |
| 97 | +1.3.1 && < 1.4` means "I know for sure that my package doesn't work |
| 98 | + with `foo-1.4`", while `foo ^>= 1.3.1` means "I don't know whether |
| 99 | + `foo-1.4`, which is not out yet, will break my package, but I want |
| 100 | + to be cautious and follow [PVP](https://pvp.haskell.org/)". In the |
| 101 | + future, this feature will allow to implement automatic version |
| 102 | + bounds relaxation in a formally sound way (work on this front is |
| 103 | + progressing on |
| 104 | + [`matrix.hackage.haskell.org`](https://matrix.hackage.haskell.org/)). See |
| 105 | + [this section of the |
| 106 | + manual](https://www.haskell.org/cabal/users-guide/developing-packages.html?highlight=caret#pkg-field-build-depends) |
| 107 | + for more information. |
| 108 | + |
| 109 | +- Changed `cabal upload` to upload a package candidate by default |
| 110 | + ([#3419](https://github.com/haskell/cabal/issues/3419)). Same |
| 111 | + applies to uploading documentation. Also added a new `cabal upload` |
| 112 | + flag `--publish` for publishing a package on Hackage instead of |
| 113 | + uploading a candidate |
| 114 | + ([#3419](https://github.com/haskell/cabal/issues/3419)). |
| 115 | + |
| 116 | +- [Support for |
| 117 | + `--allow-older`](https://www.haskell.org/cabal/users-guide/nix-local-build.html?highlight=allow%20older#cfg-flag---allow-older) |
| 118 | + (dual to `--allow-newer`) |
| 119 | + ([#3466](https://github.com/haskell/cabal/issues/3466)). |
| 120 | + |
| 121 | +- [New `build-tool-depends` |
| 122 | + field](https://www.haskell.org/cabal/users-guide/developing-packages.html?highlight=build%20tool%20depends#pkg-field-build-tool-depends) |
| 123 | + that replaces `build-tools` and has a better defined semantics |
| 124 | + ([#3708](https://github.com/haskell/cabal/issues/3708), |
| 125 | + [#1541](https://github.com/haskell/cabal/issues/1541)). `cabal-install` |
| 126 | + will now install required build tools and add them to PATH |
| 127 | + automatically. |
| 128 | + |
| 129 | +- [New `autogen-modules` |
| 130 | + field](https://www.haskell.org/cabal/users-guide/developing-packages.html?highlight=autogen%20modules#pkg-field-custom-setup-autogen-modules) |
| 131 | + for automatically generated modules (like `Paths_PACKAGENAME`) that |
| 132 | + are not distributed inside the package tarball |
| 133 | + ([#3656](https://github.com/haskell/cabal/issues/3656)). |
| 134 | + |
| 135 | +- [Added a new `scope` |
| 136 | + field](https://www.haskell.org/cabal/users-guide/developing-packages.html?highlight=scope#pkg-field-executable-scope) |
| 137 | + to the `executable` stanza |
| 138 | + ([#3461](https://github.com/haskell/cabal/issues/3461)). Executable |
| 139 | + scope can be either `public` or `private`; private executables are |
| 140 | + those that are expected to be run by other programs rather than |
| 141 | + users and get installed into |
| 142 | + `$libexecdir/$libexecsubdir`. Additionally, `$libexecdir` now has a |
| 143 | + subdir structure similar to `$lib(sub)dir` to allow installing |
| 144 | + private executables of different packages and package versions |
| 145 | + alongside one another. |
| 146 | + |
| 147 | +- New `--index-state` flag for requesting a specific version of |
| 148 | + the package index |
| 149 | + ([#3893](https://github.com/haskell/cabal/issues/3893), |
| 150 | + [#4115](https://github.com/haskell/cabal/issues/4115)). |
| 151 | + |
| 152 | +- Added `CURRENT_PACKAGE_VERSION` CPP constant to `cabal_macros.h` |
| 153 | + ([#4319](https://github.com/haskell/cabal/issues/4319)). |
| 154 | + |
| 155 | +## Minor improvements and bug fixes |
| 156 | + |
| 157 | +- Dropped support for versions of GHC earlier than 6.12 |
| 158 | + ([#3111](https://github.com/haskell/cabal/issues/3111)). Also, GHC |
| 159 | + compatibility window for the Cabal library has been extended to five |
| 160 | + years ([#3838](https://github.com/haskell/cabal/issues/3838)). |
| 161 | + |
| 162 | +- Added a technical preview version of the 'cabal doctest' command |
| 163 | + ([#4480](https://github.com/haskell/cabal/issues/4480)). |
| 164 | + |
| 165 | +- Cabal now invokes GHC with `-Wmissing-home-modules`, if that flag is |
| 166 | + supported (added in version 8.2). This means that you'll get a |
| 167 | + warning if you forget to list a module in `other-modules` or |
| 168 | + `exposed-modules` |
| 169 | + ([#4254](https://github.com/haskell/cabal/pull/4254)). |
| 170 | + |
| 171 | +- Verbosity `-v` now takes an extended format which allows specifying |
| 172 | + exactly what you want to be logged. The format is |
| 173 | + `[silent|normal|verbose|debug] flags`, where `flags` is a space |
| 174 | + separated list of flags. At the moment, only the flags `+callsite` |
| 175 | + and `+callstack` are supported; these report the call site/stack of |
| 176 | + a logging output respectively (these are only supported if Cabal is |
| 177 | + built with GHC 8.0/7.10.2 or greater, respectively). |
| 178 | + |
| 179 | +- The `-v/--verbosity` option no longer affects GHC verbosity (except |
| 180 | + in the case of `-v0`). Use `--ghc-options=-v` to enable verbose GHC |
| 181 | + output ([#3540](https://github.com/haskell/cabal/issues/3540), |
| 182 | + [#3671](https://github.com/haskell/cabal/issues/3671)). |
| 183 | + |
| 184 | +- Packages which use internal libraries can result in multiple |
| 185 | + registrations; thus `--gen-pkg-config` can now output a directory of |
| 186 | + registration scripts rather than a single file. |
| 187 | + |
| 188 | +- Changed the default logfile template from `.../$pkgid.log` to |
| 189 | + `.../$compiler/$libname.log` |
| 190 | + ([#3807](https://github.com/haskell/cabal/issues/3807)). |
| 191 | + |
| 192 | +- Macros in 'cabal_macros.h' are now `#ifndef`'d, so that they don't |
| 193 | + cause an error if the macro is already defined |
| 194 | + ([#3041](https://github.com/haskell/cabal/issues/3041)). |
| 195 | + |
| 196 | +- Added qualified constraints for setup dependencies. For example, |
| 197 | + `--constraint="setup.bar == 1.0"` constrains all setup dependencies |
| 198 | + on bar, and `--constraint="foo:setup.bar == 1.0"` constrains foo's |
| 199 | + setup dependency on bar (part of |
| 200 | + [#3502](https://github.com/haskell/cabal/issues/3502)). |
| 201 | + |
| 202 | +- Non-qualified constraints, such as `--constraint="bar == 1.0"`, now |
| 203 | + only apply to top-level dependencies. They don't constrain setup or |
| 204 | + build-tool dependencies. |
| 205 | + |
| 206 | + The new syntax `--constraint="any.bar ==1.0"` constrains all uses of bar. |
| 207 | + |
| 208 | +- Added a new solver flag, `--allow-boot-library-installs`, that |
| 209 | + allows normally non-upgradeable packages like `base` to be installed |
| 210 | + or upgraded |
| 211 | + ([#4209](https://github.com/haskell/cabal/issues/4209)). Made the |
| 212 | + 'template-haskell' package non-upgradable again |
| 213 | + ([#4185](https://github.com/haskell/cabal/issues/4185)). |
| 214 | + |
| 215 | +- Fixed password echoing on MinTTY |
| 216 | + ([#4128](https://github.com/haskell/cabal/issues/4128)). |
| 217 | + |
| 218 | +- Added optional solver output visualisation support via the |
| 219 | + `tracetree` package |
| 220 | + ([#3410](https://github.com/haskell/cabal/issues/3410)). Mainly |
| 221 | + intended for debugging. |
| 222 | + |
| 223 | +- New `./Setup configure` flag `--cabal-file`, allowing multiple |
| 224 | + .cabal files in a single directory |
| 225 | + ([#3553](https://github.com/haskell/cabal/issues/3553)). Primarily |
| 226 | + intended for internal use. |
| 227 | + |
| 228 | +- Removed the `--check` option from `cabal upload` |
| 229 | + ([#1823](https://github.com/haskell/cabal/issues/1823)). It was |
| 230 | + replaced by [Hackage package |
| 231 | + candidates](https://hackage.haskell.org/upload#candidates). |
| 232 | + |
| 233 | +- Removed the `--root-cmd` parameter of the 'install' command and |
| 234 | + deprecated `cabal install --global` |
| 235 | + ([#3356](https://github.com/haskell/cabal/issues/3356)). |
| 236 | + |
| 237 | +- Removed the top-down solver |
| 238 | + ([#3598](https://github.com/haskell/cabal/issues/3598)). |
| 239 | + |
| 240 | +- Cabal no longer supports using a version bound to disambiguate |
| 241 | + between an internal and external package |
| 242 | + ([#4020](https://github.com/haskell/cabal/issues/4020)). This |
| 243 | + should not affect many people, as this mode of use already did not |
| 244 | + work with the dependency solver. |
| 245 | + |
| 246 | +- Miscellaneous minor and/or internal bug fixes and improvements. |
| 247 | + |
| 248 | +See the full [Cabal |
| 249 | +2.0](https://github.com/haskell/cabal/blob/2.0/Cabal/changelog) and |
| 250 | +[`cabal-install` |
| 251 | +2.0](https://github.com/haskell/cabal/blob/2.0/cabal-install/changelog) |
| 252 | +changelogs for the complete list of changes in the 2.0 release. |
| 253 | + |
| 254 | +## Acknowledgements |
| 255 | + |
| 256 | +Thanks to everyone who contributed code and bug reports. Full list of |
| 257 | +people who contributed patches to Cabal/`cabal-install` 2.0 is |
| 258 | +available |
| 259 | +[here](https://gist.github.com/23Skidoo/7109479c43a8de44f8e29fa335e9645c). |
| 260 | + |
| 261 | +## Looking forward |
| 262 | + |
| 263 | +We plan to make a new release of Cabal/`cabal-install` before the end |
| 264 | +of the year -- that is, around December 2018. We want to decouple the |
| 265 | +Cabal release cycle from the GHC one; that'll allow us to release a |
| 266 | +new version of Cabal/`cabal-install` approximately every six months in |
| 267 | +the future. Main features that are currently targeted at the 2.2 |
| 268 | +milestone are: |
| 269 | + |
| 270 | +- Further improvements in `new-build`, incorporating [work done by |
| 271 | + Francesco Gazzetta during HSOC |
| 272 | + 2017](https://github.com/haskell/cabal/projects/4). Currently we are |
| 273 | + planning to make `new-build` the default in the 3.0 release |
| 274 | + (tentative release date: Autumn 2018). |
| 275 | + |
| 276 | +- New Parsec-based parser for `.cabal` files, joint work by Oleg |
| 277 | + Grenrus and Duncan Coutts. Faster, less memory hungry, and easier to |
| 278 | + extend. |
| 279 | + |
| 280 | +- [A revamped homepage for |
| 281 | + Cabal](https://github.com/haskell/cabal/issues/4013), [rewritten |
| 282 | + user manual](https://github.com/haskell/cabal/labels/documentation), |
| 283 | + and [automated build bots for binary |
| 284 | + releases](https://github.com/haskell/cabal/issues/4637). Help in |
| 285 | + this area would be appreciated! |
| 286 | + |
| 287 | +We would like to encourage people considering contributing to take a |
| 288 | +look at [the bug tracker on |
| 289 | +GitHub](https://github.com/haskell/cabal/issues/), take part in |
| 290 | +discussions on tickets and pull requests, or submit their own. The bug |
| 291 | +tracker is reasonably well maintained and it should be relatively |
| 292 | +clear to new contributors what is in need of attention and which tasks |
| 293 | +are considered relatively easy. Additionally, [the list of potential |
| 294 | +projects from the latest |
| 295 | +hackathon](https://github.com/haskell/cabal/wiki/ZuriHac-2017) and the |
| 296 | +tickets marked |
| 297 | +["easy"](https://github.com/haskell/cabal/issues?q=is%3Aopen+is%3Aissue+label%3A%22meta%3A+easy%22) |
| 298 | +and |
| 299 | +["newcomer"](https://github.com/haskell/cabal/issues?q=is%3Aopen+is%3Aissue+label%3Anewcomer) |
| 300 | +can be used as a source of ideas for what to work on. |
| 301 | + |
| 302 | +For more in-depth discussion there is also the [`cabal-devel` mailing |
| 303 | +list](https://mail.haskell.org/mailman/listinfo/cabal-devel) and the |
| 304 | +[`#hackage` IRC channel](https://wiki.haskell.org/IRC_channel) on |
| 305 | +FreeNode. |
0 commit comments