Skip to content

Commit

Permalink
Reduce code duplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonardLaszlo committed Jul 12, 2021
1 parent 9d9200c commit f1e9c5e
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 206 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
# NW.js ARMv7 binaries

Hey, thanks for reading me. TLDR; The NW.js ARMv7 binaries are located under the [Releases][1] tab.
The NW.js ARMv7 and ARMv8 (experimental) binaries are located under the [Releases][1] tab.

## Experimental 64 bit binaries are now available

64 bit and 32 bit binaries are packaged and released separately. The 64 bit package does not contain the SDK versions.

## Contributing

If you would like to support this project, the biggest contribution at the moment would be a self-hosted Github runner or a docker host on which the build will be executed. A virtual machine or access to a cloud ubuntu x64 instance would be nice as well. The building process is resource intensive, at least 10 GB of RAM,
4GB of swap, 110 GB of disk, are needed, and of course, as many CPUs as possible.
The most needed contribution at the moment is a self-hosted Github runner or a docker host for the build execution.
A virtual machine or access to a cloud ubuntu x64 instance could be useful as well.

Another way to support this project is to join as a maintainer, and fix the building script when it fails.
The building process is resource intensive, the minimal requirements are:
- 10 GB of RAM,
- 4GB of swap,
- 110 GB of disk,
- and of course, as many CPU cores as possible.

Another way to support this project is to join as a maintainer, and patch the building script once in a while.

## Instructions for running your NW.js application on Linux ARMv7

After downloading the archive and unpacking it, the NW.js binary can be executed on Linux ARMv7 devices with the following command:
After downloading the archive and unpacking it, the NW.js binary can be executed on Linux ARMv7 devices with:

`./nw --use-gl=egl --ignore-gpu-blacklist --disable-accelerated-2d-canvas --num-raster-threads=2`

Thanks **@gripped**, **@jtg-gg** and **@llamasoft** for their endless patience and continuous help!

## Docker

Thanks to Docker containerization, building NW.js for ARMv7 is now as easy as it gets.
However the building process is resource intensive, so I suggest at least 10 GB of RAM,
4GB of swap, 110 GB of disk, and ofc, as many CPUs as possible.
Thanks to Docker containerisation, building NW.js for ARMv7 is now as easy as it gets.
However the building process is resource intensive, so brace yourselves. See:

``` Bash
./automatic-build.sh
```

for a starting point.

## Further reading

The documentation of older builds is available under the [.archive][2] directory.
Expand Down
50 changes: 21 additions & 29 deletions automatic-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,45 +178,40 @@ function pushImageToDockerHubIfNeeded {
}

function buildNwjs {
log "Updating branch"
ARCH="$1"
case "$ARCH" in
arm32)
ARCHIVE_NAME=${NWJS_BRANCH}_$(date +"%Y-%m-%d").tar.gz
;;
arm64)
ARCHIVE_NAME=${NWJS_BRANCH}-arm64_$(date +"%Y-%m-%d").tar.gz
;;
*)
error "Unsupported arch: $ARCH"
exit 1;
;;
esac
log "Start building $ARCHIVE_NAME"
log "Updating branch $NWJS_BRANCH"
docker "$DOCKER_PARAMS" cp checkout-branch.sh "$CONTAINER_ID":/usr/docker
docker "$DOCKER_PARAMS" exec --interactive --tty "$CONTAINER_ID" /usr/docker/checkout-branch.sh "$NWJS_BRANCH"
log "Finished updating branch"
commitImageIfNeeded
pushImageToDockerHubIfNeeded
log "Start building $NWJS_BRANCH"
docker "$DOCKER_PARAMS" cp build-nwjs.sh "$CONTAINER_ID":/usr/docker
docker "$DOCKER_PARAMS" exec --interactive --tty "$CONTAINER_ID" /usr/docker/build-nwjs.sh "$NWJS_BRANCH"
log "Building $NWJS_BRANCH was successful"
ARCHIVE_NAME=${NWJS_BRANCH}_$(date +"%Y-%m-%d").tar.gz
log "Create $ARCHIVE_NAME archive"
docker "$DOCKER_PARAMS" exec --interactive --tty "$CONTAINER_ID" \
sh -c "tar --force-local -zcvf ${ARCHIVE_NAME} /usr/docker/dist/*"
mkdir -p binaries
log "Copy artifact $ARCHIVE_NAME from container to host"
docker "$DOCKER_PARAMS" cp "$CONTAINER_ID":/usr/docker/"$ARCHIVE_NAME" ./binaries/
log "Artifact $ARCHIVE_NAME copied successfully"
}

function buildNwjsArm64 {
log "Updating branch"
docker "$DOCKER_PARAMS" cp checkout-branch.sh "$CONTAINER_ID":/usr/docker
docker "$DOCKER_PARAMS" exec --interactive --tty "$CONTAINER_ID" /usr/docker/checkout-branch.sh "$NWJS_BRANCH"
log "Finished updating branch"
commitImageIfNeeded
pushImageToDockerHubIfNeeded
log "Start building $NWJS_BRANCH"
docker "$DOCKER_PARAMS" cp build-nwjs-arm64.sh "$CONTAINER_ID":/usr/docker
docker "$DOCKER_PARAMS" exec --interactive --tty "$CONTAINER_ID" /usr/docker/build-nwjs-arm64.sh "$NWJS_BRANCH"
docker "$DOCKER_PARAMS" exec --interactive --tty "$CONTAINER_ID" /usr/docker/build-nwjs.sh "$NWJS_BRANCH" "$ARCH"
log "Building $NWJS_BRANCH was successful"
ARCHIVE_NAME=${NWJS_BRANCH}-arm64_$(date +"%Y-%m-%d").tar.gz
log "Create $ARCHIVE_NAME archive"
docker "$DOCKER_PARAMS" exec --interactive --tty "$CONTAINER_ID" \
sh -c "tar --force-local -zcvf ${ARCHIVE_NAME} /usr/docker/dist/*"
mkdir -p binaries
log "Copy artifact $ARCHIVE_NAME from container to host"
docker "$DOCKER_PARAMS" cp "$CONTAINER_ID":/usr/docker/"$ARCHIVE_NAME" ./binaries/
log "Artifact $ARCHIVE_NAME copied successfully"
if [ -n "$ARCHIVE_NAME" ] && [ -n "$GITHUB_TOKEN" ]; then
releaseOnGithub "$ARCHIVE_NAME"
fi
}

function stopContainer {
Expand Down Expand Up @@ -257,10 +252,7 @@ else
docker "$DOCKER_PARAMS" start "$CONTAINER_ID"
fi
cleanDockerIfNeeded
buildNwjs
buildNwjsArm64
buildNwjs arm32
buildNwjs arm64
stopContainer
if [ -n "$ARCHIVE_NAME" ] && [ -n "$GITHUB_TOKEN" ]; then
releaseOnGithub "$ARCHIVE_NAME"
fi
cleanDockerIfNeeded
145 changes: 0 additions & 145 deletions build-nwjs-arm64.sh

This file was deleted.

Loading

0 comments on commit f1e9c5e

Please sign in to comment.