Giter Site home page Giter Site logo

static-toolbox's Introduction

STATIC TOOLBOX

compile release

Dockerfile based build scripts to compile various static binaries of useful tools.

I often found myself in shells where I needed a newer version of a particular tool, which was not available through the package manager .. or the system even lacked a package manager to begin with. In that case it can be helpful to have portable binaries that you can just copy to the target without worrying about library dependencies and be able to use it right away.

The scripts placed in build/ are Dockerfiles that must be built with the builtkit frontend. However, the end result is not a container image but a built binary that is saved in the compiled/ directory, which you can then copy where-ever you like. The fact that everything is built inside a container means that you do not need to provide any specific build environment โ€“ besides an installation of Docker.

Using the buildx plugin you can even compile binaries for another platform by starting a multi-platform capable builder instance and adding a --platform argument.

DOWNLOAD

The binaries are compiled in a GitHub workflow regularly. These precompiled binaries and all the downloaded sources that were used can be found in the action artifacts: click on a run and download the corresponding archive form the build artifacts.

REQUIREMENTS

  • Docker with buildkit support / buildx plugin, i.e. at least 19.03
  • make, find, sed

USAGE

Available build targets are given by the Dockerfiles in build/:

  • make busybox
  • make curl
  • make fdisk
  • make git
  • make gpg
  • make make
  • make openssl
  • make rsync
  • make vim
  • make zstd

The output will be placed in compiled/ in a subdirectory matching your native platform.

Some of the scripts use GPG signatures for which the trusted signing keys are stored in build/*.keys files and are imported before checking the downloaded sources.

OTHER PLATFORMS

First, setup buildx for multi-platform building. Let's assume you already ran docker buildx create --use ... etc. and your currently used build server is multi-platform capable. Then you should be able to use the --platform argument with docker build invocations, too.

The Makefile contains targets for most available platforms. In order to build fdisk for linux/arm64 you'd use the compiled/linux-arm64/fdisk/ target:

make compiled/linux-arm64/fdisk/

I haven't actually tested all combinations yet, because it takes a very long time under emulation. Available target platforms are:

  • linux-amd64
  • linux-arm64
  • linux-armv7
  • linux-armv6
  • linux-riscv64
  • linux-s390x
  • linux-386

MANUAL BUILDS

If you want to add some other arguments to docker build or want to create your own script, this is the command the gets executed in the example above:

DOCKER_BUILDKIT=1 docker build -f build/fdisk build/
  --target binary -o type=local,dest=compiled/linux-arm64/fdisk/ \
  --platform linux/arm64

ADD YOUR OWN

Add your own build scripts in build/:

  • add a Dockerfile named like the binary you want to compile
  • use seperate RUN commands for better caching of steps
  • the build/ directory will be the context, so you may add scripts and COPY them
  • use a final FROM scratch AS binary stage and only copy the output binary into this rootfs

static-toolbox's People

Contributors

ansemjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

78-comints

static-toolbox's Issues

Check LICENSES to see if I can build and release some of the binaries

Licenses like the GPL allow distribution of binaries iff I also supply the full sourcecode from which they were generated along with attribution and license notices.

Since the sourcecode for each application is downloaded and verified on-the-fly it is not stored in this repository anywhere. I could maybe add another Dockerfile target stage which also bundles the source code from which the binary was built?

rewrite release workflow to build each one individually

There was a build failure on git the last two runs, which meant that no artifact was produced at all. It is probably better to remember that there was an error but only fail the workflow after an artifact of all successfully built binaries has been created?

find correct version for util-linux

The fdisk build which is based on util-linux failed the second time in a row because the build script can't find the correct source package.

  • It looks at the directory listing
  • finds 2.38
  • tries /util-linux/v2.38/util-linux-2.38.tar.xz
  • fails with a 404

That's because the 2.38 directory only contains an -rc1 so far. I also noticed that previous versions have patch releases (like 2.37.4), which won't get picked up by the same logic ... I probably need one more request to check the directory listing inside a version for the latest version. Shall I pick RC candidates that I find or loop to the next minor version?

zstd build broken

#17 83.56 compiling dynamic library 1.4.9
#17 83.58 /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
#17 83.58 /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/crtend.o: relocation R_X86_64_32 against `.ctors' can not be used when making a shared object; recompile with -fPIC
#17 83.59 collect2: error: ld returned 1 exit status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.