{"id":21614616,"url":"https://github.com/rhardih/bad","last_synced_at":"2025-08-08T23:06:46.003Z","repository":{"id":43367771,"uuid":"113839718","full_name":"rhardih/bad","owner":"rhardih","description":"A collection of docker files for cross compiling various native libraries","archived":false,"fork":false,"pushed_at":"2023-01-22T09:44:02.000Z","size":137,"stargazers_count":24,"open_issues_count":7,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-11T07:07:18.559Z","etag":null,"topics":["android","android-ndk","docker","make","makefile","native-libraries"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhardih.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-11T09:36:38.000Z","updated_at":"2024-05-11T15:07:43.000Z","dependencies_parsed_at":"2023-02-12T15:17:07.761Z","dependency_job_id":null,"html_url":"https://github.com/rhardih/bad","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rhardih/bad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhardih%2Fbad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhardih%2Fbad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhardih%2Fbad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhardih%2Fbad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhardih","download_url":"https://codeload.github.com/rhardih/bad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhardih%2Fbad/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269502567,"owners_count":24427790,"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","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["android","android-ndk","docker","make","makefile","native-libraries"],"created_at":"2024-11-24T22:08:36.638Z","updated_at":"2025-08-08T23:06:45.978Z","avatar_url":"https://github.com/rhardih.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bad\n\n**[B](https://github.com/rhardih/bad)uilding for [A](https://github.com/rhardih/bad)ndroid with [D](https://github.com/rhardih/bad)ocker**\n\nThis is a collection of Dockerfiles, for building various native libraries using\nthe Android NDK.\n\n## Why?\n\nCross compiling native libraries can sometimes be a\n[**pita**](https://www.urbandictionary.com/define.php?term=pita). More often than\nnot, you'll need architecture specific versions of dependent libraries in order\nto succeed and you'll quickly find yourself cross compiling those dependencies,\nas well as the their dependencies, and so on and so forth.\n\nIt's turtles all the way down.\n\nWouldn't it be nice to just be able to `make` that library you need, without having to get into different toolchains, build systems etc. etc.\n\nThat is what this project aims to accomplish. By using [**docker**](https://www.docker.com), it's possible to lock down a specific enviroment with just the right dependencies met, in order to successfully build a specific native library for the architecture of your choice.\n\nThat's the beauty of an immutable build system. If it builds *once*, it will *always* build!\n\n## Naming convention\n\nContainers are named according to the following convention:\n\n`bad-\u003cname\u003e:\u003cversion\u003e-\u003carchitecture\u003e`\n\nSo as an example, the container to build an *armv7-a* version of **libsqlite3** v. 3.21.0, would have the following name:\n\n`bad-sqlite3:3.21.0-armv7-a`\n\n## Building\n\nAll libraries are compiled from source. Each build downloads the corresponding\nsource at run time, which means the success of a build is tied to the\navailability of the sources online.\n\nIn case a repository goes down, or is unreachable at the time of a build,\nthere's just no way to make it succeed. This trade-off is a concious decision,\nin order to waiver any concerns about source tampering, which would naturally\nfollow if sources were bundled.\n\n---\n\n[Make](https://www.gnu.org/software/make) is used, to define the various build\ntargets and dependencies.\n\n\n### Example\n\nIn order to build **libsqlite3**, this command would do:\n\n`make sqlite3`\n\nNote, extra options for `docker build`, can be passed via `BUILD_ARGS` e.g.:\n\n`make BUILD_ARGS=\"--no-cache\" sqlite3`\n\nOnce it's done, the libraries are available under the install target, `/sqlite3-build`, within the container.\n\n```bash\n$ docker run --rm -it bad-libsqlite3\nroot@bcd377ee512d:/sqlite# ls -la /sqlite3-build/lib/\ntotal 6696\ndrwxr-xr-x 3 root root    4096 Dec 11 09:34 .\ndrwxr-xr-x 5 root root    4096 Dec 11 09:34 ..\n-rw-r--r-- 1 root root 4135994 Dec 11 09:34 libsqlite3.a\n-rwxr-xr-x 1 root root     943 Dec 11 09:34 libsqlite3.la\nlrwxrwxrwx 1 root root      19 Dec 11 09:34 libsqlite3.so -\u003e libsqlite3.so.0.8.6\nlrwxrwxrwx 1 root root      19 Dec 11 09:34 libsqlite3.so.0 -\u003e libsqlite3.so.0.8.6\n-rwxr-xr-x 1 root root 2701988 Dec 11 09:34 libsqlite3.so.0.8.6\ndrwxr-xr-x 2 root root    4096 Dec 11 09:34 pkgconfig\n```\n\nIf you need to, you can copy them to the host using the included extraction\nscript. The script is available as a built-in\n**[sub](https://github.com/basecamp/sub)** command. First make the\n**bad** command available, by initalising the sub like so:\n\n```bash\n$ eval \"$(.bad/bin/bad init -)\"\n```\n\nThen issue the sub command *extract*, e.g:\n\n```bash\nbad extract sqlite3-3.21.0\n```\n\nNote, in order to see which targets can currently be extracted, either use the\nbuilt-in tab completion or use the related `bad list` sub command.\n\nOnce done, you should have all the files from the installation, available under\nthe subfolder *extracted*:\n\n```bash\n$ tree extracted/sqlite3-3.21.0-build/\nextracted/sqlite3-3.21.0-build/\n├── bin\n│   └── sqlite3\n├── include\n│   ├── sqlite3.h\n│   └── sqlite3ext.h\n└── lib\n    ├── libsqlite3.a\n    ├── libsqlite3.la\n    ├── libsqlite3.so -\u003e libsqlite3.so.0.8.6\n    ├── libsqlite3.so.0 -\u003e libsqlite3.so.0.8.6\n    ├── libsqlite3.so.0.8.6\n    └── pkgconfig\n        └── sqlite3.pc\n\n4 directories, 9 files\n```\n\n**Alternatively** you can run the same docker command directly yourself:\n\n```bash\n$ docker run --rm -i -v `pwd`/extracted:/host bad-libsqlite3:3.21.0 \\\n  cp -r /sqlite3-build /host/sqlite3-3.21.0-build\n```\n\n### Versions\n\nFor some make rules it's possible to build specific versions of a target using\nthe following form:\n\n`make sqlite3/3.21.0`\n\nCheck the [Makefile](https://github.com/rhardih/bad/blob/master/Makefile) to see\nwhich ones.\n\n## Dependencies\n\nFirst and foremost **docker**. See\n[https://docs.docker.com/engine/installation](https://docs.docker.com/engine/installation)\nfor installation instructions.\n\nBesides this, most Dockerfiles uses a containerised NDK toolchain build with\n[stand](https://github.com/rhardih/stand). A list of current available\ntoolchains can be seen at\n[https://hub.docker.com/r/rhardih/stand/tags](https://hub.docker.com/r/rhardih/stand/tags)\nand new ones can be be created using [By](https://github.com/rhardih/by),\navailable at [https://standby.rhardih.io](https://standby.rhardih.io).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhardih%2Fbad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhardih%2Fbad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhardih%2Fbad/lists"}