[vlc-commits] snap: fixes to be able to build on Ubuntu 16.0.4

Alan Pope git at videolan.org
Thu Dec 7 19:39:31 CET 2017


vlc | branch: master | Alan Pope <alan.pope at canonical.com> | Thu Dec  7 21:28:39 2017 +0300| [0e932d9d816c5d78cfd5e37423f91e752a1ddf2b] | committer: Konstantin Pavlov

snap: fixes to be able to build on Ubuntu 16.0.4

- Fixed the desktop file and icon location
- Fixed the required gettext version (0.19.8 is not available on 16.04)
- Added ersion-script and 'echo' in the install stanza to easily
  identify git id from which the build was made
- Fixed vlc-wrapper to set the right environment variables to expose
  GPU drivers for VDPAU VA-API to work out of the box
- Bundle ffmpeg-3.4 and wayland-protocols

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0e932d9d816c5d78cfd5e37423f91e752a1ddf2b
---

 extras/package/snap/snapcraft.yaml      | 129 +++++++++++++++++++++++++++-----
 extras/package/snap/vlc-snap-wrapper.sh |  29 ++++++-
 2 files changed, 138 insertions(+), 20 deletions(-)

diff --git a/extras/package/snap/snapcraft.yaml b/extras/package/snap/snapcraft.yaml
index 7799eba9b6..d19a0d77c0 100644
--- a/extras/package/snap/snapcraft.yaml
+++ b/extras/package/snap/snapcraft.yaml
@@ -1,4 +1,5 @@
 name: vlc
+version-script: cat $SNAPCRAFT_STAGE/version
 version: "daily"
 grade: stable
 summary: Read, capture, broadcast your multimedia streams
@@ -6,11 +7,13 @@ description: |
   VLC is a free and open source cross-platform multimedia player and
   framework that plays most multimedia files as well as DVDs, Audio CDs,
   VCDs, and various streaming protocols.
+  NOTE. This snap contains an untested daily build of VLC
 confinement: strict
 
 apps:
   vlc:
-    command: bin/vlc-snap-wrapper.sh
+    desktop: usr/share/applications/vlc.desktop
+    command: desktop-launch $SNAP/bin/vlc-snap-wrapper.sh
     plugs:
       - unity7
       - network
@@ -28,25 +31,116 @@ apps:
       - mpris
 
 parts:
+  ffmpeg:
+    build-packages: [git, g++, make, yasm, autoconf, libtool, cmake, pkg-config, automake, build-essential, libass-dev, libfreetype6-dev, libvdpau-dev, libsdl1.2-dev, libtheora-dev, libva-dev, libvorbis-dev, libxcb1-dev, libxcb-shm0-dev, libxcb-xfixes0-dev, texinfo, zlib1g-dev, libx264-dev, libmp3lame-dev, libopus-dev, libx265-dev, libvpx-dev]
+    plugin: autotools
+    configflags: 
+      - --prefix=/usr
+      - --enable-gpl
+      - --enable-libass
+      - --enable-libfreetype
+      - --enable-libmp3lame
+      - --enable-libopus
+      - --enable-libtheora
+      - --enable-libvorbis
+      - --enable-libvpx
+      - --enable-libx264
+      - --enable-libx265
+      - --enable-nonfree
+      - --enable-shared
+    source: git://source.ffmpeg.org/ffmpeg.git
+    source-type: git
+    source-tag: 'n3.4'
+  wayland-protocols:
+    source: git://anongit.freedesktop.org/wayland/wayland-protocols
+    source-tag: '1.4'
+    plugin: autotools
+    configflags: [--prefix=/usr]
   vlc:
+    after: [ffmpeg, wayland-protocols, desktop-qt5]
     source: ../../../
     source-type: git
     plugin: autotools
