You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically the lazy-man's copy/paste promoting smaller C utilities, also
13
+
serving as a nice way to discover these sort of libraries. From my experience
14
+
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
15
+
stand-alone "micro" C libraries for developers to quickly install without coupling
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.
47
19
48
-
## About
20
+
The [listing of packages](https://github.com/clibs/clib/wiki/Packages) acts as the "registry". The registry is used by `clib(1)` when searching for packages.
49
21
50
-
Basically the lazy-man's copy/paste promoting smaller C utilities, also
51
-
serving as a nice way to discover these sort of libraries. From my experience
52
-
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
53
-
stand-alone "micro" C libraries for developers to quickly install without coupling
54
-
to large frameworks.
22
+
## Installation and building
23
+
Binaries for `clib(1)` releases can be found at [releases](https://github.com/clibs/clib/releases/).
24
+
For OSx and linux [libcurl](http://curl.haxx.se/libcurl/) should be installed and linkable.
25
+
The windows binaries do not require any libraries to be installed.
55
26
56
-
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.
27
+
See [Building](Building.md)for instructions on how to build clib.
57
28
58
-
The wiki [listing of packages](https://github.com/clibs/clib/wiki/Packages) acts as the "registry" and populates the `clib-search(1)` results.
59
29
60
30
## Usage
61
-
31
+
More detailed information on how to use `clib` can be found in [Usage](Usage.md).
62
32
```
63
33
clib <command> [options]
64
34
@@ -78,13 +48,9 @@ $ sudo make install
78
48
search [query] Search for packages
79
49
help <cmd> Display help for cmd
80
50
```
51
+
More information about the Command Line Interface can be found [here](https://github.com/clibs/clib/wiki/Command-Line-Interface).
81
52
82
-
More about the Command Line Interface [here](https://github.com/clibs/clib/wiki/Command-Line-Interface).
83
-
84
-
## Examples
85
-
86
-
More examples and best practices at [BEST_PRACTICE.md](https://github.com/clibs/clib/blob/master/BEST_PRACTICE.md).
@@ -125,13 +124,13 @@ at a example `package.json` file for your project: (executable package)
125
124
126
125
Starting from the top, `"name"` is your package name. `"version"` is your package version. `"repo"` is the location of your project, (not including the `https://github.com/`). `"dependencies"` is all the dependencies your project requires, along with there version. `"install"` is the command to install your program (ran as root), (tip: if your project requires more then one command to install it, like need to run `./configure`, before `make`, then do this: `"install": "./configure && make && make install"`). `"uninstall"` is the command to uninstall your project, [more on that later](#install-and-uninstall-executables).
127
126
128
-
_**NOTE:** Make sure you have a release as the same version in your `package.json` file, otherwise the download will fail. If you always want your package at the latest version, then put `master` as your version._
127
+
_**NOTE:** Make sure you have a release as the same version in your `clib.json` file, otherwise the download will fail. If you always want your package at the latest version, then put `master` as your version._
129
128
130
129
## Making your own libraries
131
130
132
-
Now that you know how to use libraries, heres how to make your own:
131
+
Now that you know how to use libraries, here is how to make your own:
133
132
134
-
Like before, heres a typical project directory tree:
133
+
Like before, a typical project directory tree:
135
134
136
135
```
137
136
your-library-c/
@@ -140,20 +139,20 @@ your-library-c/
140
139
│ ├── path-join.c/
141
140
│ │ ├── path-join.h
142
141
│ │ ├── path-join.c
143
-
│ │ └── package.json
142
+
│ │ └── clib.json
144
143
│ │
145
144
│ └── strdup/
146
145
│ ├─ strdup.h
147
146
│ ├─ strdup.c
148
-
│ └─ package.json
147
+
│ └─ clib.json
149
148
│
150
149
├── LICENSE
151
150
│
152
151
├── Makefile
153
152
│
154
153
├── README.md
155
154
│
156
-
├── package.json
155
+
├── clib.json
157
156
│
158
157
├── src/
159
158
│ ├── library.c
@@ -165,11 +164,11 @@ your-library-c/
165
164
166
165
Also like before, your have a `deps` directory (depending on your library, you may not need any
167
166
dependencies). Your `Makefile` in this case it is only for the `test.sh`, not needed for installing.
168
-
`package.json` contains your library name, dependencies (if you need them), keywords, etc... In
167
+
`clib.json` contains your library name, dependencies (if you need them), keywords, etc... In
169
168
`src/` contains your make code (usally the same name as your library). And you have your `test.sh`
170
169
used for testing.
171
170
172
-
### Example package.json for libraries
171
+
### Example clib.json for libraries
173
172
174
173
```
175
174
{
@@ -194,14 +193,14 @@ used for testing.
194
193
}
195
194
```
196
195
197
-
The main differences (between this, and the executable `package.json`), is now there is `"src"`,
196
+
The main differences (between this, and the executable `clib.json`), is now there is `"src"`,
198
197
this is where your make library source code is, your can change it, but src is petty standard.
199
198
200
199
**TIP:** In the `"dependencies"` section, if you define `"*"` as the version, clib will install
201
200
the latest version of that library.
202
201
203
202
_**NOTE:** Just like your executable package, you will want to tag a release with the same name
204
-
as your version specified in your `package.json`._
By default `clib` uses the [listing of packages](https://github.com/clibs/clib/wiki/Packages) as the place to look for packages, the registry, and [github.com](https://github.com) for downloading packages.
235
+
You can specify additional registries and download from other repositories than github.
236
+
This might be useful when using `clib` to install a mix of private and public packages.
237
+
238
+
### Adding additional registries
239
+
Additional registries can be provided in the `clib.json` of a project.
240
+
Currently github wiki's and gitlab — both [gitlab.com](https://www.gitlab.com) and self hosted — are supported.
241
+
For gitlab the format is a bit complicated as it has to conform to the gitlab api.
242
+
You should use the same format as the default registry but in a file in a repository instead of in a wiki.
_**CAUTION:** For gitlab, the url should be of the form `/project/<id>` and not `/group/repo` check [my-gitlab-registry](https://gitlab.com/nouwaarom/my-clib-registry) for an example._
254
+
255
+
### Downloading from gitlab or private sources
256
+
To download from some sources, authentication might be required.
257
+
To facilitate this `clib_secrets.json` is used to store the credentials.
258
+
259
+
```json
260
+
{
261
+
"github.com": "GITHUB_API_TOKEN",
262
+
"github.example.com": "GITLAB_USER_TOKEN"
263
+
}
264
+
```
265
+
266
+
Gitlab always requires a secret in order to use the API.
267
+
The secret can be obtained by clicking your profile and then (Preferences -> Access Tokens) and create a token with only `read_repository` rights.
268
+
269
+
_**TIP:** To prevent accidentally commiting your secrets add `clib_secrets.json` to `.gitignore` and use `clib_secrets.json.dist` to specify for which domains a secret is required._
0 commit comments