diff --git a/cabal2spec.cabal b/cabal2spec.cabal
--- a/cabal2spec.cabal
+++ b/cabal2spec.cabal
@@ -1,5 +1,5 @@
 name:                   cabal2spec
-version:                2.0.1
+version:                2.0.2
 synopsis:               Convert Cabal files into rpm spec files
 homepage:               https://github.com/peti/cabal2spec
 license:                GPL-3
@@ -33,7 +33,7 @@
   hs-source-dirs:       src
   ghc-options:          -Wall
   build-depends:        base < 5
-                      , Cabal > 2
+                      , Cabal > 2.2
                       , filepath
                       , time >= 1.5
   exposed-modules:      Cabal2Spec
@@ -44,7 +44,7 @@
   hs-source-dirs:       cabal2spec
   other-modules:        Paths_cabal2spec
   build-depends:        base < 5
-                      , Cabal > 2
+                      , Cabal > 2.2
                       , cabal2spec
                       , filepath
                       , optparse-applicative
@@ -56,7 +56,7 @@
   main-is:              Main.hs
   hs-source-dirs:       test
   build-depends:        base
-                      , Cabal > 2
+                      , Cabal > 2.2
                       , cabal2spec
                       , filepath
                       , tasty
diff --git a/cabal2spec/Main.hs b/cabal2spec/Main.hs
--- a/cabal2spec/Main.hs
+++ b/cabal2spec/Main.hs
@@ -52,8 +52,7 @@
 
 main :: IO ()
 main = do
-  opts@Options {..} <- execParser pinfo
-  print opts
+  Options {..} <- execParser pinfo
   let specFile = fromMaybe (optCabalFile `replaceExtension` "spec") optOutputFile
   putStrLn $ "Writing spec file to " ++ show specFile ++ " ..."
-  cabal2spec buildPlatform buildCompilerId mempty True optCabalFile specFile
+  cabal2spec buildPlatform buildCompilerId (mkFlagAssignment optFlags) True optCabalFile specFile
diff --git a/src/Cabal2Spec.hs b/src/Cabal2Spec.hs
--- a/src/Cabal2Spec.hs
+++ b/src/Cabal2Spec.hs
@@ -10,11 +10,13 @@
 import Distribution.Package
 import Distribution.PackageDescription
 import Distribution.PackageDescription.Configuration
-import Distribution.PackageDescription.Parse
+import Distribution.PackageDescription.Parsec
+import Distribution.Pretty
 import Distribution.System
 import Distribution.Text
 import Distribution.Types.ComponentRequestedSpec
 import Distribution.Types.LegacyExeDependency
+import Distribution.Types.PackageDescription
 import Distribution.Types.PkgconfigDependency
 import Distribution.Types.UnqualComponentName
 import Distribution.Verbosity
@@ -27,10 +29,13 @@
 cabal2spec :: Platform -> CompilerId -> FlagAssignment -> ForceBinary -> FilePath -> FilePath -> IO ()
 cabal2spec platform compilerId flags forceBinary cabalFile specFile = do
   gpd <- readGenericPackageDescription silent cabalFile
-  case finalizePD flags (ComponentRequestedSpec False False) (const True) platform (unknownCompilerInfo compilerId NoAbiTag) [] gpd of
+  case finalizePD flags requestedComponents (const True) platform (unknownCompilerInfo compilerId NoAbiTag) [] gpd of
     Left missing -> fail ("finalizePD: " ++ show missing)
     Right (pd,_) -> createSpecFile specFile pd forceBinary flags
 
+requestedComponents :: ComponentRequestedSpec
+requestedComponents = defaultComponentRequestedSpec
+
 showPkgCfg :: String -> String
 showPkgCfg p = "pkgconfig(" ++ p ++ ")"
 
@@ -53,7 +58,7 @@
       pkgcfgs :: [String]
       pkgcfgs = map showPkgCfg (nub $ map depName $ concatMap pkgconfigDepends buildinfo)
       buildinfo :: [BuildInfo]
-      buildinfo = allBuildInfo pkgDesc
+      buildinfo = enabledBuildInfos pkgDesc requestedComponents
       tools :: [String]
       tools = mkTools (nub $ map depName (concatMap buildTools buildinfo)) ++ chrpath
       clibs :: [String]
@@ -140,7 +145,7 @@
   putHdr "Summary" summary
   putHdr "Group" "Development/Libraries/Haskell"
   putNewline
