Is there a way to add a dynamic library to every link with GHC automatically?

Stephen Paul Weber singpolyma at singpolyma.net
Wed Oct 1 15:04:59 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

>So now I'm wondering if there's a way to tell my GHC build that when it is 
>built for this platform it should just always link against libcaps as well 
>as whatever else?

So, I think I've figured it out.  Does this look like the best way to acheive what I need:

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 0e17793..68a0c13 100644
- --- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1886,6 +1886,10 @@ linkBinary' staticLink dflags o_files dep_packages = do
                 else ["-lpthread"]
           | otherwise               = []

+    let qnx_opts
+         | platformOS platform == OSQNXNTO = ["-lcaps"]
+         | otherwise                       = []
+
      rc_objs <- maybeCreateManifest dflags output_fn

      let link = if staticLink
@@ -1957,6 +1961,7 @@ linkBinary' staticLink dflags o_files dep_packages = do
                        ++ pkg_framework_opts
                        ++ debug_opts
                        ++ thread_opts
+                      ++ qnx_opts
                      ))

      -- parallel only: move binary to another dir -- HWL

- -- 
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJULBgbAAoJENEcKRHOUZzeikQP/ir+JdnO5Hdfe2j13Ut4Plkx
cRBK9mbn5bXgojGS/0WZuDLl8A6wn4QlzgeG/4U1GcQTe7EifatfYaRGsnek5dN7
WO7NLKWuo+mUDR6DHowVysWU/II25ddY+iX/6I1ax16SK3iD0+lb0+strw4ble59
Yq2lsrs2PFM9W0reyJxwYjkgqndndUpZ8yzkYeR0L0Mw/7rh+Fepvc8KR27AfEAz
5jSl/7eKUqNW9FAiiNix5vT0vG2awdaDoS8INhzTwYXtJh6qNHTrpdu/TEORFF7V
v+vRNTmzmFH5+R5FXhlmCzDpX0FuQdF3xB2doB8XCEaNuwTmJhjMGZIxVZuhMu9s
a4sgyhgJWzpHIbwDbDYWfTlYPEYUWGlb8xli8y+qTJ8N73FbYCc8qzwvKJgOZBUi
+ezT/Hb2ssgHa9IQojoe7uxVsx9ZYhSksYx8Ah/cVTGP8v6ihl7YgwI2qnobZxNB
D3pTkfu3UsnH6GwyjRSOOnV7di/BSeo7INSt0aIM4uuxZJUyGkh2LABLSMLOVEkG
fwaN/aIXvw+Nwa7xvYd/BoP9io18uxD6ejUvPJU0NAnXT6QTwn5rp7cr6lMgPAgn
oZsg8ZbbENgUTkalyXye6Xe8juVWGPA681ceUn3UQm5QznwfiYdAHbwmNor1qzvU
Rd/s6us8hOH33PgUULS6
=P9u0
-----END PGP SIGNATURE-----


More information about the ghc-devs mailing list