C package manager-ish

Overview

clib(1)

Build Status Codacy Badge

Package manager for the C programming language.

c package manager screenshot

Installation

Expects libcurl to be installed and linkable.

With homebrew:

$ brew install clib

Or MacPorts:

$ sudo port selfupdate
$ sudo port install clib

With git:

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

Ubuntu:

# 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

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 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
    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.

Examples

More examples and best practices at BEST_PRACTICE.md.

Install a few dependencies to ./deps:

$ clib install clibs/ms clibs/commander

Install them to ./src instead:

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

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

$ clib install ms file hash

Install some executables:

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

clib.json

Example of a clib.json explicitly listing the source:

{
  "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:

{
  "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 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.

You can also find us on Gitter: https://gitter.im/clibs/clib

Also feel free to open a GitHub Discussion here.

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

Articles

Issues
  • Introducing valgrind to detect memory leaks

    Introducing valgrind to detect memory leaks

    In C, memory leaks are major issues of a project. To detect memory leaks and test it continuously, I suggest introducing a test with valgrind to detect memory leaks in CI.

    help wanted 
    opened by Constellation 25
  • Win32 binaries

    Win32 binaries

    I did one. (The link is no longer valid) I've not tested this on 32-bit windows actually. It works on my system (64-bit Win7 Home Basic), but all exe and dlls are in 32-bit format. So... maybe... someone... wants this one? I would be happy if someone just test this thing on another machine. Or if it would be just helpful for someone.

    opened by georgy7 16
  • Addition of a build system generator

    Addition of a build system generator

    opened by elfring 15
  • Different name than package.json?  clib.json?

    Different name than package.json? clib.json?

    I guess there is Arduino packaging util called leo that uses the same name. No idea how prevalent or widespread it is used.

    @AdamMagaluk added a package.json to his fork of the c library js0n. When I first saw that, I though cool, he already packaged it up for clib. :) (https://github.com/quartzjer/js0n/network)

    opened by mbucc 15
  • Windows executables missing in recent releases

    Windows executables missing in recent releases

    Not sure what happened, but it looks like we're no longer building/uploading Windows binaries when we release. This is a bummer for Windows people.

    An example of a release with binaries is v1.8.1.

    enhancement ci 
    opened by stephenmathieson 13
  • clib gets confused if not invoked via PATH

    clib gets confused if not invoked via PATH

    It seems clib gets confused if it's not invoked via PATH:

    $ ./result/bin/clib search
    Unsupported command "search"
    

    This however, works:

    $ PATH=./result/bin clib search | head
    
      clibs/buffer
      url: https://github.com/clibs/buffer
      desc: tiny c-string library
    
      nami-doc/trim.c
      url: https://github.com/nami-doc/trim.c
      desc: trim a string, in place
    
      nami-doc/strlen.c
    

    Tested clib version 1.4.2.

    bug wontfix 
    opened by bjornfor 13
  • Fetch makefiles

    Fetch makefiles

    Thoughts on something like this:

    {
      "name": "whatever",
      "makefile": "path/to/makefile",
      "repo": ...
    }
    

    So we could:

    mylib: libwhatever
      $(CC) ...
    
    libwhatever:
      $(MAKE) -C deps/whatever
      ...
    

    EDIT: gypfiles?

    opened by stephenmathieson 13
  • Publishing package process - suggestions

    Publishing package process - suggestions

    I've been looking at documenting how to publish a project to clib, but I've come to realise we might need to first figure out a sustainable publishing process.

    I think a sustainable publishing process has these two qualities:

    • Maximises the user's ease of publishing packages to clib
    • Minimises any intervention required by clib organisation members

    Below are some suggestions for a publishing process.

    a. User raises "publish" issues

    1. User adds a package.json file to their repo
    2. User submits an issue with the "publish" label to clib (includes repo details)
    3. clibs organisation member will then add the project to wiki/packages

    | Pros | Cons | | --- | --- | | No changes to clib required | clibs organisation member does a bit of work |

    b. User becomes clibs organisation member

    1. User sends email request for clibs organisation membership
    2. clibs member grants membership
    3. User adds package.json to their repo
    4. User modifies wiki/packages

    | Pros | Cons | | --- | --- | | No changes to clib required | Users have to do a bit of work | | | clibs organisation member has to handle memberships |

    c. User raises pull requests against clibs/packages text file

    1. User adds a package.json file to their repo
    2. User clones clibs/packages (this is a repo that contains a single text file which is used instead of wiki/packages)
    3. User adds a line in the text file for their project, submits pull request to clibs/packages
    4. clibs organisation member merges pull request

    | Pros | Cons | | --- | --- | | clibs organisation member just merges pull requests | clib changes required |

    d. User raises pull requests against clibs/packages package.json files

    1. User clones clibs/packages (this is a repo that contains package.json files for each package instead of wiki/packages. Each package.json is given a file name based off its package name, eg. clibs-buffer.json)
    2. User adds a package.json file for their package. The json file is actually named after the package, eg. clibs-buffer.json.
    3. User submits pull request to clibs/packages
    4. clibs organisation member merges pull request

    | Pros | Cons | | --- | --- | | clibs organisation member just merges pull requests | clib changes required | | Users can publish packages for upstream repos that don't want to add package.json to their repo | |

    question 
    opened by willemt 10
  • unable to fetch package.json?

    unable to fetch package.json?

    I try to use clib to install memcached like this clib install memcached/memcached, but it outputs an error:

    error : unable to fetch https://raw.github.com/memcached/memcached/master/package.json

    Does that mean if I want to install a repository, then the repository must provide a package.json file? If so, why not provide some common libraries in clib project itself?

    opened by Charles0429 10
  • add libuv as clibs' dep?

    add libuv as clibs' dep?

    See #29 and I have a plan to do 3 following stuffs for clibs:

    • a network client library based on libuv and openssl, it provided a common API for net or tls, same for http and https.(most implemented by me)
    • to be refactoring clibs/clib based on 1st plan.
    • to be contributing to clibs/http based on 1st plan.

    After that, clib is based on libuv, as @stephenmathieson said, it is so huge dependence, and do you have some suggestion for this?

    /cc @clibs

    question 
    opened by yorkie 10
  • want to add a lib to clibs

    want to add a lib to clibs

    Hi, clibs guys,

    This is the link of my library: https://github.com/yorkie/readline It do a tiny stuff like split('/n') in javascript, but I think it's needed to be added to the bundles of awesome packages.

    I'm looking forward to your reply :p

    opened by yorkie 10
  • Use GitHub Contents API

    Use GitHub Contents API

    Currently, we make requests to raw.githubusercontent.com which fails to work with private repositories as the [email protected] scheme no longer works. PATs do not seem to work as a query string ?token=.

    The solution appears to be in the GitHub Contents API with the usage basic auth

    opened by jwerle 0
  • Incorrect upgrade message

    Incorrect upgrade message

    clib is suggesting I upgrade from v2.8.0 to v2.7.0. This seems backwards.

    $ clib -V
            info : You are using clib 2.8.0, a new version is avalable. You can upgrade with the following command: clib upgrade --tag 2.7.0
    2.8.0
    
    bug 
    opened by stephenmathieson 1
  • can't assume master branch any more?

    can't assume master branch any more?

    Now that github is encouraging people to call their primary branch "main" instead of "master" it probably makes sense to default to main or master rather than just master

    enhancement 
    opened by jkroso 3
  • Support multiple registries and repositories

    Support multiple registries and repositories

    Towards fixing #105 In order to support multiple registries and be able to download packages from multiple sources I had to change quite a few things.

    • An abstraction for registries so that multiple registries can be added. (currently github wiki pages and gitlab files are supported)
    • Add extra registries in clib.json in a registries item.
    • Store secrets in clib_secrets.json so that we can connect with private registries and repositories
    • Make an abstraction for repositories, a repository is a place we can download packages from (currently implemented gitlab and github)

    Changes

    • Changed the "has pthread?" test because it doesn't work when cross-compiling with dockcross.
    • Move instructions for building from Readme.md to Building.md and add instructions for cross-compiling for windows (as it took me some time to figure this out)
    • Changed the windows test build in github actions to use pthread as that seems to work fine (after fixing the pthread detection script)
    • Add instructions for how to install from other sources to Usage.md
    • Fix multithreading when downloading package files.

    Todo

    • [x] Add a test for reading and using secrets from clib_secrets.json
    • [x] Add a test for reading packages from an extra registry.
    • [x] Add a test for installing a package from gitlab.com
    enhancement refactoring needs review 
    opened by nouwaarom 7
Releases(2.7.0)
Owner
clibs
Package manager for the C programming language along with some packages.
clibs
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

CPM.cmake 1.3k Aug 7, 2022
Examples of using Hunter package manager to build and run Android application.

Examples of using Hunter package manager to build and run Android application. Requirements Android NDK Go to download page and choose NDK for your pl

null 34 Mar 13, 2022
CMake wrapper for Xrepo C and C++ package manager

xrepo-cmake CMake wrapper for Xrepo C and C++ package manager. Supporting the project Support this project by becoming a sponsor. Your logo will show

xmake-io 19 May 13, 2022
C++ Library Manager for Windows, Linux, and MacOS

Vcpkg: Overview 中文总览 Español 한국어 Français Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This tool and ecosystem are constant

Microsoft 16.4k Aug 5, 2022
Enhanced CMake Project Manager plugin for Qt Creator

CMakeProjectManager2 Alternative CMake support for Qt Creator. Main differents from original CMakeProject plugin: Project file list readed from file s

Alexander Drozdov 71 May 24, 2022
C++ package retrieval

cget Cmake package retrieval. This can be used to download and install cmake packages. The advantages of using cget are: Non-intrusive: There is no ne

Paul Fultz II 411 Jul 20, 2022
C package manager-ish

clib(1) Package manager for the C programming language. Installation Expects libcurl to be installed and linkable. With homebrew: $ brew install clib

clibs 4.4k Aug 6, 2022
PMM - The C++ Package Manager Manager

PMM - The Package Manager Manager PMM is a module for CMake that manages... package managers. Wha- Why? People hate installing new software. Especiall

Edgar 12 Jun 28, 2022
Spack is a package manager, and package managers should be trivial to install.

?? Spack with batteries included (linux/x86_64) Spack is a package manager, and package managers should be trivial to install. This repo offers a sing

Harmen Stoppels 14 Jun 6, 2022
BakePKG is a package archive that can install itself without without a package manager.

BakePKG A bad way of packaging applications. Introduction BakePKG is a package archive that can install itself without without a package manager. The

bread 4 Aug 16, 2021
Minimal-ish implementation of Unreal Online Subsystem + ImGui UI

Minimal-ish implementation of Unreal Online Subsystem + ImGui UI

Brace Yourself Games 4 Mar 14, 2022
An implementation of OpenGL 3.x-ish in clean C

PortableGL "Because of the nature of Moore's law, anything that an extremely clever graphics programmer can do at one point can be replicated by a mer

Robert Winkler 506 Aug 9, 2022
Modern(-ish) password hashing for your software and your servers

bcrypt Good password hashing for your software and your servers Installation To install bcrypt, simply: $ pip install bcrypt Note that bcrypt should b

Python Cryptographic Authority 888 Aug 5, 2022
"Sigma File Manager" is a free, open-source, quickly evolving, modern file manager (explorer / finder) app for Windows, MacOS, and Linux.

"Sigma File Manager" is a free, open-source, quickly evolving, modern file manager (explorer / finder) app for Windows, MacOS, and Linux.

Aleksey Hoffman 898 Aug 7, 2022
C++ Package Manager

CPM Note CPM is not being actively maintained. I plan on keeping the website active but don't plan on making further modifications to the codebase. If

James 717 Jul 25, 2022
The decentralized package manager for C++ and friends 🏝️

Buckaroo The decentralized package manager for C++ and friends. Why Buckaroo? Package managers like Yarn and Cargo have shown how productive developer

LoopPerfect 894 Aug 8, 2022
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

CPM.cmake 1.3k Aug 8, 2022
CMake driven cross-platform package manager for C/C++.

Hunter CMake driven cross-platform package manager for C/C++. Linux, Windows, macOS, iOS, Android, Raspberry Pi, etc. Documentation: https://hunter.re

null 456 Jul 25, 2022
Package manager for linux that installs windows apps through wine

Winepkg A package manager for linux that installs windows apps through wine. Usage winepkg -Si mspaint Install Dependencies: wine winetricks wget cur

null 2 May 27, 2022
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

CPM.cmake 1.3k Aug 7, 2022
Windows Package Manager CLI (aka winget)

Welcome to the Windows Package Manager Client (aka winget.exe) repository This repository contains the source code for the Windows Package Manager Cli

Microsoft 17.5k Aug 9, 2022
ZPM - The C++ package manager based on premake5

ZPM ZPM is the C++ package manager built for everyone who uses premake! We designed it to make it easy to use libraries, modules and assets. PLEASE NO

Zefiros Software 27 Feb 15, 2022
Example of downloading/installing dependencies using Hunter package manager.

Linux/OSX Windows Example of downloading/installing dependencies using Hunter package manager. Requirements CMake version 3.0 Usage Set HUNTER_ROOT en

null 45 Apr 12, 2022
Examples of using Hunter package manager to build and run Android application.

Examples of using Hunter package manager to build and run Android application. Requirements Android NDK Go to download page and choose NDK for your pl

null 34 Mar 13, 2022
Conan - The open-source C/C++ package manager

Conan Decentralized, open-source (MIT), C/C++ package manager.

Conan.io 6.1k Aug 5, 2022
A package manager for C++, like Cargo for Rust.

Description Poac is a package manager for C++ users. Poac can download project's dependencies and compile a project. Please see poac.pm, installation

Poac 530 Aug 1, 2022
BSCXX (for BootStrap CXX project) is a C++ package manager.

bscxx bscxx (for bootstrap CXX project) is a very light utility software, written in C++ 17, to help you starting quickly a new C++ project using cmak

Victor Gallet 1 Sep 21, 2019
C++ front-end package manager for embedding and redistributing with native applications

Pacm Simple C++ package manager Homepage: https://sourcey.com/pacm Documentation: https://sourcey.com/libsourcey/api-pacm/ Dependencies: LibSourcey (b

Sourcey 84 Jun 5, 2022
CMake wrapper for Xrepo C and C++ package manager

xrepo-cmake CMake wrapper for Xrepo C and C++ package manager. Supporting the project Support this project by becoming a sponsor. Your logo will show

xmake-io 19 May 13, 2022