Skip to content

Commit

Permalink
feat (arch): unofficial support for arm64 devices
Browse files Browse the repository at this point in the history
  • Loading branch information
gprst committed Jun 12, 2020
1 parent 1274a89 commit b967c90
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: default

platform:
os: linux
arch: arm
arch: arm64

workspace:
base: /go
Expand Down Expand Up @@ -50,7 +50,7 @@ steps:
depends_on: [ build_frontend, build_backend ]
commands:
- chmod -R o-r-w-x- ./filestash
- tar -cf filestash_Linux-armhf.tar ./filestash
- tar -cf filestash_Linux-aarch64.tar ./filestash

- name: publish
image: plugins/github-release
Expand Down
41 changes: 20 additions & 21 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
FROM debian:stable-slim
MAINTAINER [email protected]
LABEL maintainer=[email protected],gprst

ENV PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK-----\\n\\nmQENBFzLpYEBCADOOzgckQCQRrPrq15awP5Xj3BCytNjAXDixISR3Oyq0TP9PD3z\\nAp6zwOd5B4NpwCk2vQdOaq3qRKcMGFUEDNElL9WkzBixSyqj1GNCTrtJCNtJQ3TX\\nuKebrJ1DRs1vjO/tSFMgzlF843gwgy926vVdhJKRZ+13ZrWGbbWq2wilRCYXYTkw\\n+2niWXJCe22bpofAoNmNkHGmMsImCpB/P6sE803iJgTkKgU8uzZxQdeH39LaL7Ha\\nZ8aPisOO6oc5aEQ9Lx31K5cyC+373nGq56Jh0qpJjJnuT6jeHt4uYcF/OnExUf94\\nmPwv0+5kEgIfaq8qY2nwwMX9ZIqjARcS0ufVABEBAAG0JE1pY2thZWwgS2VyamVh\\nbiA8bWlja2FlbEBrZXJqZWFuLm1lPokBVAQTAQgAPhYhBHPmP6wrA9RH5bNj1lF0\\n5OJyO2PrBQJcy6WBAhsDBQkDwmcABQsJCAcCBhUKCQgLAgQWAgMBAh4BAhe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4zGTPqs+1dj94kg9948z/YUtxevSSmFwGpVFtz6rMp2xwjzKDFLSntZwWAnL/cNR\\nLahn9jFK+fiLn435EF4hMU3jk+0+PcXPeptfwPqPgoJLG4hG0O+IOIbRD78=\\n=XPwb\\n-----END PGP PUBLIC KEY BLOCK-----\\n"
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update > /dev/null && \
#################
# Install
apt-get install -y libglib2.0-0 curl gnupg > /dev/null && \
echo $PUBLIC_KEY | gpg --import && \
apt-get install -y libglib2.0-0 curl > /dev/null && \
cd /tmp/ && \
curl --resolve downloads.filestash.app:443:94.23.200.66 -s https://downloads.filestash.app/latest/filestash_`uname -s`-`uname -m`.tar.gpg | gpg --decrypt | tar xf - && \
curl -LO https://github.com/gprst/filestash/releases/download/v0.42-arm64/filestash_Linux-aarch64.tar && \
tar xf filestash_Linux-aarch64.tar && \
rm filestash_Linux-aarch64.tar && \
mv filestash /app/ && \
apt-get purge -y --auto-remove gnupg && \
#################
# Optional dependencies
apt-get install -y curl tor emacs ffmpeg zip poppler-utils > /dev/null && \
Expand All @@ -25,20 +24,20 @@ RUN apt-get update > /dev/null && \
export CTAN_REPO="http://mirror.las.iastate.edu/tex-archive/systems/texlive/tlnet" && \
curl -sL "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh && \
mv ~/.TinyTeX /usr/share/tinytex && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install wasy && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install ulem && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install marvosym && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install wasysym && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install xcolor && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install listings && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install parskip && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install float && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install wrapfig && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install sectsty && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install capt-of && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install epstopdf-pkg && \
/usr/share/tinytex/bin/x86_64-linux/tlmgr install cm-super && \
ln -s /usr/share/tinytex/bin/x86_64-linux/pdflatex /usr/local/bin/pdflatex && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install wasy && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install ulem && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install marvosym && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install wasysym && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install xcolor && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install listings && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install parskip && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install float && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install wrapfig && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install sectsty && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install capt-of && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install epstopdf-pkg && \
/usr/share/tinytex/bin/aarch64-linux/tlmgr install cm-super && \
ln -s /usr/share/tinytex/bin/aarch64-linux/pdflatex /usr/local/bin/pdflatex && \
apt-get purge -y --auto-remove perl wget && \
# Cleanup
find /usr/share/ -name 'doc' | xargs rm -rf && \
Expand All @@ -58,4 +57,4 @@ RUN timeout 1 /app/filestash | grep -q start
EXPOSE 8334
VOLUME ["/app/data/state/"]
WORKDIR "/app"
CMD ["/app/filestash"]
CMD ["/app/filestash"]
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'
services:
app:
container_name: filestash
image: machines/filestash
image: gprst/filestash
restart: always
environment:
- APPLICATION_URL=
Expand Down
6 changes: 4 additions & 2 deletions server/plugin/plg_image_light/deps/create_libresize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# ./create_libresize.sh
set -e
arch=$(dpkg --print-architecture)
if [ $arch != "amd64" ] && [ $arch != "armhf" ]; then
if [ $arch != "amd64" ] && [ $arch != "armhf" ] && [ $arch != "arm64" ]; then
echo "PLATFORM NOT SUPPORTED"
exit 1
fi
Expand Down Expand Up @@ -46,6 +46,8 @@ libpath=$(
echo "x86_64-linux-gnu";
elif [ $arch = "armhf" ]; then
echo "arm-linux-gnueabihf"
elif [ $arch = "arm64" ]; then
echo "aarch64-linux-gnu"
fi
)
#ar x /tmp/libresize.a
Expand Down Expand Up @@ -83,7 +85,7 @@ ar x /usr/lib/$libpath/libtiff.a
ar x /usr/lib/$libpath/libpangoft2-1.0.a
ar x /usr/lib/$libpath/libpoppler.a

