{"id":15049299,"url":"https://github.com/begriffs/libderp","last_synced_at":"2025-04-10T02:05:05.409Z","repository":{"id":141768184,"uuid":"350188396","full_name":"begriffs/libderp","owner":"begriffs","description":"C collections. Easy to build, boring algorithms. Dumb is good.","archived":false,"fork":false,"pushed_at":"2022-11-27T01:51:07.000Z","size":122,"stargazers_count":48,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-02T17:42:42.848Z","etag":null,"topics":["c","c99","collection","library"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/begriffs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-22T03:01:10.000Z","updated_at":"2024-11-07T23:14:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"8235e2be-3cbb-4b96-a06b-779692f0f7c3","html_url":"https://github.com/begriffs/libderp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begriffs%2Flibderp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begriffs%2Flibderp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begriffs%2Flibderp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/begriffs%2Flibderp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/begriffs","download_url":"https://codeload.github.com/begriffs/libderp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239114225,"owners_count":19583985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","c99","collection","library"],"created_at":"2024-09-24T21:19:36.172Z","updated_at":"2025-02-16T09:31:48.097Z","avatar_url":"https://github.com/begriffs.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## libderp, yet another C collection library\n\nWhy you might use it\n\n* builds with any variant of make, any C99 compiler\n* a proper library that you can link against\n* no abuse of translation units, no weird macros\n* includes proper man pages (TODO)\n* shared and static library\n* pkg-config interface\n* developer friendly ISC license\n\nWhy you might avoid it\n\n* containers use void pointers, e.g. no vector of ints\n* pedestrian algorithms, not cutting edge\n* not (yet) thread safe\n\n### Installation\n\nCompile the shared and static libraries:\n\n```sh\n# detect proper way to generate shared library\n./configure\n\n# create static and shared libs in build/release\nmake\n```\n\n#### Installing development assets (for the linker)\n\nTo install libraries that an application would link with, along with headers,\nand pkg-config specifications, use the `install-dev.sh` script:\n\n```sh\n# (if path is omitted, it defaults to /opt)\n./install-dev.sh /path\n```\n\nThe result will be a folder structure like this:\n\n```\n/path/libderp-dev.x.y.z\n├── libderp.pc\n├── libderp-static.pc\n├── include\n│   └── derp\n│       ├── ...\n│       └── ...\n├── lib\n│   ├── libderp.so (or dylib or dll)\n│   └── static\n│       └── libderp.a\n└── man\n    ├── ...\n    └── ...\n```\n\nThe easiest way to build against these files is to use pkg-config, which will\nprovide the correct compiler/linker flags.\n\n```sh\n# make desired libderp version visible to pkg-config\nexport PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH:/path/libderp.x.y.z\"\n\n# compile foo.c and link with libderp\ncc `pkg-config --cflags --libs-only-L libderp` \\\n\t-o foo foo.c `pkg-config --libs-only-l libderp`\n```\n\nTo link statically against the library, change the pkg-config name `libderp` to\n`libderp-static`.\n\n#### Installing runtime assets (for the loader)\n\nTo install the shared library for loading, use the `install.sh` script.\n\n```sh\n# (if path is omitted, it defaults to /usr/local/lib)\n./install.sh /path\n```\n\nThis copies the shared library, and creates symbolic links to match the soname\nthat applications are built against.\n\n### Using a different memory allocator\n\nBy default, libderp uses memory allocation from the C standard library.\nHowever, if you want it to use a different set of functions, specify them with\na call to `derp_use_alloc_funcs()` prior to any other libderp API calls:\n\n```c\n/* for instance, Boehm GC: */\nderp_use_alloc_funcs(GC_malloc, GC_realloc, GC_free);\n```\n### Contributing to Libderp\n\nTo build in `build/dev` with warnings, leak checks, and code coverage data, use\nthe \"dev\" variant:\n\n```sh\n# requires clang\nmake VARIANT=dev\n```\n\nObject files for the dev and release variants can coexist. There is no `make\nclean` target because there shouldn't be a need to do that manually. The\nMakefile has an accurate dependency graph, so running `make` should always know\nwhat to update.\n\n### Running tests\n\n```sh\nmake VARIANT=dev tests\n\n./build/dev/test/run\n```\n\nThe dev variant uses the Boehm garbage collector, if available, [for leak\ndetection](https://www.hboehm.info/gc/leak.html). Boehm is available on more\nplatforms than the Clang address sanitizer is.\n\nTo see test coverage for a data structure, run the cov script:\n\n```sh\n./build/dev/test/cov hashmap\n```\n\n### Customizing the build\n\n#### Cross compiling\n\nThe macros `CC`, `AR` and `EXTRA_CFLAGS` can be used to cross-compile for other\narchitectures. For instance, here is how to compile a static library for ARM\nCortex M4 with hardware floating point support:\n\n```sh\nmake CC=arm-none-eabi-gcc AR=arm-none-eabi-ar \\\n     EXTRA_CFLAGS=\"-mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16\" \\\n     build/release/libderp.a\n```\n\nNote that the library uses the dynamic memory allocation functions malloc,\nfree, and realloc, as well as the functions memmove and memset. Thus it needs a\nC standard library implementation (like newlib) to function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbegriffs%2Flibderp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbegriffs%2Flibderp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbegriffs%2Flibderp/lists"}