-    configflags: ['--disable-chromecast']
+    prepare: |
+      sed -i 's|0\.19\.8|0\.19\.7|'  configure.ac
+    build: |
+      export PKG_CONFIG_PATH=$SNAPCRAFT_STAGE/usr/lib/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH
+      export NOCONFIGURE=1
+      autoreconf -fi
+      ./configure --disable-chromecast -prefix=$SNAPCRAFT_PART_INSTALL/usr \
+        --enable-a52 \
+        --enable-aa \
+        --enable-bluray \
+        --enable-bonjour \
+        --enable-caca \
+        --enable-chromaprint \
+        --enable-dbus \
+        --enable-dca \
+        --enable-dvbpsi \
+        --enable-dvdnav \
+        --enable-faad \
+        --enable-flac \
+        --enable-fluidsynth \
+        --enable-freerdp \
+        --enable-freetype \
+        --enable-fribidi \
+        --enable-gles2 \
+        --enable-gnutls \
+        --enable-jack \
+        --enable-kate \
+        --enable-libass \
+        --enable-libmpeg2 \
+        --enable-libxml2 \
+        --enable-lirc \
+        --enable-live555 \
+        --enable-mad \
+        --enable-mkv \
+        --enable-mod \
+        --enable-mpc \
+        --enable-mtp \
+        --enable-mux_ogg \
+        --enable-ncurses \
+        --enable-notify \
+        --enable-ogg \
+        --enable-opus \
+        --enable-pulse \
+        --enable-qt \
+        --enable-realrtsp \
+        --enable-samplerate \
+        --enable-sdl \
+        --enable-sdl-image \
+        --enable-sftp \
+        --enable-shine \
+        --enable-shout \
+        --enable-skins2 \
+        --enable-sndio \
+        --enable-speex \
+        --enable-svg \
+        --enable-svgdec \
+        --enable-taglib \
+        --enable-theora \
+        --enable-twolame \
+        --enable-upnp \
+        --enable-vcdx \
+        --enable-vdpau \
+        --enable-vnc \
+        --enable-vorbis \
+        --enable-x264 \
+        --enable-x265 \
+        --enable-zvbi
+      make
+    install: |
+      echo daily-$(git rev-parse --short HEAD) > $SNAPCRAFT_STAGE/version
+      make install
+      sed -i 's|Icon=vlc|Icon=/usr/share/icons/hicolor/256x256/apps/vlc\.png|' $SNAPCRAFT_PART_INSTALL/usr/share/applications/vlc.desktop
     build-packages:
-      - autopoint
-      - debhelper
-      - dh-autoreconf
-      - dh-buildinfo
-      - gettext
+      - libqt5svg5-dev
       - liba52-0.7.4-dev
       - libaa1-dev
       - libasound2-dev
       - libass-dev
       - libavahi-client-dev
       - libavc1394-dev
-      - libavcodec-dev
-      - libavformat-dev
       - libbluray-dev
       - libcaca-dev
       - libcairo2-dev
@@ -137,18 +231,15 @@ parts:
       - lua5.2
       - pkg-config
       - qtbase5-dev
-      - wayland-protocols
+      - xz-utils
       - zlib1g-dev
+      - bison
+      - flex
       - zsh
-
-  env:
-    plugin: nil
     stage-packages:
       - fonts-freefont-ttf
+      - dbus-x11
       - libaa1
-      - libavcodec57
-      - libavcodec-extra57
-      - libavutil55
       - libcaca0
       - libcairo2
       - libegl1-mesa
@@ -170,6 +261,7 @@ parts:
       - libva-drm1
       - libva-x11-1
       - libva1
+      - libvdpau1
       - libvncclient1
       - libx11-6
       - libxcb-composite0
@@ -182,8 +274,11 @@ parts:
       - libxi6
       - libxinerama1
       - libxpm4
+      - vdpau-va-driver
+      - i965-va-driver
+      - mesa-utils
+      - mesa-vdpau-drivers
       - zlib1g
-    after: [vlc] # VLC build fails if stage packages are present
 
   wrapper:
     plugin: dump
diff --git a/extras/package/snap/vlc-snap-wrapper.sh b/extras/package/snap/vlc-snap-wrapper.sh
index 41ba68a7af..562dd12534 100755
--- a/extras/package/snap/vlc-snap-wrapper.sh
+++ b/extras/package/snap/vlc-snap-wrapper.sh
@@ -1,5 +1,28 @@
-#!/bin/sh
+#!/bin/bash
+case "$SNAP_ARCH" in
+	"amd64") ARCH='x86_64-linux-gnu'
+	;;
+	"i386") ARCH='i386-linux-gnu'
+	;;
+	*)
+		echo "Unsupported architecture for this app build"
+		exit 1
+	;;
+esac
 
-export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib/vlc"
+VENDOR=$(glxinfo | grep "OpenGL vendor")
 
-exec desktop-launch vlc "$@"
+if [[ $VENDOR == *"Intel"* ]]; then
+  export VDPAU_DRIVER_PATH="$SNAP/usr/lib/$ARCH/dri"
+  export LIBVA_DRIVERS_PATH="$SNAP/usr/lib/$ARCH/dri"
+fi
+
+if [[ $VENDOR == *"NVIDIA"* ]]; then
+  export VDPAU_DRIVER_PATH="/var/lib/snapd/lib/gl/vdpau"
+elif [[ $VENDOR == *"X.Org"* ]]; then
+  export VDPAU_DRIVER_PATH="/usr/lib/$ARCH/vdpau/"
+fi
+
+export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/usr/lib/vlc"
+
+exec $SNAP/usr/bin/vlc "$@"



More information about the vlc-commits mailing list