ar rcs libresize.a *.o
ar rcs libresize_`uname -s`-`uname -m`.a *.o
rm *.o *.ao

#scp libresize.a [email protected]:/home/app/pages/data/projects/filestash/downloads/upload/libresize_`uname -s`-`uname -m`.a
Expand Down
6 changes: 4 additions & 2 deletions server/plugin/plg_image_light/deps/create_libtranscode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# ./create_libtranscode.sh
set -e
arch=$(dpkg --print-architecture)
if [ $arch != "amd64" ] && [ $arch != "armhf" ]; then
if [ $arch != "amd64" ] && [ $arch != "armhf" ] && [ $arch != "arm64" ]; then
echo "PLATFORM NOT SUPPORTED"
exit 1
fi
Expand Down Expand Up @@ -47,6 +47,8 @@ libpath=$(
echo "x86_64-linux-gnu";
elif [ $arch = "armhf" ]; then
echo "arm-linux-gnueabihf"
elif [ $arch = "arm64" ]; then
echo "aarch64-linux-gnu"
fi
)
ar x /usr/lib/$libpath/libraw.a
Expand All @@ -56,7 +58,7 @@ ar x /usr/lib/gcc/$libpath/6/libstdc++.a
ar x /usr/lib/gcc/$libpath/6/libgomp.a
ar x /usr/lib/$libpath/libpthread.a

ar rcs libtranscode.a *.o
ar rcs libtranscode_`uname -s`-`uname -m`.a *.o
rm *.o

#scp libtranscode.a [email protected]:/home/app/pages/data/projects/filestash/downloads/upload/libtranscode_`uname -s`-`uname -m`.a
Expand Down
21 changes: 14 additions & 7 deletions server/plugin/plg_image_light/install.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#/bin/bash
set -e

ARCH=$(dpkg --print-architecture)
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
cd "$(dirname "$0")"/deps

# AMD64 dependencies
curl -s https://downloads.filestash.app/upload/libresize_Linux-x86_64.a > libresize_linux_amd64.a &
curl -s https://downloads.filestash.app/upload/libtranscode_Linux-x86_64.a > libtranscode_linux_amd64.a &

# ARM dependencies
curl -s https://downloads.filestash.app/upload/libresize_Linux-armv7l.a > libresize_linux_arm.a &
curl -s https://downloads.filestash.app/upload/libtranscode_Linux-armv7l.a > libtranscode_linux_arm.a &
if [ $ARCH = "amd64" ]; then
# AMD64 dependencies
curl -s https://downloads.filestash.app/upload/libresize_Linux-x86_64.a > libresize_linux_amd64.a &
curl -s https://downloads.filestash.app/upload/libtranscode_Linux-x86_64.a > libtranscode_linux_amd64.a &
elif [ $ARCH = "armhf" ]; then
# ARM dependencies
curl -s https://downloads.filestash.app/upload/libresize_Linux-armv7l.a > libresize_linux_arm.a &
curl -s https://downloads.filestash.app/upload/libtranscode_Linux-armv7l.a > libtranscode_linux_arm.a &
elif [ $ARCH = "arm64" ]; then
# ARM64 dependencies build
sh create_libresize.sh
sh create_libtranscode.sh
fi

wait
4 changes: 4 additions & 0 deletions server/plugin/plg_image_light/lib_resize_linux_arm64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package plg_image_light

// #cgo LDFLAGS: -lm -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -ldl -L./deps -l:libresize_Linux-aarch64.a
import "C"
4 changes: 4 additions & 0 deletions server/plugin/plg_image_light/lib_transcode_linux_arm64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package plg_image_light

// #cgo LDFLAGS: -lm -lpthread -L./deps -l:libtranscode_Linux-aarch64.a
import "C"

0 comments on commit b967c90

Please sign in to comment.