cabal sdist confused by if

1
2
3
4
5
6
7
8
9
10
11
12
13
Executable          darcs-test
  buildable:	    True

  build-tools: ghc >= 6.10 && < 7.2

  hs-source-dirs:   src

  if !flag(test)
    main-is:	      test_stub.hs
    build-depends:    base < 5
  else
    main-is:          test.hs
    [rest of options for building test]

cabal sdist confused by if (annotation)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Executable          darcs-test
  buildable:	    True

  build-tools: ghc >= 6.10 && < 7.2

  hs-source-dirs:   src

  if !flag(test)
    main-is:	      test_stub.hs
    build-depends:    base < 5
  else
    main-is:          test.hs
    [rest of options for building test]

Yields:

test_stub.hstest.hs doesn't exist