dep

Package manager for embedded C libraries
git clone git://git.finwo.net/app/dep
Log | Files | Refs | README | LICENSE

README.md (4409B)


      1 dep
      2 ===
      3 
      4 General purpose dependency manager for embedded C libraries, written in C.
      5 
      6 Summary
      7 -------
      8 
      9 ```
     10 Usage: dep [global options] <command> [command options]
     11 
     12 
     13 Global options:
     14     -h, --help        Show this help message and exit
     15     -V, --version     Show version information and exit
     16 
     17 Commands:
     18     v(ersion)         Show version information
     19     help [command]    Show this help or the top-level info about a command
     20     r(epo(sitory))    Repository management
     21     license           Show license information
     22     i(nstall)         Install all the project's dependencies
     23     init              Initialize a new project with a .dep file
     24     a(dd)             Add a new dependency to the project
     25 ```
     26 
     27 Run `dep help <command>` for the details on a single command.
     28 
     29 Installation
     30 ------------
     31 
     32 **Note: Windows is not supported.** This project only targets posix-compliant operating systems.
     33 
     34 To install dep, build it from source and place the binary in your `$PATH`:
     35 
     36 ```sh
     37 make
     38 sudo make install
     39 ```
     40 
     41 To install the binary in a location other than `/usr/local/bin`, pass the
     42 `DESTDIR` definition to the `make install` command (default: `/usr/local`).
     43 
     44 By default, no default repositories are enabled. You'll need to add your own
     45 or use GitHub directly.
     46 
     47 Usage
     48 -----
     49 
     50 ### Initializing a project
     51 
     52 To start using dep in your project, run the init command to create a `.dep` file:
     53 
     54 ```sh
     55 dep init
     56 ```
     57 
     58 This creates an empty `.dep` file in the current directory. You can also specify
     59 a target directory:
     60 
     61 ```sh
     62 dep init /path/to/project
     63 ```
     64 
     65 ### Adding a dependency
     66 
     67 To add a package, you can call the following command:
     68 
     69 ```sh
     70 dep add owner/library
     71 dep add owner/library version
     72 ```
     73 
     74 If a version is not specified, the latest version from the repository will be
     75 used, or the default branch from GitHub.
     76 
     77 Examples:
     78 
     79 ```sh
     80 dep add finwo/palloc           # Latest from repo or GitHub main branch
     81 dep add finwo/palloc edge     # Specific version/branch
     82 dep add finwo/palloc v1.0.0   # Specific tag
     83 ```
     84 
     85 You can also add a dependency with a direct URL:
     86 
     87 ```sh
     88 dep add mylib https://example.com/mylib.tar.gz
     89 ```
     90 
     91 ### Installing dependencies
     92 
     93 To install all dependencies listed in your `.dep` file:
     94 
     95 ```sh
     96 dep install
     97 ```
     98 
     99 Dependencies are installed to the `lib/` directory by default.
    100 
    101 ### Dependency exports
    102 
    103 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.
    104 
    105 **Note:** The legacy filename `config.mk` is also supported but deprecated. Dependencies using `config.mk` will trigger a deprecation warning.
    106 
    107 ### Repository management
    108 
    109 dep can use custom repositories to discover packages. Repositories are
    110 configured in `~/.config/finwo/dep/repositories.d/`.
    111 
    112 To add a repository:
    113 
    114 ```sh
    115 dep repository add myorg https://example.com/path/to/manifest
    116 ```
    117 
    118 To list configured repositories:
    119 
    120 ```sh
    121 dep repository list
    122 ```
    123 
    124 To remove a repository:
    125 
    126 ```sh
    127 dep repository remove myorg
    128 ```
    129 
    130 To clean the cache of downloaded repository manifests:
    131 
    132 ```sh
    133 dep repository clean-cache
    134 ```
    135 
    136 Creating Repositories
    137 --------------------
    138 
    139 Anyone can create a repository to host their own package manifests. A
    140 repository is simply a static file server hosting a manifest file.
    141 
    142 The manifest is a text file with one package per line. Lines starting with
    143 `#` are comments. Each line has the following format:
    144 
    145 ```
    146 name@version url
    147 ```
    148 
    149 The version is optional. If omitted, the package is available without a
    150 specific version.
    151 
    152 Example manifest:
    153 
    154 ```
    155 # My organization's packages
    156 finwo/palloc@edge https://github.com/finwo/palloc/archive/refs/heads/edge.tar.gz
    157 finwo/palloc@v1.0.0 https://github.com/finwo/palloc/archive/refs/tags/v1.0.0.tar.gz
    158 finwo/palloc https://github.com/finwo/palloc/archive/refs/heads/main.tar.gz
    159 myorg/mylib https://example.com/mylib-v1.0.0.tar.gz
    160 myorg/mylib@2.0.0 https://example.com/mylib-v2.0.0.tar.gz
    161 ```
    162 
    163 Host the manifest file on any static file server (GitHub Pages, S3, nginx,
    164 etc.) and add the URL using `dep repository add`.
    165 
    166 Building
    167 --------
    168 
    169 Building this dependency manager requires:
    170 - clang (or your preferred C compiler)
    171 - make
    172 
    173 Simply run:
    174 
    175 ```sh
    176 make
    177 ```
    178 
    179 License
    180 -------
    181 
    182 This project falls under the [FGPL license](LICENSE.md)