Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterize mingw dockerfile #1867

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Parameterize mingw dockerfile #1867

wants to merge 8 commits into from

Conversation

nyurik
Copy link

@nyurik nyurik commented Dec 27, 2021

This PR introduces a few improvements to the docker-based Windows builds

  • compile any published branch/tag, not just the latest master branch.
    Use docker build --build-arg GIT_TAG=<tag> ...
  • compile from another github repository, not just the official aria2/aria2.
    Use docker build --build-arg GITHUB_REPO=nyurik/aria2 ...
  • compile local code instead of downloading the github version.
    Use docker build --build-arg SOURCE=local ...
  • Control libaria2 build
    Use docker build --build-arg LIBARIA2=enable ...
  • Control static build.
    Use docker build --build-arg ARIA2_STATIC=no ...
  • Control HOST parameter. Uses i686-w64-mingw32 by default, but can be set to x86_64-w64-mingw32 to build a 64-bit binary.
    Use docker build --build-arg HOST=x86_64-w64-mingw32 ...
  • Automatically copy aria2.exe to the shared volume /output if it is provided.
    This is significantly simpler than copying from a running container.
    Running docker run --rm -v $PWD:/output aria2-mingw will place aria2.exe into $PWD/bin directory. Additionally, if LIBARIA2=enable, libs will be copied to $PWD/lib, and aria2.h will be saved to $PWD/include/aria2/aria2.h.

This PR can be tested directly from bash without cloning:

export GITHUB_REPO='nyurik/aria2'
export GIT_TAG='win'
curl https://raw.githubusercontent.com/${GITHUB_REPO}/${GIT_TAG}/Dockerfile.mingw \
  | docker build -t aria2-mingw --build-arg GITHUB_REPO --build-arg GIT_TAG --build-arg LIBARIA2=enable --build-arg HOST=x86_64-w64-mingw32 -

# Copy results to the ./output
docker run --rm -v $PWD/output:/output aria2-mingw

This PR introduces a few improvements to the docker-based Windows builds
* compile any published branch/tag, not just the latest master branch.
  Use `docker build --build-arg GIT_TAG=<tag> ...`
* compile local code instead of downloading the github version.
  Use `docker build --build-arg SOURCE=local ...`
* Control libaria2 build
  Use `docker build --build-arg LIBARIA2=enable ...`
* Control static build.
  Use `docker build --build-arg ARIA2_STATIC=no ...`
* Automatically copy the resulting binaries to the shared volume if set.
  This is significantly simpler than copying from a running container.
  Use `docker run -v $PWD:/output ...`
@nyurik nyurik changed the title Improve mingw+docker for libaria2 compilation Parameterize mingw dockerfile Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant