-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prebuild): support of Alpine binaries
- update dependencies - rework binding.gyp - rework msys bundle for Windows - add bundle for MUSL (Alpine) - rework bundle scripts and ci moved to prebuild
- Loading branch information
Showing
22 changed files
with
355 additions
and
550 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env sh | ||
|
||
apk --no-cache add build-base cairo-dev jpeg-dev pango-dev giflib-dev librsvg-dev pixman-dev patchelf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env sh | ||
|
||
apk --purge del build-base cairo* jpeg* pango* giflib* librsvg* pixman* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env sh | ||
|
||
TARGET=./source/build/Release | ||
|
||
for lib in $(ldd "${TARGET}/canvas.node" | grep '=>' | cut -d " " -f 3); do | ||
echo "Copy ${lib}" | ||
cp -L "${lib}" "${TARGET}" | ||
patchelf --force-rpath --set-rpath '$ORIGIN' "${TARGET}/$(basename -- "${lib}")" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y build-essential libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev libpixman-1-dev patchelf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# FIXME: error if removing with build-essential libcairo2* libjpeg* libpango1.0* libgif* librsvg2* libpixman-1* | ||
sudo apt-get purge -y build-essential libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev librsvg2-dev libpixman-1-dev | ||
sudo apt-get autoremove --purge -y |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env sh | ||
|
||
LIBS=() | ||
|
||
WINDIR=$(cygpath -u -W) | ||
|
||
TARGET=./source/build/Release | ||
|
||
# Can be totally replaced with this, but MSYS throw format error if DLL has not .dll extension | ||
#for lib in $(ldd "${TARGET}/canvas.node" | grep '=>' | cut -d " " -f 3); do | ||
# if [[ "${lib}" == "${WINDIR}"* ]]; then | ||
# : | ||
# else | ||
# echo "copy ${lib} to destination" | ||
# cp "${lib}" "${TARGET}" | ||
# fi | ||
#done | ||
|
||
shopt -s nocasematch | ||
function addToLibs() { | ||
local lib=${1} && shift | ||
if [[ "$(which "${lib}")" == "${WINDIR}"* ]]; then | ||
: | ||
else | ||
for libItem in ${LIBS[@]}; do | ||
if [[ "${libItem}" == "${lib}" ]]; then | ||
return | ||
fi | ||
done | ||
echo $lib | ||
fi | ||
} | ||
|
||
RECURSE_INDEX=0 | ||
|
||
function getLibsForBinary() { | ||
local binary=$1 && shift | ||
|
||
local -i count=0 | ||
for binLib in $(objdump -p "$(cygpath -u "${binary}")" | grep "DLL Name:" | sed -e 's/^\s*DLL\sName:\s*//'); do | ||
if [[ ! -z "$(addToLibs ${binLib})" ]]; then | ||
echo "added ${binLib}" | ||
count=$count+1 | ||
LIBS+=("${binLib}") | ||
fi | ||
done | ||
|
||
if [[ count -gt 0 ]]; then | ||
local currentIndex=${RECURSE_INDEX} | ||
RECURSE_INDEX=${#LIBS[@]} | ||
# recurse if any added from last checked | ||
echo "recurse check after ${count} added" | ||
for lib in ${LIBS[@]:${currentIndex}}; do | ||
getLibsForBinary "$(which "${lib}")" | ||
done | ||
fi | ||
} | ||
|
||
function copyLibs() { | ||
local DEST=$1 && shift | ||
local DEST_PATH=$(cygpath -u "${DEST}") | ||
for lib in ${LIBS[@]}; do | ||
echo "copy ${lib} to destination" | ||
cp "$(which "${lib}")" "${DEST_PATH}" | ||
done | ||
} | ||
|
||
getLibsForBinary "${TARGET}/canvas.node" | ||
copyLibs "${TARGET}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.