Skip to content

Commit

Permalink
Bugfix/deb installer not working on armhf (#32)
Browse files Browse the repository at this point in the history
* The ARM Debian installer is now correctly compiled for non 64 bit ARM architectures

* The prebuilt ARM version (32 bit) is now built for ARMv6 instead ARMv5 which is a huge improvement in performance

* Added a 64 bit ARM (ARMv8) prebuilt version including installer
  • Loading branch information
midstar committed Jun 4, 2020
1 parent 9a22d45 commit d275330
Show file tree
Hide file tree
Showing 10 changed files with 1,210 additions and 21 deletions.
5 changes: 4 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ Also, MediaWEB can generate thumbnails as soon as files are added to the media d

This will improve performance a lot the first time each folder is browsed.

See [performance report](PERFORMANCE.md) for details about MediaWEB performance on different architectures.

## Why is swiping or zooming images lagging?

By default the original images are opened in the viewer. If the images are large (typical 2 - 10 MB) low end platforms (such as mobile browsers) will have a hard time to make a smooth navigation / zooming. Also, it make take some time to download the images if the network bandwidth is limited.
Expand All @@ -78,4 +80,5 @@ Your can also configure MediaWEB to generate the previews during startup and whe

## How to fetch the original image when preview is enabled?

You can always download the original image (unresized) by clicking on the image name/title while viewing the image.
You can always download the original image (unresized) by clicking on the image name/title while viewing the image.

1,128 changes: 1,128 additions & 0 deletions PERFORMANCE.md

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# MediaWEB - Access your photos and videos over Internet

[![Go Report Card](https://goreportcard.com/badge/github.com/midstar/mediaweb)](https://goreportcard.com/report/github.com/midstar/mediaweb)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/github/midstar/mediaweb?svg=true)](https://ci.appveyor.com/api/projects/status/github/midstar/mediaweb)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/github/midstar/mediaweb?svg=true)](https://ci.appveyor.com/api/projects/status/github/midstar/mediaweb/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/midstar/mediaweb/badge.svg?branch=master)](https://coveralls.io/github/midstar/mediaweb?branch=master)

MediaWeb is a small self-contained web server software to enable you to access your photos and videos over the Internet in your WEB browser.
Expand Down Expand Up @@ -86,14 +86,18 @@ Debian installer packages are provided for x64 (PC) or arm (Raspberry Pi, Banana

To get the latest file from a shell follow the instruction below.

For PC x64 based Linux write following in a shell:
For PC x64 based architectures write following in a shell:

export MW_ARCH=x64

For ARM based Linux:
For ARM 32-bit based architectures (for example Raspberry Pi 1, 2):

export MW_ARCH=arm

For ARM 64-bit based archtectures (for example Raspberry Pi 3, 4 or ROCK64):

export MW_ARCH=arm64

Then run following for all Linux platforms:

mkdir ~/mediaweb
Expand Down Expand Up @@ -121,10 +125,14 @@ For PC x64 based Linux write following in a shell:

export MW_ARCH=x64

For ARM based Linux:
For ARM 32-bit based architectures (for example Raspberry Pi 1, 2):

export MW_ARCH=arm

For ARM 64-bit based archtectures (for example Raspberry Pi 3, 4 or ROCK64):

export MW_ARCH=arm64

Then run following for all Linux platforms:

mkdir ~/mediaweb
Expand Down Expand Up @@ -175,7 +183,7 @@ Also, checkout the [Configuration guide](#configuration-guide) and [FAQ](FAQ.md)

To build from source on any platform you need to:

* Install Golang
* Install Golang (version 1.13 or newer)
* Set the GOPATH environment variable
* Add the bin folder within your GOPATH to your PATH environment variable ($GOPATH/bin)

Expand Down
28 changes: 23 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ skip_tags: true

version: 1.1.0.{build}

stack: go 1.11
stack: go 1.13

install:
# Windows
Expand Down Expand Up @@ -46,7 +46,7 @@ build_script:
- cmd: 'copy configs\mediaweb.conf .'
- cmd: 7z a mediaweb_windows_x64.zip mediaweb.exe mediaweb.conf service.bat

# Windows rename tempates directory to secure that packr is working
# Windows rename tempates directory to secure that go rice is working
- cmd: 'rename templates old_templates'

# Windows Test service installation/uninstallation script
Expand All @@ -61,6 +61,9 @@ build_script:
- sh: 'cp configs/mediaweb.conf .'
- sh: tar -zcvf mediaweb_linux_x64.tar.gz mediaweb mediaweb.conf service.sh

# Linux rename tempates directory to secure that go rice is working
- sh: 'mv templates old_templates'

# Linux Test service installation/uninstallation script
- sh: 'sudo -E sh scripts/service_test.sh'

Expand All @@ -70,13 +73,24 @@ build_script:
# Linux Test Debian installer
- sh: 'sudo sh scripts/debian_installer_test.sh'

# Linux ARM (cross compile from linux x64)
# Linux revert to old name to enable build again
- sh: 'mv old_templates templates'

# Linux ARM (32-bit) - cross compile from linux x64
- sh: rm mediaweb
- sh: 'sh $GOPATH/src/github.com/midstar/mediaweb/scripts/build_cross_arm.sh $APPVEYOR_BUILD_VERSION'
- sh: 'sh $GOPATH/src/github.com/midstar/mediaweb/scripts/build_cross_arm.sh arm $APPVEYOR_BUILD_VERSION'
- sh: tar -zcvf mediaweb_linux_arm.tar.gz mediaweb mediaweb.conf service.sh

# Linux Debian create package (installer) - for ARM (32-bit)
- sh: 'sudo sh scripts/debian_installer.sh armhf $APPVEYOR_BUILD_VERSION mediaweb_linux_arm'

# Linux ARM64 - cross compile from linux x64
- sh: rm mediaweb
- sh: 'sh $GOPATH/src/github.com/midstar/mediaweb/scripts/build_cross_arm.sh arm64 $APPVEYOR_BUILD_VERSION'
- sh: tar -zcvf mediaweb_linux_arm64.tar.gz mediaweb mediaweb.conf service.sh

# Linux Debian create package (installer) - for ARM64
- sh: 'sudo sh scripts/debian_installer.sh arm64 $APPVEYOR_BUILD_VERSION mediaweb_linux_arm'
- sh: 'sudo sh scripts/debian_installer.sh arm64 $APPVEYOR_BUILD_VERSION mediaweb_linux_arm64'

# Deploy to GitHub (only on master AND on tags)
deploy:
Expand Down Expand Up @@ -125,8 +139,12 @@ for:
name: mediaweb_linux_x64.tar.gz
- path: mediaweb_linux_arm.tar.gz
name: mediaweb_linux_arm.tar.gz
- path: mediaweb_linux_arm64.tar.gz
name: mediaweb_linux_arm64.tar.gz
- path: mediaweb_linux_x64.deb
name: mediaweb_linux_x64.deb
- path: mediaweb_linux_arm.deb
name: mediaweb_linux_arm.deb
- path: mediaweb_linux_arm64.deb
name: mediaweb_linux_arm64.deb

8 changes: 7 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Builds mediaweb using the correct version, build time and git hash
set -e
if [ -z $1 ]; then
echo No version provided. Using unofficial.
export VERSION=unofficial
Expand All @@ -15,6 +16,11 @@ echo date time: $DATETIME

echo building / installing
cd $GOPATH/src/github.com/midstar/mediaweb
rice embed-go
rice embed-go || (
echo Go rice is not installed
set -x
ls $GOPATH/bin
exit 1
)
go build -ldflags="-s -X 'main.applicationBuildTime=$DATETIME' -X main.applicationVersion=$1 -X main.applicationGitHash=$GITHASH" github.com/midstar/mediaweb

22 changes: 16 additions & 6 deletions scripts/build_cross_arm.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Same as build.sh but cross compiles for Linux ARM architecture
export GOOS=linux
export GOARCH=arm
export GOARM=5
# Same as build.sh but cross compiles for ARM on linux

echo Cross compiling for Linux ARM architecture
export GOOS=linux

if [ "$1" = "arm" ]; then
export GOARCH=arm
export GOARM=6
echo Cross compiling for Linux ARMv$GOARM architecture
elif [ "$1" = "arm64" ]; then
export GOARCH=arm64
echo Cross compiling for Linux ARM64 architecture
else
echo No architecture provided
echo Valid values are arm or arm64
exit 1
fi

BASEDIR=$(dirname $0)
sh $BASEDIR/build.sh $1
sh $BASEDIR/build.sh $2
10 changes: 10 additions & 0 deletions scripts/debian_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ export ARCHITECTURE=$1
export VERSION=$2
export NAME=$3

if [ "$ARCHITECTURE" = "amd64" ]; then
# Will be dynamically linked
export EXTRA_DEPS=", libc6 (>= 2.3.2)"
else
# Will be statically linked
export EXTRA_DEPS=""
fi

# Create package source create directory
export SCRIPT_PATH=`dirname "$0"`
export PKG_IN_PATH=$SCRIPT_PATH/debian_pkg
Expand Down Expand Up @@ -98,6 +106,8 @@ SIZE=$(du -s ./$PKG_ROOT_PATH | awk '{print $1}')
sed -i -e 's/__ARCHITECTURE__/'${ARCHITECTURE}'/g' $PKG_OUT_PATH/DEBIAN/control
sed -i -e 's/__VERSION__/'${VERSION}'/g' $PKG_OUT_PATH/DEBIAN/control
sed -i -e 's/__SIZE__/'${SIZE}'/g' $PKG_OUT_PATH/DEBIAN/control
#sed -i -e 's/__EXTRA_DEPS_/'${EXTRA_DEPS}'/g' $PKG_OUT_PATH/DEBIAN/control
sed -i -e "s/__EXTRA_DEPS__/$EXTRA_DEPS/g" $PKG_OUT_PATH/DEBIAN/control

# Set premissions on scripts
chmod 755 $PKG_OUT_PATH/DEBIAN/post* $PKG_OUT_PATH/DEBIAN/pre*
Expand Down
2 changes: 1 addition & 1 deletion scripts/debian_pkg/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Homepage: https://github.com/midstar/mediaweb
Package: mediaweb
Architecture: __ARCHITECTURE__
Installed-Size: __SIZE__
Depends: systemd, libc6 (>= 2.3.2)
Depends: systemd__EXTRA_DEPS__
Recommends: ffmpeg
Description: Media WEB server
MediaWEB is a small self-contained web server software to enable you to
Expand Down
4 changes: 3 additions & 1 deletion scripts/install_deps.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ go get github.com/rwcarlsen/goexif/exif
go get github.com/GeertJohan/go.rice
go get github.com/GeertJohan/go.rice/rice
go get github.com/fsnotify/fsnotify
go get github.com/kardianos/service
go get github.com/kardianos/service

go install github.com/GeertJohan/go.rice/rice
6 changes: 5 additions & 1 deletion scripts/install_deps.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
set -ex

go get github.com/midstar/llog
go get github.com/midstar/gocfg
go get github.com/disintegration/imaging
go get github.com/rwcarlsen/goexif/exif
go get github.com/GeertJohan/go.rice
go get github.com/GeertJohan/go.rice/rice
go get github.com/fsnotify/fsnotify
go get github.com/fsnotify/fsnotify

go install github.com/GeertJohan/go.rice/rice

0 comments on commit d275330

Please sign in to comment.