-  putHdr "License" $ showLicense (license pkgDesc)
+  putHdr "License" $ either (show . pretty) showLicense (licenseRaw pkgDesc)
   putHdr "Url" $ "https://hackage.haskell.org/package/" ++ pkg_name
   putHdr "Source0" $ "https://hackage.haskell.org/package/" ++ pkg_name ++ "-%{version}/" ++ pkg_name ++ "-%{version}.tar.gz"
   when (revision /= "0") $
@@ -198,7 +203,7 @@
 
   put "%build"
   when (flagAssignment /= mempty) $ do
-    let cabalFlags = [ "-f" ++ (if b then "" else "-") ++ unFlagName n | (n, b) <- flagAssignment ]
+    let cabalFlags = [ "-f" ++ (if b then "" else "-") ++ unFlagName n | (n, b) <- unFlagAssignment flagAssignment ]
     put $ "%define cabal_configure_options " ++ unwords (sort cabalFlags)
   let pkgType = if hasLib then "lib" else "bin"
   put $ "%ghc_" ++ pkgType ++ "_build"
@@ -419,6 +424,7 @@
 resolveLib "luajit" = "luajit-devel"
 resolveLib "lzma" = "xz-devel"
 resolveLib "m" = "glibc-devel"
+resolveLib "gsl" = "gsl-devel"
 resolveLib "magic" = "file-devel"
 resolveLib "mpfr" = "mpfr-devel"
 resolveLib "openal" = "openal-soft-devel"
diff --git a/test/golden-test-cases/crypt-sha512.spec.golden b/test/golden-test-cases/crypt-sha512.spec.golden
--- a/test/golden-test-cases/crypt-sha512.spec.golden
+++ b/test/golden-test-cases/crypt-sha512.spec.golden
@@ -34,7 +34,6 @@
 BuildRequires:  ghc-attoparsec-devel
 BuildRequires:  ghc-bytestring-devel
 BuildRequires:  ghc-cryptohash-sha512-devel
-BuildRequires:  glibc-devel
 %if %{with tests}
 BuildRequires:  ghc-quickcheck-instances-devel
 BuildRequires:  ghc-tasty-devel
@@ -65,7 +64,6 @@
 Requires(post): ghc-compiler = %{ghc_version}
 Requires(postun): ghc-compiler = %{ghc_version}
 Requires:       ghc-%{name} = %{version}-%{release}
-Requires:       glibc-devel
 
 %description -n ghc-%{name}-devel
 This package provides the Haskell %{name} library development files.
diff --git a/test/golden-test-cases/data-accessor.spec.golden b/test/golden-test-cases/data-accessor.spec.golden
--- a/test/golden-test-cases/data-accessor.spec.golden
+++ b/test/golden-test-cases/data-accessor.spec.golden
@@ -37,7 +37,7 @@
 In Haskell 98 the name of a record field is automatically also the name of a
 function which gets the value of the according field. E.g. if we have
 
-data Pair a b = Pair first :: a, second :: b
+data Pair a b = Pair {first :: a, second :: b}
 
 then
 
@@ -46,8 +46,8 @@
 However for setting or modifying a field value we need to use some syntactic
 sugar, which is often clumsy.
 
-modifyFirst :: (a -> a) -> (Pair a b -> Pair a b) modifyFirst f r@(Pair first=a
-) = r first = f a
+modifyFirst :: (a -> a) -> (Pair a b -> Pair a b) modifyFirst f r@(Pair
+{first=a}) = r{first = f a}
 
 With this package you can define record field accessors which allow setting,
 getting and modifying values easily. The package clearly demonstrates the power
diff --git a/test/golden-test-cases/inline-c-cpp.spec.golden b/test/golden-test-cases/inline-c-cpp.spec.golden
--- a/test/golden-test-cases/inline-c-cpp.spec.golden
+++ b/test/golden-test-cases/inline-c-cpp.spec.golden
@@ -34,7 +34,6 @@
 BuildRequires:  ghc-inline-c-devel
 BuildRequires:  ghc-safe-exceptions-devel
 BuildRequires:  ghc-template-haskell-devel
-BuildRequires:  libstdc++-devel
 %if %{with tests}
 BuildRequires:  ghc-hspec-devel
 %endif
@@ -59,7 +58,6 @@
 Requires(post): ghc-compiler = %{ghc_version}
 Requires(postun): ghc-compiler = %{ghc_version}
 Requires:       ghc-%{name} = %{version}-%{release}
-Requires:       libstdc++-devel
 
 %description -n ghc-%{name}-devel
 This package provides the Haskell %{name} library development files.
