Skip to content

Latest commit

 

History

168 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dep

General purpose dependency manager for embedded C libraries, written in C.

Summary

Usage: dep [global options] <command> [command options]


Global options:
    -h, --help        Show this help message and exit
    -V, --version     Show version information and exit

Commands:
    v(ersion)         Show version information
    help [command]    Show this help or the top-level info about a command
    r(epo(sitory))    Repository management
    license           Show license information
    i(nstall)         Install all the project's dependencies
    init              Initialize a new project with a .dep file
    a(dd)             Add a new dependency to the project

Run dep help <command> for the details on a single command.

Installation

Note: Windows is not supported. This project only targets posix-compliant operating systems.

To install dep, build it from source and place the binary in your $PATH:

make
sudo make install

To install the binary in a location other than /usr/local/bin, pass the DESTDIR definition to the make install command (default: /usr/local).

By default, no default repositories are enabled. You'll need to add your own or use GitHub directly.

Usage

Initializing a project

To start using dep in your project, run the init command to create a .dep file:

dep init

This creates an empty .dep file in the current directory. You can also specify a target directory:

dep init /path/to/project

Adding a dependency

To add a package, you can call the following command:

dep add owner/library
dep add owner/library version

If a version is not specified, the latest version from the repository will be used, or the default branch from GitHub.

Examples:

dep add finwo/palloc           # Latest from repo or GitHub main branch
dep add finwo/palloc edge     # Specific version/branch
dep add finwo/palloc v1.0.0   # Specific tag

You can also add a dependency with a direct URL:

dep add mylib https://example.com/mylib.tar.gz

Installing dependencies

To install all dependencies listed in your .dep file:

dep install

Dependencies are installed to the lib/ directory by default.

Dependency exports

Dependencies can export build configuration through an export.mk file. When a dependency contains an export.mk file in its root directory, its contents are processed and included in the generated lib/.dep/config.mk file. Template variables like {{module.dirname}} are replaced with the dependency's library path.

Note: The legacy filename config.mk is also supported but deprecated. Dependencies using config.mk will trigger a deprecation warning.

Repository management

dep can use custom repositories to discover packages. Repositories are configured in ~/.config/finwo/dep/repositories.d/.

To add a repository:

dep repository add myorg https://example.com/path/to/manifest

To list configured repositories:

dep repository list

To remove a repository:

dep repository remove myorg

To clean the cache of downloaded repository manifests:

dep repository clean-cache

Creating Repositories

Anyone can create a repository to host their own package manifests. A repository is simply a static file server hosting a manifest file.

The manifest is a text file with one package per line. Lines starting with # are comments. Each line has the following format:

name@version url

The version is optional. If omitted, the package is available without a specific version.

Example manifest:

# My organization's packages
finwo/palloc@edge https://github.com/finwo/palloc/archive/refs/heads/edge.tar.gz
finwo/palloc@v1.0.0 https://github.com/finwo/palloc/archive/refs/tags/v1.0.0.tar.gz
finwo/palloc https://github.com/finwo/palloc/archive/refs/heads/main.tar.gz
myorg/mylib https://example.com/mylib-v1.0.0.tar.gz
myorg/mylib@2.0.0 https://example.com/mylib-v2.0.0.tar.gz

Host the manifest file on any static file server (GitHub Pages, S3, nginx, etc.) and add the URL using dep repository add.

Building

Building this dependency manager requires:

  • clang (or your preferred C compiler)
  • make

Simply run:

make

License

This project falls under the FGPL license

About

Simple general-purpose dependency manager

Resources

Code of conduct

Stars

1 star

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages