From f2041ef19f4fc556b7ff210a7fae9f934a652edc Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 24 Sep 2023 13:49:28 -0300 Subject: [PATCH 1/9] docker build --- Dockerfile | 28 ++++++++++++++++++++++++++++ Makefile.docker | 13 +++++++++++++ README-docker.md | 25 +++++++++++++++++++++++++ README.md | 5 +++++ 4 files changed, 71 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile.docker create mode 100644 README-docker.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..691355a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:20.04 +ARG DEBIAN_FRONTEND=noninteractive +RUN apt update -y && apt install -y autoconf autoconf-archive automake gcc curl zip unzip \ +libsdl2-dev python3-pygame libreadline-dev git +# make sure you have src packages enabled for dependency information +RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted" > /etc/apt/sources.list.d/ngdevkit.list +RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ focal universe" >> /etc/apt/sources.list.d/ngdevkit.list +RUN apt update -y +# install build-dependency packages +RUN export GCC_VERSION_PKG=`apt-cache depends gcc | awk '/Depends.*gcc/ {print $2}'` \ +&& echo "GCC_VERSION_PKG=$GCC_VERSION_PKG" \ +&& apt build-dep -y $GCC_VERSION_PKG \ +&& apt build-dep -y --arch-only sdcc +# optional: install GLEW for OpenGL+GLSL shaders in GnGeo +RUN apt install -y libglew-dev +# dependencies for the example ROMs +RUN apt install -y imagemagick sox libsox-fmt-mp3 + +## Building the toolchain +WORKDIR /ngdevkit +COPY . . +RUN autoreconf -iv \ +&& ./configure --prefix=$PWD/local \ +&& make \ +&& make install + +# ngdevkit-gngeo +RUN make shellinit >> ~/.bashrc \ No newline at end of file diff --git a/Makefile.docker b/Makefile.docker new file mode 100644 index 0000000..0c0e0ae --- /dev/null +++ b/Makefile.docker @@ -0,0 +1,13 @@ +docker: + docker build . -t ndevkit + +shell: docker + docker run -it --rm -v `pwd`:/tmp/workdir -w /tmp/workdir ndevkit bash + +USER=hldtux +IMAGE=ndevkit +TAGNAME=latest +push: + docker tag ${IMAGE} ${USER}/${IMAGE}:${TAGNAME} + docker push ${USER}/${IMAGE}:${TAGNAME} + diff --git a/README-docker.md b/README-docker.md new file mode 100644 index 0000000..90db640 --- /dev/null +++ b/README-docker.md @@ -0,0 +1,25 @@ +# Building ngdevkit from source on any platform that supports Docker + +## Pre-requisite + +* Docker + +### Shell +The following command will let access the container that contains the embedded devkit and the current folder at /tmp/workdir. So, you will be able to make the build your on rom easily without any local dependency + +```shell +make -f Makefile.docker shell +``` + +### Push +To avoid waiting the image creating you can push the finished one as following + +```shell +make -f Makefile.docker USER= push +``` + +Congratulations! You are now ready to experiment with the devkit. +Please follow the [main README](README.md) for additional information +on how to download and build the example ROMs, run the emulator or +run the debugger. + diff --git a/README.md b/README.md index f7bc8da..ba6cf10 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,11 @@ For macOS, make sure you use brew's python3 and gmake: ./configure gmake +For any platform that supports docker + +```shell +make -f Makefile.docker shell +``` ### Running the emulator From 2dec4a00eabefbd5f78060d4ed5fff5b73eff7b8 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 24 Sep 2023 14:35:26 -0300 Subject: [PATCH 2/9] README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ba6cf10..b66ef54 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,12 @@ is now deprecated in favour of the native MSYS2 environment. Likewise, we no longer build nightly packages for MSYS2's mingw64 subsystem, ucrt64 is the only supported subsystem for ngdevkit. +#### Docker + +```shell +make -f Makefile.docker shell +``` + ### Build the included examples The devkit comes with a series of examples to demonstrate how to use From 92fdb12adba6cc776dc82762b7f3d6c9fd6eb99b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 24 Sep 2023 20:03:07 -0300 Subject: [PATCH 3/9] DOCKER_DEFAULT_PLATFORM=linux/amd64 --- Makefile.docker | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile.docker b/Makefile.docker index 0c0e0ae..bae1597 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -1,13 +1,14 @@ +IMAGE=hldtux/ndevkit +TAG=latest +# Forcing amd64 arch +DOCKER_DEFAULT_PLATFORM=linux/amd64 + docker: - docker build . -t ndevkit + docker build . -t ${IMAGE} shell: docker - docker run -it --rm -v `pwd`:/tmp/workdir -w /tmp/workdir ndevkit bash + docker run -it --rm -v `pwd`:/tmp/workdir -w /tmp/workdir ${IMAGE} bash -USER=hldtux -IMAGE=ndevkit -TAGNAME=latest push: - docker tag ${IMAGE} ${USER}/${IMAGE}:${TAGNAME} - docker push ${USER}/${IMAGE}:${TAGNAME} + docker push ${IMAGE}:${TAG} From fbc6453e831ee25a7042787b202e859238adabd6 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 24 Sep 2023 21:02:07 -0300 Subject: [PATCH 4/9] DOCKER_DEFAULT_PLATFORM=linux/amd64 --- Makefile.docker | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.docker b/Makefile.docker index bae1597..ed2d71b 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -1,4 +1,7 @@ +# Remote image IMAGE=hldtux/ndevkit +# Local image +#IMAGE=ndevkit TAG=latest # Forcing amd64 arch DOCKER_DEFAULT_PLATFORM=linux/amd64 From 67e654e74d325cd38e0039ce2cd3fa6a101597ad Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 24 Sep 2023 21:40:46 -0300 Subject: [PATCH 5/9] typo --- Makefile.docker | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.docker b/Makefile.docker index ed2d71b..542d9df 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -1,6 +1,8 @@ # Remote image IMAGE=hldtux/ndevkit # Local image +# make IMAGE=ndevkit -f Makefile.docker +# or #IMAGE=ndevkit TAG=latest # Forcing amd64 arch From d28b1631ceb25fe810393e75141735ba82579b27 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 25 Sep 2023 14:27:02 -0300 Subject: [PATCH 6/9] build-and-publish-docker --- .../workflows/build-and-publish-docker.yaml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/build-and-publish-docker.yaml diff --git a/.github/workflows/build-and-publish-docker.yaml b/.github/workflows/build-and-publish-docker.yaml new file mode 100644 index 0000000..c686d54 --- /dev/null +++ b/.github/workflows/build-and-publish-docker.yaml @@ -0,0 +1,34 @@ +name: Deploy + +on: + workflow_dispatch: + inputs: + image: + default: "hldtux/ndevkit" + description: "Docker image name" + +jobs: + build: + name: ngdevkit + runs-on: ubuntu-latest + environment: DockerHub + + steps: + + # Checkout + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + path: . + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Deploy + run: | + make IMAGE=${{ github.event.inputs.image }} -f Makefile.docker push + \ No newline at end of file From 485ae6cbd7266f3e4a977064056e6cebab62f5bc Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 25 Sep 2023 14:27:53 -0300 Subject: [PATCH 7/9] typo --- .github/workflows/build-and-publish-docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish-docker.yaml b/.github/workflows/build-and-publish-docker.yaml index c686d54..e7eb5ee 100644 --- a/.github/workflows/build-and-publish-docker.yaml +++ b/.github/workflows/build-and-publish-docker.yaml @@ -1,4 +1,4 @@ -name: Deploy +name: Build and Publish Docker on: workflow_dispatch: From ab3e863f83f4d3af47e4040cb315d444ffa2d3da Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 25 Sep 2023 14:33:21 -0300 Subject: [PATCH 8/9] typo --- .github/workflows/build-and-publish-docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish-docker.yaml b/.github/workflows/build-and-publish-docker.yaml index e7eb5ee..24590d5 100644 --- a/.github/workflows/build-and-publish-docker.yaml +++ b/.github/workflows/build-and-publish-docker.yaml @@ -30,5 +30,5 @@ jobs: - name: Build and Deploy run: | - make IMAGE=${{ github.event.inputs.image }} -f Makefile.docker push + make IMAGE=${{ github.event.inputs.image }} -f Makefile.docker docker push \ No newline at end of file From c98a6f4da489e9d8a5f7cf26c562340b926fb420 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 25 Sep 2023 15:15:10 -0300 Subject: [PATCH 9/9] typo --- .github/workflows/build-and-publish-docker.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish-docker.yaml b/.github/workflows/build-and-publish-docker.yaml index 24590d5..19afcf5 100644 --- a/.github/workflows/build-and-publish-docker.yaml +++ b/.github/workflows/build-and-publish-docker.yaml @@ -9,7 +9,7 @@ on: jobs: build: - name: ngdevkit + name: ngdevkit ${{ github.event.inputs.image }} runs-on: ubuntu-latest environment: DockerHub @@ -31,4 +31,5 @@ jobs: - name: Build and Deploy run: | make IMAGE=${{ github.event.inputs.image }} -f Makefile.docker docker push + echo "https://hub.docker.com/r/${{ github.event.inputs.image }}" \ No newline at end of file