From 10a81c6cdfeff0f9137bed352de2330e4033099d Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 23 Jul 2018 17:23:46 +0200 Subject: [PATCH 1/3] build: Add run.sh helper script for docker Just shared as demo May be changed Change-Id: I79000463955d16eec8809c870f7d02c60da53432 Bug: https://github.com/mapbox/node-sqlite3/issues/418 Forwarded: https://github.com/mapbox/node-sqlite3/pull/1112 https://github.com/mapbox/node-sqlite3/pull/1028 Origin: https://github.com/tizenteam/node-sqlite3 Signed-off-by: Philippe Coval --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index add1e2df0..a8a979c2d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -30,4 +30,4 @@ test/nw/app.nw local.env .mason .eslintrc.js -setup.sh \ No newline at end of file +setup.sh From deac62c784011c881e7a3b19961824739fd68ab3 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 23 Jul 2018 17:23:46 +0200 Subject: [PATCH 2/3] build: Support docker to build binary package Usage: curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x - ls tmp/out/node-sqlite3/stage/sqlite3/*/node-*-*-* Or run.sh can be run in sources Change-Id: I79000463955d16eec8809c870f7d02c60da53432 Bug: https://github.com/mapbox/node-sqlite3/issues/418 Forwarded: https://github.com/mapbox/node-sqlite3/pull/1028 Origin: https://github.com/tizenteam/node-sqlite3 Signed-off-by: Philippe Coval --- Dockerfile | 7 +++ run.sh | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100755 run.sh diff --git a/Dockerfile b/Dockerfile index c14d98946..78bf2b016 100755 --- a/Dockerfile +++ b/Dockerfile @@ -74,3 +74,10 @@ RUN echo "#log: ${project}: Building sources" \ && find build/stage/ -type f \ && sync +WORKDIR /usr/local/${project}/${project} +RUN echo "#log: ${project}: Installing sources" \ + && set -x \ + && install -d /usr/local/src/${project}/ \ + && install *.tgz /usr/local/src/${project}/ \ + && cp -rfva ./build/stage/ /usr/local/src/${project}/ \ + && sync diff --git a/run.sh b/run.sh new file mode 100755 index 000000000..b1bba9bcd --- /dev/null +++ b/run.sh @@ -0,0 +1,167 @@ +#!/bin/bash +# -*- coding: utf-8 -*- +#{ +# ISC License +# Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") +# Copyright (c) 1995-2003 by Internet Software Consortium +# Permission to use, copy, modify, and /or distribute this software +# for any purpose with or without fee is hereby granted, +# provided that the above copyright notice +# and this permission notice appear in all copies. +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS. +# IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, +# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, +# NEGLIGENCE OR OTHER TORTIOUS ACTION, +# ARISING OUT OF OR IN CONNECTION WITH THE USE +# OR PERFORMANCE OF THIS SOFTWARE. +#} + +set -e +set -x + +env_() +{ + project="node-sqlite3" + org="tizenteam" + branch="master" + url_suffix="#{branch}" + + # user="rzr" # Update here if forking + # org="TizenTeam" + # branch="sandbox/${user}/${branch}" + # url_suffix="#{branch}" + url_suffix="" # TODO: For older docker + + url="https://github.com/${org}/${project}.git${url_suffix}" + run_url="https://raw.githubusercontent.com/${org}/${project}/${branch}/run.sh" + + release="0.0.0" + src=false + if [ -d '.git' ] && which git > /dev/null 2>&1 ; then + src=true + branch=$(git rev-parse --abbrev-ref HEAD) ||: + release=$(git describe --tags || echo "$release") + fi + + SELF="$0" + [ "$SELF" != "$SHELL" ] || SELF="${PWD}/run.sh" + [ "$SELF" != "/bin/bash" ] || SELF="${DASH_SOURCE}" + [ "$SELF" != "/bin/bash" ] || SELF="${BASH_SOURCE}" + self_basename=$(basename -- "${SELF}") +} + + +usage_() +{ + cat< /dev/null 2>&1 ||: + docker create --name "${container}" "${tag}" /bin/true + rm -rf "${outdir}" + mkdir -p "${outdir}" + docker cp "${container}:${dir}" "${outdir}" + echo "Check Ouput files in:" + ls "${outdir}/"* + find "${outdir}" -type f -a -iname "*.tgz" -o -iname "*.tar.*" +} + + +test_() +{ + curl -sL "${run_url}" | bash - +} + + +main_() +{ + env_ "$@" + usage_ "$@" + prep_ "$@" + build_ "$@" +} + + +main_ "$@" From 664491d70c0d2d9062ebc1bdfc0effd262b1d11f Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Thu, 9 Aug 2018 03:10:36 +0200 Subject: [PATCH 3/3] build: Rebase on raspbian for ARM package For community conveinance, built package is uploaded to: https://bintray.com/rzr/devel/sqlite3 Relate-to: https://github.com/mapbox/node-sqlite3/issues/795 Change-Id: I184efcd2940e29437711e12cc8cfb1eaafbc3117 Signed-off-by: Philippe Coval --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 78bf2b016..60b4a012e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -20,9 +20,11 @@ # OR PERFORMANCE OF THIS SOFTWARE. #} -FROM ubuntu:latest +FROM resin/rpi-raspbian:stretch MAINTAINER Philippe Coval (p.coval@samsung.com) +RUN [ "cross-build-start" ] + ENV DEBIAN_FRONTEND noninteractive ENV LC_ALL en_US.UTF-8 ENV LANG ${LC_ALL} @@ -81,3 +83,5 @@ RUN echo "#log: ${project}: Installing sources" \ && install *.tgz /usr/local/src/${project}/ \ && cp -rfva ./build/stage/ /usr/local/src/${project}/ \ && sync + +RUN [ "cross-build-end" ]