{"id":17892362,"url":"https://github.com/trskop/hs-pkg-config","last_synced_at":"2025-04-03T03:40:57.756Z","repository":{"id":24574293,"uuid":"27981885","full_name":"trskop/hs-pkg-config","owner":"trskop","description":"Library for creating pkg-config configuration files from Haskell","archived":false,"fork":false,"pushed_at":"2017-09-28T12:27:25.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T17:41:47.082Z","etag":null,"topics":["edsl","haskell","pkg-config"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trskop.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-14T03:21:16.000Z","updated_at":"2020-02-07T01:53:37.000Z","dependencies_parsed_at":"2022-08-23T00:11:05.193Z","dependency_job_id":null,"html_url":"https://github.com/trskop/hs-pkg-config","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trskop%2Fhs-pkg-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trskop%2Fhs-pkg-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trskop%2Fhs-pkg-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trskop%2Fhs-pkg-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trskop","download_url":"https://codeload.github.com/trskop/hs-pkg-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246933356,"owners_count":20857052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["edsl","haskell","pkg-config"],"created_at":"2024-10-28T14:35:59.528Z","updated_at":"2025-04-03T03:40:57.736Z","avatar_url":"https://github.com/trskop.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hs-pkg-config\n=============\n\n[![Hackage](http://img.shields.io/hackage/v/hs-pkg-config.svg)][Hackage: hs-pkg-config]\n[![Hackage Dependencies](https://img.shields.io/hackage-deps/v/hs-pkg-config.svg)](http://packdeps.haskellers.com/reverse/hs-pkg-config)\n[![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)][Haskell.org]\n[![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)][tl;dr Legal: BSD3]\n\n[![Build](https://travis-ci.org/trskop/hs-pkg-config.svg)](https://travis-ci.org/trskop/hs-pkg-config)\n\n\nDescription\n-----------\n\nLibrary for creating [pkg-config][Pkg-config Homepage] configuration files from\nHaskell. [Pkg-config][Pkg-config Homepage] is a tool for inserting correct\ncompiler options when compiling libraries or applications. It is\nlanguage-agnostic, but mainly used for building various C or C++ libraries and\napplications.\n\nOne of the possible usage examples of this library is generating `.pc` files\nfrom [Shake build system][Shake Homepage].\n\n\nExample\n-------\n\nFollowing Haskell code is able to generate package configuration file named\n`foo.pc` for library `foo`:\n\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\nmodule Main (main)\n  where\n\nimport Data.String (IsString)\n\nimport Data.Default.Class (Default(def))\n   -- From data-default-class library:\n   -- http://hackage.haskell.org/package/data-default-class\n\nimport Control.Lens\n   -- From lens library:\n   -- http://hackage.haskell.org/package/lens\n\nimport Data.PkgConfig\n\n\nlibraryBaseName :: IsString a =\u003e a\nlibraryBaseName = \"foo\"\n\nmain :: IO ()\nmain = writePkgConfig (libraryBaseName ++ \".pc\") libPkgConfig\n  where\n    libPkgConfig = def\n        \u0026 pkgVariables   .~\n            [ (\"prefix\",     \"/usr/local\"              )\n            , (\"includedir\", var \"prefix\" \u003c/\u003e \"include\")\n            , (\"libdir\",     var \"prefix\" \u003c/\u003e \"lib\"    )\n            , (\"arch\",       \"i386\"                    )\n            ]\n        \u0026 pkgName        .~ libraryBaseName\n        \u0026 pkgDescription .~ \"Example pkg-config.\"\n        \u0026 pkgVersion     .~ version [1, 2, 3]\n        \u0026 pkgCflags      .~ includes [var \"includedir\"]\n        \u0026 pkgRequires    .~ list\n            [ \"bar\" ~\u003e [0], \"bar\" ~\u003c= [3, 1]\n            , \"baz\" ~= [1, 2, 3]\n            ]\n        \u0026 pkgLibs        .~ options\n            [ libraryPath [var \"libdir\", var \"libdir\" \u003c/\u003e var \"arch\"]\n            , libraries [libraryBaseName]\n            ]\n```\n\nContent of `foo.pc`:\n\n```\nprefix=/usr/local\nincludedir=${prefix}/include\nlibdir=${prefix}/lib\narch=i386\n\nName: foo\nDescription: Example pkg-config.\nVersion: 1.2.3\nRequires: bar \u003e 0, bar \u003c= 3.1, baz = 1.2.3\nCflags: -I\"${includedir}\"\nLibs: -L\"${libdir}\" -L\"${libdir}/${arch}\" -lfoo\n```\n\nNow lets see if `pkg-config` would be able to tell us something about this\nlibrary:\n\n    $ PKG_CONFIG_PATH=`pwd` pkg-config --modversion foo\n    1.2.3\n\nNote that asking for `--cflags` or other options would result in error saying\nthat it is unable to find `bar` and `baz` libraries. That is OK, it means that\nit is able to parse file correctly, we just hadn't provided `bar.pc` and\n`baz.pc`. If we delete lines that define `Requires:` field, then `pkg-config`\nwould be able to give us `--cflags`, `--libs`, etc. You can try it.\n\n\nBuilding options\n----------------\n\n* `-fpedantic` (disabled by default)\n\n  Pass additional warning flags including `-Werror` to GHC during compilation.\n\n\n\n[Hackage: hs-pkg-config]:\n  https://hackage.haskell.org/package/hs-pkg-config\n  \"Hackage: hs-pkg-config\"\n[Haskell.org]:\n  http://www.haskell.org\n  \"The Haskell Programming Language\"\n[Pkg-config Homepage]:\n  http://www.freedesktop.org/wiki/Software/pkg-config/\n  \"Pkg-config Homepage\"\n[Shake Homepage]:\n  http://shakebuild.com\n  \"Shake Homepage\"\n[tl;dr Legal: BSD3]:\n  https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29\n  \"BSD 3-Clause License (Revised)\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrskop%2Fhs-pkg-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrskop%2Fhs-pkg-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrskop%2Fhs-pkg-config/lists"}