compile mono

This commit is contained in:
sparklyballs
2017-08-08 03:34:08 +01:00
parent f8cda542bb
commit 5c537ecdb5
5 changed files with 102 additions and 101 deletions

View File

@@ -8,7 +8,8 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
# package versions # package versions
ARG FFMPEG_VER="3.3.3" ARG FFMPEG_VER="3.3.3"
ARG FRAME_COMMIT="874cf94eeaf35aa267878f9983b280a00e7bed19" ARG MONO_VER="5.4.0.56"
ARG REFERENCEASSEMBLIES_COMMIT="874cf94eeaf35aa267878f9983b280a00e7bed19"
# copy patches # copy patches
COPY patches/ /tmp/patches/ COPY patches/ /tmp/patches/
@@ -19,13 +20,14 @@ RUN \
alsa-lib-dev \ alsa-lib-dev \
autoconf \ autoconf \
automake \ automake \
binutils \
bzip2-dev \ bzip2-dev \
cmake \ cmake \
coreutils \
curl \ curl \
file \ file \
g++ \ g++ \
gcc \ gcc \
gettext \
git \ git \
gnutls-dev \ gnutls-dev \
jpeg-dev \ jpeg-dev \
@@ -42,6 +44,7 @@ RUN \
make \ make \
openjpeg-dev \ openjpeg-dev \
opus-dev \ opus-dev \
paxmark \
perl \ perl \
rtmpdump-dev \ rtmpdump-dev \
sdl-dev \ sdl-dev \
@@ -54,9 +57,6 @@ RUN \
xvidcore-dev \ xvidcore-dev \
yasm \ yasm \
zlib-dev && \ zlib-dev && \
apk add --no-cache --virtual=build-dependencies \
--repository http://nl.alpinelinux.org/alpine/edge/testing \
frei0r-plugins-dev && \
# install runtime packages # install runtime packages
apk add --no-cache \ apk add --no-cache \
@@ -76,6 +76,7 @@ RUN \
libxcb \ libxcb \
openjpeg \ openjpeg \
opus \ opus \
python \
soxr \ soxr \
speex \ speex \
sqlite \ sqlite \
@@ -83,110 +84,64 @@ RUN \
x264 \ x264 \
x264-libs \ x264-libs \
x265 \ x265 \
xvidcore && \ xvidcore \
zlib && \
apk add --no-cache \ apk add --no-cache \
--repository http://nl.alpinelinux.org/alpine/edge/testing \ --repository http://nl.alpinelinux.org/alpine/edge/testing \
frei0r-plugins \ libgdiplus && \
mono && \
# compile opencore # compile mono
mkdir -p \ mkdir -p \
/tmp/opencore-amr && \ /tmp/mono-src && \
curl -o \ curl -o \
/tmp/opencore-src.tar.gz -L \ /tmp/mono.tar.bz2 -L \
"https://sourceforge.net/projects/opencore-amr/files/latest/download" && \ "https://download.mono-project.com/sources/mono/mono-${MONO_VER}.tar.bz2" && \
tar xf \ tar xf \
/tmp/opencore-src.tar.gz -C \ /tmp/mono.tar.bz2 -C \
/tmp/opencore-amr --strip-components=1 && \ /tmp/mono-src --strip-components=1 && \
cd /tmp/opencore-amr && \ cd /tmp/mono-src && \
sed -i \
's|$mono_libdir/||g' \
/tmp/mono-src/data/config.in && \
sed -i \
'/exec "/ i\paxmark mr "$(readlink -f "$MONO_EXECUTABLE")"' \
/tmp/mono-src/runtime/mono-wrapper.in && \
export CFLAGS="$CFLAGS -Os -fno-strict-aliasing" && \
./configure \ ./configure \
--prefix=/usr && \ --disable-boehm \
make && \ --disable-libraries \
make install && \ --disable-rpath \
mkdir -p \ --enable-minimal=debug \
/tmp/opencore-amrwbenc && \ --enable-parallel-mark \
curl -o \ --infodir=/opt/mono/share/info \
/tmp/opencore-amrwbenc-src.tar.gz -L \ --localstatedir=/var \
"https://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/vo-amrwbenc-0.1.3.tar.gz/download" && \ --mandir=/opt/mono/share/man \
tar xf \ --prefix=/opt/mono \
/tmp/opencore-amrwbenc-src.tar.gz -C \ --sysconfdir=/etc \
/tmp/opencore-amrwbenc && \ --with-mcs-docs=no \
./configure \ --with-moonlight=no \
--prefix=/usr && \ --without-sigaltstack \
make && \ --with-profile2=no \
make install && \ --with-profile4_5=yes \
libtool --finish /usr/lib && \ --with-profile4=no && \
# compile vidstab
git clone https://github.com/georgmartius/vid.stab /tmp/vidstap && \
cd /tmp/vidstap && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/ && \
make && \
make install && \
# compile zimg
git clone https://github.com/sekrit-twc/zimg /tmp/zimg && \
cd /tmp/zimg && \
./autogen.sh && \
./configure \
--prefix=/usr && \
make && \
make install && \
# compile ffmpeg
mkdir -p /tmp/ffmpeg-src && \
curl -o \
/tmp/ffmpeg.tar.bz2 -L \
"http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VER}.tar.bz2" && \
tar xf \
/tmp/ffmpeg.tar.bz2 -C \
/tmp/ffmpeg-src --strip-components=1 && \
cd /tmp/ffmpeg-src && \
for i in /tmp/patches/*.patch; do patch -p1 -i $i; done && \
./configure \
--disable-debug \
--disable-ffplay \
--disable-indev=sndio \
--disable-outdev=sndio \
--disable-static \
--disable-stripping \
--enable-fontconfig \
--enable-frei0r \
--enable-gpl \
--enable-gray \
--enable-libfreetype \
--enable-libfribidi \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopenjpeg \
--enable-libopus \
--enable-librtmp \
--enable-libsoxr \
--enable-libspeex \
--enable-libtheora \
--enable-libv4l2 \
--enable-libvidstab \
# --enable-libvo-amrwbenc \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libzimg \
--enable-shared \
--enable-vaapi \
--enable-version3 \
--prefix=/usr && \
make && \ make && \
make install && \ make install && \
install -D -m644 /tmp/patches/mono/mono.binfmt.d /opt/mono/lib/binfmt.d/mono.conf && \
sed -i \
-e "s:#Requires:Requires:" \
/opt/mono/lib/pkgconfig/mono.pc && \
sed -i \
-e "s:/2.0/:/4.5/:g" \
/opt/mono/lib/pkgconfig/mono-nunit.pc && \
find /opt/mono -name "*.so*" -exec strip --strip-unneeded {} \; && \
strip /opt/mono/bin/mono || true && \
# install referenceassemblies-pcl # install referenceassemblies-pcl
git clone https://github.com/directhex/xamarin-referenceassemblies-pcl /tmp/pcl && \ git clone https://github.com/directhex/xamarin-referenceassemblies-pcl /tmp/pcl && \
cd /tmp/pcl && \ cd /tmp/pcl && \
git checkout $FRAME_COMMIT && \ git checkout $REFERENCEASSEMBLIES_COMMIT && \
install -dm 755 /usr/lib/mono/xbuild-frameworks/.NETPortable/ && \ install -dm 755 /opt/mono/lib/mono/xbuild-frameworks/.NETPortable/ && \
cp -dr --no-preserve='ownership' v4.* /usr/lib/mono/xbuild-frameworks/.NETPortable/ && \ cp -dr --no-preserve='ownership' v4.* /opt/mono/lib/mono/xbuild-frameworks/.NETPortable/ && \
# compile emby # compile emby
mkdir -p \ mkdir -p \
@@ -199,9 +154,8 @@ RUN \
tar xf \ tar xf \
/tmp/emby.tar.gz -C \ /tmp/emby.tar.gz -C \
/tmp/emby-src --strip-components=1 && \ /tmp/emby-src --strip-components=1 && \
SQL_DLL=$(find / -name "*sqlite3.dll.config*") && \
cd /tmp/emby-src && \ cd /tmp/emby-src && \
libMagicWand=$(find / -iname "libMagickWand-7.*.so.0" -exec basename \{} \;) && \ libMagicWand=$(find / -iname "libMagickWand-*.*.so.0" -exec basename \{} \;) && \
sed -i \ sed -i \
s/libMagickWand-6.Q8.so/$libMagicWand/g \ s/libMagickWand-6.Q8.so/$libMagicWand/g \
/tmp/emby-src/MediaBrowser.Server.Mono/ImageMagickSharp.dll.config && \ /tmp/emby-src/MediaBrowser.Server.Mono/ImageMagickSharp.dll.config && \
@@ -210,7 +164,7 @@ RUN \
sed -i \ sed -i \
s/libsqlite3.so/$libSqlite/g \ s/libsqlite3.so/$libSqlite/g \
$SQLITE_DLL && \ $SQLITE_DLL && \
xbuild \ /opt/mono/bin/xbuild \
/p:Configuration='Release Mono' \ /p:Configuration='Release Mono' \
/p:Platform='Any CPU' \ /p:Platform='Any CPU' \
/p:OutputPath=/tmp/emby-src/build \ /p:OutputPath=/tmp/emby-src/build \
@@ -219,12 +173,58 @@ RUN \
/usr/lib/emby && \ /usr/lib/emby && \
cp -r /tmp/emby-src/build/* /usr/lib/emby/ && \ cp -r /tmp/emby-src/build/* /usr/lib/emby/ && \
# compile ffmpeg
mkdir -p \
/tmp/ffmpeg-src && \
curl -o \
/tmp/ffmpeg.tar.bz2 -L \
"http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VER}.tar.bz2" && \
tar xf \
/tmp/ffmpeg.tar.bz2 -C \
/tmp/ffmpeg-src --strip-components=1 && \
cd /tmp/ffmpeg-src && \
for i in /tmp/patches/ffmpeg/*.patch; do patch -p1 -i $i; done && \
./configure \
--disable-debug \
--disable-ffplay \
--disable-indev=sndio \
--disable-outdev=sndio \
--disable-static \
--disable-stripping \
--enable-fontconfig \
--enable-gpl \
--enable-gray \
--enable-libfreetype \
--enable-libfribidi \
--enable-libopenjpeg \
--enable-libopus \
--enable-librtmp \
--enable-libsoxr \
--enable-libspeex \
--enable-libtheora \
--enable-libv4l2 \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-shared \
--enable-vaapi \
--enable-version3 \
--prefix=/opt/mono && \
make && \
make install && \
# cleanup # cleanup
apk del --purge \ apk del --purge \
build-dependencies && \ build-dependencies && \
rm -rf \ rm -rf \
/tmp/* \ /tmp/* \
/usr/lib/mono/xbuild-frameworks/.NETPortable/v4.* /opt/mono/lib/*.la \
/opt/mono/lib/libMonoSupportW.* \
/opt/mono/lib/mono/*/Mono.Security.Win32* \
/opt/mono/lib/mono/xbuild-frameworks/.NETPortable/v4.*
# add local files # add local files
COPY root/ / COPY root/ /

View File

@@ -0,0 +1 @@
:CLR:M::MZ::/usr/bin/mono:

View File

@@ -1,7 +1,7 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
exec \ exec \
s6-setuidgid abc /usr/bin/mono \ s6-setuidgid abc /opt/mono/bin/mono \
/usr/lib/emby/MediaBrowser.Server.Mono.exe \ /usr/lib/emby/MediaBrowser.Server.Mono.exe \
-programdata /config -ffmpeg /usr/bin/ffmpeg \ -programdata /config -ffmpeg /usr/bin/ffmpeg \
-ffprobe /usr/bin/ffprobe -ffprobe /usr/bin/ffprobe