{"id":46381033,"url":"https://github.com/sailfishos-open/docker-sailfishos-builder","last_synced_at":"2026-03-05T06:07:44.787Z","repository":{"id":185174319,"uuid":"623092154","full_name":"sailfishos-open/docker-sailfishos-builder","owner":"sailfishos-open","description":"Docker based Sailfish OS build environment","archived":false,"fork":false,"pushed_at":"2024-10-17T05:12:03.000Z","size":60,"stargazers_count":6,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-19T07:27:10.426Z","etag":null,"topics":["docker","sailfishos"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sailfishos-open.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-03T17:18:43.000Z","updated_at":"2024-10-17T05:12:07.000Z","dependencies_parsed_at":"2023-08-01T00:17:59.953Z","dependency_job_id":"ee2c4afe-36f0-44fb-bd3a-191c195bedfb","html_url":"https://github.com/sailfishos-open/docker-sailfishos-builder","commit_stats":null,"previous_names":["sailfishos-open/docker-sailfishos-builder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sailfishos-open/docker-sailfishos-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailfishos-open%2Fdocker-sailfishos-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailfishos-open%2Fdocker-sailfishos-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailfishos-open%2Fdocker-sailfishos-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailfishos-open%2Fdocker-sailfishos-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sailfishos-open","download_url":"https://codeload.github.com/sailfishos-open/docker-sailfishos-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailfishos-open%2Fdocker-sailfishos-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30111801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["docker","sailfishos"],"created_at":"2026-03-05T06:07:44.032Z","updated_at":"2026-03-05T06:07:44.724Z","avatar_url":"https://github.com/sailfishos-open.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sailfish OS build environment based on containers\n\nThis is an alternative build environment for Sailfish OS. In contrast\nto the official SDKs, it doesn't use\n[Scratchbox2](https://github.com/sailfishos/scratchbox2)\n(SB2). Instead, it relies on running either native or through QEMU\nhardware emulation. When using QEMU emulation, expect slow\ncompilation speeds when compared to SB2.\n\nThis environment can be used either on PC/server or in a cloud using container\ninstances. If needed, in addition to work with the local files, it allows you\nto pull the sources from git repository before the build and push artifacts to S3\nbucket.\n\nThis build environment was created to address official SDK limitations\nencountered while packaging Qt 5.15 for Sailfish OS. You may want to\nuse it if you have a project that is difficult or impossible to\ncompile using the official SDK.\n\nOn PC/servers, it is recommended to use the environment with `podman`. While docker may work\nas well, it is not tested with it.\n\n## How to use it\n\nBuilder images can be generated locally\n([see below for instructions](#how-to-create-builder-images)) or pulled from\n[ghcr.io](https://github.com/orgs/sailfishos-open/packages?repo_name=docker-sailfishos-builder).\n\nTo use, go to the folder of your cloned repository root and run (for `sailfishos-i486-4.6.0.13`)\nbuild command similar to:\n\n```\npodman run --rm -it -v `pwd`:/source \\\n   ghcr.io/sailfishos-open/docker-sailfishos-builder-i486:4.6.0.13 \\\n   buildrpm \\\n     -r https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/4.6.0.13_i486/\n```\n\nIf you have selinux enabled, you may have to use `:z` while mounting source\nfolder:\n```\npodman run --rm -it -v `pwd`:/source:z \\\n   ghcr.io/sailfishos-open/docker-sailfishos-builder-i486:4.6.0.13 \\\n   buildrpm \\\n     -r https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/4.6.0.13_i486/\n```\n\nIn this example, Podman container gets access to the sources by its\nvolume mapping your current folder (`pwd`) to `/source` inside the\ncontainer. Container executes `buildrpm` script inside it (see\n[sources](scripts/buildrpm)) that handles building RPMs from SPEC in\n`/source/rpm`.\n\nThere are few options that can be given to `buildrpm` script:\n\n```\n -b NAME   build name that is used to generate build information\n           file. If absent, SPEC filename is used to derive it.\n\n -s SPEC   builds using given SPEC. Here, SPEC basename is only\n\t   expected and should be located under rpm/ subfolder\n\t   of the sources. By default, the first SPEC in rpm/\n\t   subfolder is used\n\n -r REPO   additional RPM repository that is needed to fetch packages\n\t   required for building SPEC. Can be specified multiple times\n\n -d GIT:TAG download Git repository version described by Git commit ID or tag\n\n -v VENDOR set vendor for RPM\n\n -p        skip generation of source package and use the one in /source/rpm\n```\n\nIf all goes well, RPMs will be created under subfolder `RPMS` of the\nsources.\n\nNote that it is recommended to use `--rm` to remove container as soon\nas it is finished. On every build, a clean environment is used and all\nthe dependencies are pulled in again.\n\n### Using with sources in archive\n\nIn addition to the mode, where the build is performed using checked\nout sources, it is possible to build packages when the sources are\nalready available in packaged form. For example, Node.js as packaged\nat\n[OBS](https://build.merproject.org/package/show/sailfishos:chum:testing/nodejs18). In\nthis case, you have to use option `-p` and mount volumes separately\nfor `/source/rpm` and `/source/RPMS`. Here, `/source/rpm` should be\nlinked with the host folder that has RPM SPEC, source archive as\nreferenced in SPEC, and all patches. Folder `/source/RPMS` has to be\nlinked with a host folder that will receive compiled RPMS. If you\nforget to specify the latter, your compiled RPMS would stay in the\ncontainer. It is expected that `/source/rpm` and `/source/RPMS` point\nto different folders on host.\n\nExample command :\n\n```\npodman run --rm -it \\\n   -v `pwd`/../nodejs18:/source/rpm \\\n   -v `pwd`:/source/RPMS \\\n   ghcr.io/sailfishos-open/docker-sailfishos-builder-i486:4.6.0.13 \\\n   buildrpm -p -v chum \\\n       -r https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/4.6.0.13_i486/\n```\n\nIn this example, Node.js RPMs are built and saved into the current\nfolder (`pwd`). Corresponding sources are in a folder\n`../nodejs18`. It is also setting vendor to `chum` and is using one of\nChum repositories.\n\n### Using with sources that are pulled from Git repository\n\nInstead of working with local sources, it is possible to request the\nbuild environment to pull sources using Git and build them. For that,\nspecify Git repository and its tag using `url:tag` format and provide it\nby giving `-d` option to the buildrpm script in the container. Example:\n\n```\npodman run --rm -v `pwd`:/source \\\n  ghcr.io/sailfishos-open/docker-sailfishos-builder-aarch64:4.6.0.13 \\\n  buildrpm \\\n    -b tinybuild \\\n    -d https://github.com/sailfishos-chum/tinyxml2.git:68b139533c605e4ef9761b1f06c99d80215a1afd\n```\n\n### Uploading build artifacts to S3\n\nYou can instruct the builder to upload your RPMs into S3 bucket. Internally,\n[s3cmd](https://s3tools.org/usage) is used for it. To activate this mode,\nspecify and forward two environment variables:\n\n- `S3_BUCKET` name of the bucket in S3\n- `S3_OPTIONS` command line options passed to s3cmd that should define your\n  access to S3. Read s3cmd [manual page](https://s3tools.org/usage) for options\n\nIt is advisable to use `-q` option of s3cmd to avoid logging your access\ncodes. When using on PC, you can set environment variables in a file as shown below\n\n```\nS3_BUCKET=build-store\nS3_OPTIONS=-q --access_key=MYKEY --secret_key=SECRET --host=super.server.org --host-bucket=%(bucket)s.super.server.org\n```\n\nand then import these variables as in\n\n```\npodman run --rm \\\n   --env-file .s3env \\\n   ghcr.io/sailfishos-open/docker-sailfishos-builder-aarch64:4.6.0.13 \\\n   buildrpm -b tinybuild \\\n   -d https://github.com/sailfishos-chum/tinyxml2.git:68b139533c605e4ef9761b1f06c99d80215a1afd\n```\n\n## How it works\n\nInside Podman container, the build is performed in several steps.\n\nFirst, SPEC file is parsed and all the build requirements are\ninstalled.\n\nSecond, if sources are in Git repository and `-p` option was not used,\nRPM version will be determined based on the latest git tag and its\noffset from HEAD. Regardless of whether sources are in Git or not,\nrelease will be offset by UTC timestamp. Such handling of RPM version\nand release will ensure the newest builds would have larger\nversion-release pair.\n\nNext, RPM build proceeds in a classical way using `rpmbuild`, under a\ndedicated user `builder`. For that, folders for building are setup\nunder `/builder/rpmbuild`. It is possible to debug intermediate steps\nthrough creation of the volume linking to `/builder/rpmbuild` in\nthe container.\n\nBefore starting the build, your sources are packed into tar.gz (or\nbz2, xz, as given in `Source0`) under\n`/builder/rpmbuild/SOURCES`. This step is skipped if `-p` option was\ngiven. In addition, all files from your sources `rpm` subfolder are\ncopied to `/builder/rpmbuild/SOURCES`, including all patches.\n\nThen the build proceeds under user `builder` with\n`rpmbuild`. `rpmbuild` will unpack the sources, apply patches and\nproceed building your packages. After successful build, RPMs are\ncopied into your source folder under `RPMS` subfolder. For a feedback,\n`rpmlint` is applied as well.\n\nNote that, as a new clean environment is created for every build, it\nmaybe advantageous to debug the build process and reuse the same\ncontainer in the case of failure. Easiest is just start the container\nwith `bash` and execute `buildrpm` already while inside the\ncontainer. It is possible to apply the steps done by `buildrpm`\nmanually as well when inside the container.\n\n## Limitations\n\nThe scripts are not handling many cases in a flexible manner provided\nby `mb2` from official SDK. For example, during packaging, sources are\npacked and then unpacked which wastes time and allocates storage,\nuntil the container is destroyed. There are probably many other\ncases where `mb2` would be able to handle building better.\n\nDue to the way the builder works, Source0 from RPM SPEC is expected to\nbe in the form `%{name}-%{version}.tar.bz2` (.gz and .zx are supported\nas well).\n\nWhile we get rid of SB2 bugs, there are possible QEMU issues that can\ninterfere. For example, armv7hl could be hit with [issue\n#6](https://github.com/sailfishos-open/docker-sailfishos-builder/issues/6).\nSee issue for problem description. It is recommended then to check\nwhether QEMU distributed by Jolla works better.\n\n## How to create builder images\n\nBuilder container images are very easy to create using `makeimage`\nscript. Make sure you have QEMU setup working for all architectures\nthat you want to use (see below for QEMU setup, if needed).\n\nScript `makeimage` takes two arguments: SFOS architecture (i486,\naarch64, armv7hl) and SFOS version. It is also possible to specify\nwhether to use podman (default) or docker for containers. Example:\n\n```\n./makeimage i486 4.6.0.13\n```\n\nThis will create locally Podman container image `docker-sailfishos-builder-i486:4.6.0.13`. This\nimage can be used for building your packages.\n\n## QEMU setup\n\nYou need to setup binfmt for qemu for the architectures you want to use. Follow the instructions for your system\n\n### Arch-based\n\nInstall package `qemu-user-binfmt`.\n\n### Debian-based\n\nInstall package `qemu-user-static`.\n\n### Other\n\n(This part is not meant for Debian-based systems and must be skipped to avoid breaking `systemd-binfmt`)\n\nTo enable QEMU in most systemd based Linux, add `qemu-custom.conf` in\n`/etc/binfmt.d`. Example:\n\n```\n:qemu-aarch64:M::\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff\\xff:/usr/bin/qemu-aarch64:F\n:qemu-arm:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff\\xff:/usr/bin/qemu-arm:F\n```\n\nAfter that, restart systemd service:\n\n```\nsystemctl restart systemd-binfmt\n```\n\nYou should see formats registered in `/proc`:\n\n```\n# cat /proc/sys/fs/binfmt_misc/qemu-aarch64\nenabled\ninterpreter /usr/bin/qemu-aarch64\nflags: F\noffset 0\nmagic 7f454c460201010000000000000000000200b700\nmask ffffffffffffff00fffffffffffffffffeffffff\n```\n\nSee References below for how to test QEMU support using Docker images.\n\n## References\n\n- SFOS Docker scripts: https://github.com/CODeRUS/docker-sailfishos-baseimage\n- Docker architectures: https://github.com/docker-library/official-images#architectures-other-than-amd64\n- QEMU setup: https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Compiling_with_qemu_user_chroot\n- QEMU tests with Docker: https://github.com/multiarch/qemu-user-static\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsailfishos-open%2Fdocker-sailfishos-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsailfishos-open%2Fdocker-sailfishos-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsailfishos-open%2Fdocker-sailfishos-builder/lists"}