## 1. Project Overview & Quickstart (clibs/clib)

# clib(1)

  
  [](https://www.codacy.com/gh/clibs/clib?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=clibs/clib&amp;utm_campaign=Badge_Grade)

  Package manager for the C programming language.

  

## Installation

  Expects [libcurl](http://curl.haxx.se/libcurl/) to be installed and linkable.

  With [homebrew](https://github.com/Homebrew/homebrew):

```sh
$ brew install clib
```

  Or [MacPorts](https://www.macports.org):

```sh
$ sudo port selfupdate
$ sudo port install clib
```

  With git:

```sh
$ git clone https://github.com/clibs/clib.git /tmp/clib
$ cd /tmp/clib
$ make install
```

  Ubuntu:

```sh
# install libcurl
$ sudo apt-get install libcurl4-gnutls-dev -qq
# clone
$ git clone https://github.com/clibs/clib.git /tmp/clib && cd /tmp/clib
# build
$ make
# put on path
$ sudo make install
```

  Fedora:

```sh
# install libcurl
$ sudo dnf install libcurl-devel
# clone
$ git clone https://github.com/clibs/clib.git /tmp/clib && cd /tmp/clib
# build
$ make
# put on path
$ sudo make install
```

  Nix:

```sh
$ nix-env -i clib
```

  Or add to your `nativeBuildInputs`.


## About

  Basically the lazy-man's copy/paste promoting smaller C utilities, also
  serving as a nice way to discover these sort of libraries. From my experience
  C libraries are scattered all over the web and discovery is relatively poor. The footprint of these libraries is usually quite large and unfocused. The goal of `clibs` is to provide
  stand-alone "micro" C libraries for developers to quickly install without coupling
  to large frameworks.

  You should use `clib(1)` to fetch these files for you and check them into your repository, the end-user and contributors should not require having `clib(1)` installed. This allows `clib(1)` to fit into any new or existing C workflow without friction.

  The wiki [listing of packages](https://github.com/clibs/clib/wiki/Packages) acts as the "registry" and populates the `clib-search(1)` results.

## Usage

```
  clib <command> [options]

  Options:

    -h, --help     Output this message
    -V, --version  Output version information

  Commands:

    init                 Start a new project
    i, install [name...] Install one or more packages
    up, update [name...] Update one or more packages
    uninstall [name...]  Uninstall executables
    upgrade [version]    Upgrade clib to a specified or latest version
    configure [name...]  Configure one or more packages
    build [name...]      Build one or more packages
    search [query]       Search for packages
    help <cmd>           Display help for cmd
```

More about the Command Line Interface [here](https://github.com/clibs/clib/wiki/Command-Line-Interface).

## Examples

 More examples and best practices at [BEST_PRACTICE.md](https://github.com/clibs/clib/blob/master/BEST_PRACTICE.md).

 Install a few dependencies to `./deps`:

```sh
$ clib install clibs/ms clibs/commander
```

 Install them to `./src` instead:

```sh
$ clib install clibs/ms clibs/commander -o src
```

 When installing libraries from the `clibs` org you can omit the name:

```sh
$ clib install ms file hash
```

 Install some executables:

```sh
$ clib install visionmedia/mon visionmedia/every visionmedia/watch
```

## clib.json

 Example of a clib.json explicitly listing the source:

```json
{
  "name": "term",
  "version": "0.0.1",
  "repo": "clibs/term",
  "description": "Terminal ansi escape goodies",
  "keywords": ["terminal", "term", "tty", "ansi", "escape", "colors", "console"],
  "license": "MIT",
  "src": ["src/term.c", "src/term.h"]
}
```

 Example of a clib.json for an executable:

```json
{
  "name": "mon",
  "version": "1.1.1",
  "repo": "visionmedia/mon",
  "description": "Simple process monitoring",
  "keywords": ["process", "monitoring", "monitor", "availability"],
  "license": "MIT",
  "install": "make install"
}
```

 See [explanation of clib.json](https://github.com/clibs/clib/wiki/Explanation-of-clib.json) for more details.

## Contributing

 If you're interested in being part of this initiative let me know and I'll add you to the `clibs` organization so you can create repos here and contribute to existing ones.
 
 If you have any issues, questions or suggestions, please open an issue [here](https://github.com/clibs/clib/issues). 
 
 You can also find us on Gitter: https://gitter.im/clibs/clib
 
 Also feel free to open a GitHub Discussion [here](https://github.com/clibs/clib/discussions).

 Before committing to the repository, please run `make commit-hook`. This installs a commit hook which formats `.c` and `.h` files.

## Articles

  - [Introducing Clib](https://medium.com/code-adventures/b32e6e769cb3) - introduction to clib
  - [The Advent of Clib: the C Package Manager](https://web.archive.org/web/20200128184218/http://blog.ashworth.in/2014/10/19/the-advent-of-clib-the-c-package-manager.html) - overview article about clib

## 2. Official Technical Reference & Guides (clibs/website)

# clibs.org  [](https://app.netlify.com/sites/clibs/deploys)

> The source code for [clibs.org](https://www.clibs.org/).

## Development

### Getting started

To work on the site locally, first install [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/).

Next install the project's dependencies with:

```
yarn
```

Finally, start [Webpack's development server](https://webpack.js.org/configuration/dev-server/) with:

```
yarn dev
```

### Updating the registry

The registry is [automatically updated](https://github.com/clibs/website/blob/main/.github/workflows/registry.yml) every 6 hours.

To manually rebuild the registry:

1. [Get a GitHub token](https://github.com/settings/tokens/new)
1. Run `yarn registry --token=YOUR_TOKEN`

## Deployment

Netlify deploys all commits that land in the `main` branch by running the `scripts/netlifyBuild.sh` program. This will perform a "regular" build and optionally "pre-render" all pages as static HTML.

## License

MIT