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