diff --git a/build b/build index fb4ff1984a..95d5d5c495 100755 --- a/build +++ b/build @@ -164,40 +164,6 @@ for target_platform in ${platform[@]}; do fi done -if [[ ${web_branch} != 'local' ]]; then - # Initialize submodules - git submodule update --init --recursive - - # configure branch - pushd MediaBrowser.WebDashboard/jellyfin-web - - if ! git diff-index --quiet HEAD --; then - popd - echo - echo "ERROR: Your 'jellyfin-web' submodule working directory is not clean!" - echo "This script will overwrite your unstaged and unpushed changes." - echo "Please do development on 'jellyfin-web' outside of the submodule." - exit 1 - fi - - git fetch --all - # If this is an official branch name, fetch it from origin - official_branches_regex="^master$|^dev$|^release-.*$|^hotfix-.*$" - if [[ ${web_branch} =~ ${official_branches_regex} ]]; then - git checkout origin/${web_branch} || { - echo "ERROR: 'jellyfin-web' branch 'origin/${web_branch}' is invalid." - exit 1 - } - # Otherwise, just check out the local branch (for testing, etc.) - else - git checkout ${web_branch} || { - echo "ERROR: 'jellyfin-web' branch '${web_branch}' is invalid." - exit 1 - } - fi - popd -fi - # Execute each platform and action in order, if said action is enabled pushd deployment/ for target_platform in ${platform[@]}; do @@ -214,7 +180,7 @@ for target_platform in ${platform[@]}; do for target_action in ${action[@]}; do echo -e ">> Processing action ${target_action}" if [[ -f ${target_action}.sh && -x ${target_action}.sh ]]; then - ./${target_action}.sh + ./${target_action}.sh web_branch=${web_branch} fi done if [[ -d pkg-dist/ ]]; then diff --git a/deployment/README.md b/deployment/README.md index a00cd3e6c2..a805f59ca3 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -11,10 +11,8 @@ This directory contains the packaging configuration of Jellyfin for multiple pla ### Portable Builds (archives) -* `debian-x64`: Portable binary archive for Debian amd64 systems. -* `ubuntu-x64`: Portable binary archive for Ubuntu amd64 systems. * `linux-x64`: Portable binary archive for generic Linux amd64 systems. -* `osx-x64`: Portable binary archive for MacOS amd64 systems. +* `macos`: Portable binary archive for MacOS amd64 systems. * `win-x64`: Portable binary archive for Windows amd64 systems. * `win-x86`: Portable binary archive for Windows i386 systems. @@ -22,10 +20,10 @@ This directory contains the packaging configuration of Jellyfin for multiple pla These builds are not necessarily run from the `build` script, but are present for other platforms. -* `framework`: Compiled `.dll` for use with .NET Core runtime on any system. +* `portable`: Compiled `.dll` for use with .NET Core runtime on any system. * `docker`: Docker manifests for auto-publishing. * `unraid`: unRaid Docker template; not built by `build` but imported into unRaid directly. -* `win-generic`: Portable binary for generic Windows systems. +* `windows`: Support files and scripts for Windows CI build. ## Package Specification @@ -62,52 +60,3 @@ These builds are not necessarily run from the `build` script, but are present fo * Upon completion of the defined actions, at least one output file must be created in the `/pkg-dist` directory. * Output files will be moved to the directory `jellyfin-build/` one directory above the repository root upon completion. - -### Common Functions - -* A number of common functions are defined in `deployment/common.build.sh` for use by platform scripts. - -* Each action script should import the common functions to define a number of standard variables. - -* The common variables are: - - * `ROOT`: The Jellyfin repostiory root, usually `../..`. - * `CONFIG`: The .NET config, usually `Release`. - * `DOTNETRUNTIME`: The .NET `--runtime` value, platform-dependent. - * `OUTPUT_DIR`: The intermediate output dir, usually `./dist/jellyfin_${VERSION}`. - * `BUILD_CONTEXT`: The Docker build context, usually `../..`. - * `DOCKERFILE`: The Dockerfile, usually `Dockerfile` in the platform directory. - * `IMAGE_TAG`: A tag for the built Docker image. - * `PKG_DIR`: The final binary output directory for collection, invariably `pkg-dist`. - * `ARCHIVE_CMD`: The compression/archive command for release archives, usually `tar -xvzf` or `zip`. - -#### `get_version` - -Reads the version information from `SharedVersion.cs`. - -**Arguments:** `ROOT` - -#### `build_jellyfin` - -Build a standard self-contained binary in the current OS context. - -**Arguments:** `ROOT` `CONFIG` `DOTNETRUNTIME` `OUTPUT_DIR` - -#### `build_jellyfin_docker` - -Build a standard self-contained binary in a Docker image. - -**Arguments:** `BUILD_CONTEXT` `DOCKERFILE` `IMAGE_TAG` - -#### `clean_jellyfin` - -Clean up a build for housekeeping. - -**Arguments:** `ROOT` `CONFIG` `OUTPUT_DIR` `PKG_DIR` - -#### `package_portable` - -Produce a compressed archive. - -**Arguments:** `ROOT` `OUTPUT_DIR` `PKG_DIR` `ARCHIVE_CMD` - diff --git a/deployment/centos-package-x64/Dockerfile b/deployment/centos-package-x64/Dockerfile index 38853f1738..99f538bc29 100644 --- a/deployment/centos-package-x64/Dockerfile +++ b/deployment/centos-package-x64/Dockerfile @@ -8,13 +8,24 @@ ARG SDK_VERSION=2.2 ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist -# Prepare CentOS build environment +# Prepare CentOS environment RUN yum update -y \ - && yum install -y @buildsys-build rpmdevtools yum-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel \ - && rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm \ + && yum install -y epel-release + +# Install build dependencies +RUN yum install -y @buildsys-build rpmdevtools yum-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel nodejs wget git + +# Install DotNET SDK +RUN rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm \ && rpmdev-setuptree \ - && yum install -y dotnet-sdk-${SDK_VERSION} \ - && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \ + && yum install -y dotnet-sdk-${SDK_VERSION} + +# Install yarn package manager +RUN wget -q -O /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \ + && yum install -y yarn + +# Create symlinks and directories +RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \ && mkdir -p ${SOURCE_DIR}/SPECS \ && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec \ && mkdir -p ${SOURCE_DIR}/SOURCES \ diff --git a/deployment/centos-package-x64/clean.sh b/deployment/centos-package-x64/clean.sh index 7278372e18..31455de0d4 100755 --- a/deployment/centos-package-x64/clean.sh +++ b/deployment/centos-package-x64/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/centos-package-x64/docker-build.sh b/deployment/centos-package-x64/docker-build.sh index cefb1652e9..014f582f08 100755 --- a/deployment/centos-package-x64/docker-build.sh +++ b/deployment/centos-package-x64/docker-build.sh @@ -8,7 +8,69 @@ set -o xtrace # Move to source directory pushd ${SOURCE_DIR} -ls -al SOURCES/pkg-src/ +VERSION="$( grep '^Version:' ${SOURCE_DIR}/SOURCES/pkg-src/jellyfin.spec | awk '{ print $NF }' )" + +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + +# Create RPM source archive +GNU_TAR=1 +echo "Bundling all sources for RPM build." +tar \ +--transform "s,^\.,jellyfin-${VERSION}," \ +--exclude='.git*' \ +--exclude='**/.git' \ +--exclude='**/.hg' \ +--exclude='**/.vs' \ +--exclude='**/.vscode' \ +--exclude='deployment' \ +--exclude='**/bin' \ +--exclude='**/obj' \ +--exclude='**/.nuget' \ +--exclude='*.deb' \ +--exclude='*.rpm' \ +-czf "${SOURCE_DIR}/SOURCES/pkg-src/jellyfin-${VERSION}.tar.gz" \ +-C ${SOURCE_DIR} ./ || GNU_TAR=0 + +if [ $GNU_TAR -eq 0 ]; then + echo "The installed tar binary did not support --transform. Using workaround." + package_temporary_dir="$( mktemp -d )" + mkdir -p "${package_temporary_dir}/jellyfin" + # Not GNU tar + tar \ + --exclude='.git*' \ + --exclude='**/.git' \ + --exclude='**/.hg' \ + --exclude='**/.vs' \ + --exclude='**/.vscode' \ + --exclude='deployment' \ + --exclude='**/bin' \ + --exclude='**/obj' \ + --exclude='**/.nuget' \ + --exclude='*.deb' \ + --exclude='*.rpm' \ + -czf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \ + -C ${SOURCE_DIR} ./ + echo "Extracting filtered package." + mkdir -p "${package_temporary_dir}/jellyfin-${VERSION}" + tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}" + echo "Removing filtered package." + rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" + echo "Repackaging package into final tarball." + tar -czf "${SOURCE_DIR}/SOURCES/pkg-src/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}" + rm -rf ${package_temporary_dir} +fi # Build RPM spectool -g -R SPECS/jellyfin.spec diff --git a/deployment/centos-package-x64/package.sh b/deployment/centos-package-x64/package.sh index df5a665808..1b983f49d9 100755 --- a/deployment/centos-package-x64/package.sh +++ b/deployment/centos-package-x64/package.sh @@ -1,13 +1,15 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done WORKDIR="$( pwd )" -VERSION="$( grep '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )" package_temporary_dir="${WORKDIR}/pkg-dist-tmp" output_dir="${WORKDIR}/pkg-dist" -pkg_src_dir="${WORKDIR}/pkg-src" current_user="$( whoami )" image_name="jellyfin-centos-build" @@ -21,57 +23,12 @@ else docker_sudo="" fi -# Create RPM source archive -GNU_TAR=1 +# Prepare temporary package dir mkdir -p "${package_temporary_dir}" -echo "Bundling all sources for RPM build." -tar \ ---transform "s,^\.,jellyfin-${VERSION}," \ ---exclude='.git*' \ ---exclude='**/.git' \ ---exclude='**/.hg' \ ---exclude='**/.vs' \ ---exclude='**/.vscode' \ ---exclude='deployment' \ ---exclude='**/bin' \ ---exclude='**/obj' \ ---exclude='**/.nuget' \ ---exclude='*.deb' \ ---exclude='*.rpm' \ --czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" \ --C "../.." ./ || GNU_TAR=0 - -if [ $GNU_TAR -eq 0 ]; then - echo "The installed tar binary did not support --transform. Using workaround." - mkdir -p "${package_temporary_dir}/jellyfin" - # Not GNU tar - tar \ - --exclude='.git*' \ - --exclude='**/.git' \ - --exclude='**/.hg' \ - --exclude='**/.vs' \ - --exclude='**/.vscode' \ - --exclude='deployment' \ - --exclude='**/bin' \ - --exclude='**/obj' \ - --exclude='**/.nuget' \ - --exclude='*.deb' \ - --exclude='*.rpm' \ - -zcf \ - "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \ - -C "../.." ./ - echo "Extracting filtered package." - tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}" - echo "Removing filtered package." - rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" - echo "Repackaging package into final tarball." - tar -czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}" -fi - # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile # Build the RPMs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the RPMs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/rpm/* "${output_dir}" diff --git a/deployment/common.build.sh b/deployment/common.build.sh deleted file mode 100755 index 000872ea91..0000000000 --- a/deployment/common.build.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset - -RED='\033[0;31m' -GREEN='\033[0;32m' -CYAN='\033[0;36m' -NC='\033[0m' # No Color - -DEFAULT_BUILD_CONTEXT="../.." -DEFAULT_ROOT="." -DEFAULT_DOTNETRUNTIME="framework" -DEFAULT_CONFIG="Release" -DEFAULT_OUTPUT_DIR="dist/jellyfin-git" -DEFAULT_PKG_DIR="pkg-dist" -DEFAULT_DOCKERFILE="Dockerfile" -DEFAULT_ARCHIVE_CMD="tar -xvzf" - -# Parse the version from the build.yaml version -get_version() -( - local ROOT=${1-$DEFAULT_ROOT} - grep "version:" ${ROOT}/build.yaml \ - | sed -E 's/version: "([0-9\.]+.*)"/\1/' -) - -# Run a build -build_jellyfin() -( - ROOT=${1-$DEFAULT_ROOT} - CONFIG=${2-$DEFAULT_CONFIG} - DOTNETRUNTIME=${3-$DEFAULT_DOTNETRUNTIME} - OUTPUT_DIR=${4-$DEFAULT_OUTPUT_DIR} - - echo -e "${CYAN}Building jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}'.${NC}" - if [[ $DOTNETRUNTIME == 'framework' ]]; then - dotnet publish "${ROOT}" --configuration "${CONFIG}" --output="${OUTPUT_DIR}" "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none" - else - dotnet publish "${ROOT}" --configuration "${CONFIG}" --output="${OUTPUT_DIR}" --self-contained --runtime ${DOTNETRUNTIME} "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none" - fi - EXIT_CODE=$? - if [ $EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}[DONE] Build jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' complete.${NC}" - else - echo -e "${RED}[FAIL] Build jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' FAILED.${NC}" - fi -) - -# Run a docker -build_jellyfin_docker() -( - BUILD_CONTEXT=${1-$DEFAULT_BUILD_CONTEXT} - DOCKERFILE=${2-$DEFAULT_DOCKERFILE} - IMAGE_TAG=${3-"jellyfin:$(git rev-parse --abbrev-ref HEAD)"} - - echo -e "${CYAN}Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}'.${NC}" - docker build -t ${IMAGE_TAG} -f ${DOCKERFILE} ${BUILD_CONTEXT} - EXIT_CODE=$? - if [ $EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}[DONE] Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}' complete.${NC}" - else - echo -e "${RED}[FAIL] Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}' FAILED.${NC}" - fi -) - -# Clean a build -clean_jellyfin() -( - local ROOT=${1-$DEFAULT_ROOT} - local CONFIG=${2-$DEFAULT_CONFIG} - local OUTPUT_DIR=${3-$DEFAULT_OUTPUT_DIR} - local PKG_DIR=${4-$DEFAULT_PKG_DIR} - echo -e "${CYAN}Cleaning jellyfin in '${ROOT}'' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}'.${NC}" - echo -e "${CYAN}Deleting '${OUTPUT_DIR}'${NC}" - rm -rf "$OUTPUT_DIR" - echo -e "${CYAN}Deleting '${PKG_DIR}'${NC}" - rm -rf "$PKG_DIR" - dotnet clean "${ROOT}" -maxcpucount:1 --configuration ${CONFIG} - local EXIT_CODE=$? - if [ $EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}[DONE] Clean jellyfin in '${ROOT}' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' complete.${NC}" - else - echo -e "${RED}[FAIL] Clean jellyfin in '${ROOT}' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' failed.${NC}" - fi -) - -# Packages the output folder into an archive. -package_portable() -( - local ROOT=${1-$DEFAULT_ROOT} - local OUTPUT_DIR=${2-$DEFAULT_OUTPUT_DIR} - local PKG_DIR=${3-$DEFAULT_PKG_DIR} - local ARCHIVE_CMD=${4-$DEFAULT_ARCHIVE_CMD} - # Package portable build result - if [ -d ${OUTPUT_DIR} ]; then - echo -e "${CYAN}Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}'.${NC}" - mkdir -p ${PKG_DIR} - tar -zcvf "${PKG_DIR}/`basename "${OUTPUT_DIR}"`.portable.tar.gz" -C "`dirname "${OUTPUT_DIR}"`" "`basename "${OUTPUT_DIR}"`" - local EXIT_CODE=$? - if [ $EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}[DONE] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' complete.${NC}" - else - echo -e "${RED}[FAIL] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' FAILED.${NC}" - fi - else - echo -e "${RED}[FAIL] Build artifacts do not exist for ${OUTPUT_DIR}. Run build.sh first.${NC}" - fi -) - diff --git a/deployment/debian-package-arm64/Dockerfile.amd64 b/deployment/debian-package-arm64/Dockerfile.amd64 index a05581d715..5644c14704 100644 --- a/deployment/debian-package-arm64/Dockerfile.amd64 +++ b/deployment/debian-package-arm64/Dockerfile.amd64 @@ -29,6 +29,12 @@ RUN dpkg --add-architecture arm64 \ && cd cross-gcc-packages-amd64/cross-gcc-8-arm64 \ && apt-get install -y gcc-8-source libstdc++-8-dev-arm64-cross binutils-aarch64-linux-gnu bison flex libtool gdb sharutils netbase libmpc-dev libmpfr-dev libgmp-dev systemtap-sdt-dev autogen expect chrpath zlib1g-dev zip libc6-dev:arm64 linux-libc-dev:arm64 libgcc1:arm64 libcurl4-openssl-dev:arm64 libfontconfig1-dev:arm64 libfreetype6-dev:arm64 libssl-dev:arm64 liblttng-ust0:arm64 libstdc++-8-dev:arm64 +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + # Link to docker-build script RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh diff --git a/deployment/debian-package-arm64/clean.sh b/deployment/debian-package-arm64/clean.sh index ac143c3d0b..e7bfdf8b4b 100755 --- a/deployment/debian-package-arm64/clean.sh +++ b/deployment/debian-package-arm64/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/debian-package-arm64/docker-build.sh b/deployment/debian-package-arm64/docker-build.sh index 1c75ece8eb..7a13bafcbb 100755 --- a/deployment/debian-package-arm64/docker-build.sh +++ b/deployment/debian-package-arm64/docker-build.sh @@ -11,6 +11,20 @@ pushd ${SOURCE_DIR} # Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image sed -i '/dotnet-sdk-2.2,/d' debian/control +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + # Build DEB export CONFIG_SITE=/etc/dpkg-cross/cross-config.${ARCH} dpkg-buildpackage -us -uc -aarm64 diff --git a/deployment/debian-package-arm64/package.sh b/deployment/debian-package-arm64/package.sh index ce02b1af53..2091982187 100755 --- a/deployment/debian-package-arm64/package.sh +++ b/deployment/debian-package-arm64/package.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done ARCH="$( arch )" WORKDIR="$( pwd )" @@ -35,7 +39,7 @@ mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./${DOCKERFILE} # Build the DEBs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the DEBs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/deb/* "${output_dir}" diff --git a/deployment/debian-package-armhf/Dockerfile.amd64 b/deployment/debian-package-armhf/Dockerfile.amd64 index 04dffd0000..b05f10def2 100644 --- a/deployment/debian-package-armhf/Dockerfile.amd64 +++ b/deployment/debian-package-armhf/Dockerfile.amd64 @@ -29,6 +29,12 @@ RUN dpkg --add-architecture armhf \ && cd cross-gcc-packages-amd64/cross-gcc-8-armhf \ && apt-get install -y gcc-8-source libstdc++-8-dev-armhf-cross binutils-aarch64-linux-gnu bison flex libtool gdb sharutils netbase libmpc-dev libmpfr-dev libgmp-dev systemtap-sdt-dev autogen expect chrpath zlib1g-dev zip binutils-arm-linux-gnueabihf libc6-dev:armhf linux-libc-dev:armhf libgcc1:armhf libcurl4-openssl-dev:armhf libfontconfig1-dev:armhf libfreetype6-dev:armhf libssl-dev:armhf liblttng-ust0:armhf libstdc++-8-dev:armhf +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + # Link to docker-build script RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh diff --git a/deployment/debian-package-armhf/Dockerfile.armhf b/deployment/debian-package-armhf/Dockerfile.armhf index ed31994352..6729d8f389 100644 --- a/deployment/debian-package-armhf/Dockerfile.armhf +++ b/deployment/debian-package-armhf/Dockerfile.armhf @@ -21,6 +21,12 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/3cb1d917-19cc-4 && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + # Link to docker-build script RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh diff --git a/deployment/debian-package-armhf/clean.sh b/deployment/debian-package-armhf/clean.sh index 3898110aff..35a3d3e9ad 100755 --- a/deployment/debian-package-armhf/clean.sh +++ b/deployment/debian-package-armhf/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/debian-package-armhf/docker-build.sh b/deployment/debian-package-armhf/docker-build.sh index df35345bdd..c48ccb3fb8 100755 --- a/deployment/debian-package-armhf/docker-build.sh +++ b/deployment/debian-package-armhf/docker-build.sh @@ -11,6 +11,20 @@ pushd ${SOURCE_DIR} # Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image sed -i '/dotnet-sdk-2.2,/d' debian/control +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + # Build DEB export CONFIG_SITE=/etc/dpkg-cross/cross-config.${ARCH} dpkg-buildpackage -us -uc -aarmhf diff --git a/deployment/debian-package-armhf/package.sh b/deployment/debian-package-armhf/package.sh index 4393fb8340..4a27dd8283 100755 --- a/deployment/debian-package-armhf/package.sh +++ b/deployment/debian-package-armhf/package.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done ARCH="$( arch )" WORKDIR="$( pwd )" @@ -35,7 +39,7 @@ mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./${DOCKERFILE} # Build the DEBs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the DEBs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/deb/* "${output_dir}" diff --git a/deployment/debian-package-x64/Dockerfile b/deployment/debian-package-x64/Dockerfile index 45befd76bf..2f97d39445 100644 --- a/deployment/debian-package-x64/Dockerfile +++ b/deployment/debian-package-x64/Dockerfile @@ -21,6 +21,12 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/228832ea-805f-4 && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + # Link to docker-build script RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh diff --git a/deployment/debian-package-x64/clean.sh b/deployment/debian-package-x64/clean.sh index b2960fcb3a..4e507bcb27 100755 --- a/deployment/debian-package-x64/clean.sh +++ b/deployment/debian-package-x64/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/debian-package-x64/docker-build.sh b/deployment/debian-package-x64/docker-build.sh index 9781879f6f..97bc45a060 100755 --- a/deployment/debian-package-x64/docker-build.sh +++ b/deployment/debian-package-x64/docker-build.sh @@ -11,6 +11,20 @@ pushd ${SOURCE_DIR} # Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image sed -i '/dotnet-sdk-2.2,/d' debian/control +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + # Build DEB dpkg-buildpackage -us -uc diff --git a/deployment/debian-package-x64/package.sh b/deployment/debian-package-x64/package.sh index 2530e253bd..5a416959ab 100755 --- a/deployment/debian-package-x64/package.sh +++ b/deployment/debian-package-x64/package.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done WORKDIR="$( pwd )" @@ -24,7 +28,7 @@ mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile # Build the DEBs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the DEBs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/deb/* "${output_dir}" diff --git a/deployment/debian-package-x64/pkg-src/changelog b/deployment/debian-package-x64/pkg-src/changelog index 54d4cffbae..3d2cb770fd 100644 --- a/deployment/debian-package-x64/pkg-src/changelog +++ b/deployment/debian-package-x64/pkg-src/changelog @@ -51,297 +51,3 @@ jellyfin (10.3.0-1) unstable; urgency=medium * New upstream version 10.3.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.0 -- Jellyfin Packaging Team Fri, 19 Apr 2019 14:24:29 -0400 - -jellyfin (10.2.2-1) unstable; urgency=medium - - * jellyfin: - * PR968 Release 10.2.z copr autobuild - * PR964 Install the dotnet runtime package in Fedora build - * PR979 Build Package releases without debug turned on - * PR990 Fix slow local image validation - * PR991 Fix the ffmpeg compatibility - * PR992 Add Debian armhf (Raspberry Pi) build plus crossbuild - * PR998 Set EnableRaisingEvents to true for processes that require it - * PR1017 Set ffmpeg+ffprobe paths in Docker container - * jellyfin-web: - * PR152 Go back on Media stop - * PR156 Fix volume slider not working on nowplayingbar - - -- Jellyfin Packaging Team Thu, 28 Feb 2019 15:32:16 -0500 - -jellyfin (10.2.1-1) unstable; urgency=medium - - * jellyfin: - * PR920 Fix cachedir missing from Docker container - * PR924 Use the movie name instead of folder name - * PR933 Semi-revert to prefer old movie grouping behaviour - * PR948 Revert movie matching (supercedes PR933, PR924, PR739) - * PR960 Use jellyfin/ffmpeg image - * jellyfin-web: - * PR136 Re-add OpenSubtitles configuration page - * PR137 Replace HeaderEmbyServer with HeaderJellyfinServer on plugincatalog - * PR138 Remove left-over JS for Customize Home Screen - * PR141 Exit fullscreen automatically after video playback ends - - -- Jellyfin Packaging Team Wed, 20 Feb 2019 11:36:16 -0500 - -jellyfin (10.2.0-2) unstable; urgency=medium - - * jellyfin: - * PR452 Use EF Core for Activity database - * PR535 Clean up streambuilder - * PR655 Support trying local branches in submodule - * PR656 Do some logging in MediaInfoService - * PR657 Remove conditions that are always true/false - * PR661 Fix NullRef from progress report - * PR663 Use TagLibSharp Nuget package - * PR664 Revert "Fix segment_time_delta for ffmpeg 4.1" - * PR666 Add cross-platform build for arm64 - * PR668 Return Audio objects from MusicAlbum.Tracks - * PR671 Set EnableRaisingEvents correctly - * PR672 Remove unconditional caching, modified since header and use ETags - * PR677 Fix arm32 Docker - * PR681 Fix Windows build script errors + pin ffmpeg to 4.0 - * PR686 Disable some StyleCop warnings - * PR687 Fix some analyzer warnings - * PR689 Fix RPM package build for fedora - * PR702 Fix debug build on windows - * PR706 Make another docker layer reusable - * PR709 Fix always null expressions - * PR710 Fix a spelling mistake - * PR711 Remove remnants of system events - * PR713 Fix empty statement in DidlBuilder.cs - * PR716 Remove more compile time warnings - * PR721 Change image dimentions from double to int - * PR723 Minor improvements to db code - * PR724 Move Skia back into it's own project - * PR726 Clean up IFileSystem wrappers around stdlib. - * PR727 Change default aspect ratio to 2/3 from 0 - * PR728 Use ffmpeg from jrottenberg/ffmpeg - * PR732 Reworked LocalizationManager to load data async - * PR733 Remove unused function - * PR734 Fix more analyzer warnings - * PR736 Start startup tasks async - * PR737 Add AssemblyInfo for Jellyfin.Drawing.Skia - * PR739 Change multi version logic for movies - * PR740 Remove code for pre-installed plugins & properly check if file exists - * PR756 Make cache dir configurable - * PR757 Fix default aspect ratio - * PR758 Add password field to initial setup - * PR764 Remove dead code, made some functions properly async - * PR769 Fix conditions where the ! was swallowed in #726 - * PR774 reimplement support for plugin repository - * PR782 Remove commented file MediaBrowser.LocalMetadata.Savers.PersonXmlSaver - * PR783 Update builds to use #749 and #756 - * PR788 Fix more warnings - * PR794 Remove MoreLINQ - * PR797 Fix all warnings - * PR798 Cleanup around the api endpoints - * PR800 Add CentOS and update rpm spec for the cachedir option - * PR802 Fix build error - * PR804 Handle new option parser properly - * PR805 Add weblate translation status to README - * PR807 Fix restart script in OS packages - * PR810 Fix loading of rating files - * PR812 Fix up the explicit docs links in the README - * PR819 Some small changes in Device.cs and DidlBuilder.cs - * PR822 Complete rename ImageSize -> ImageDimensions - * PR824 Improved Docker pkgbuild - * PR831 Move some arrays to generics - * PR833 Add await to GetCountries in LocalizationService - * PR834 Add donation badge and reorganize badges - * PR838 Quick style fix - * PR840 Fix more warnings - * PR841 Fix OC badge to all and add forum badge - * PR842 Use VAAPI-enabled ffmpeg - * PR852 Use SQLitePCL.pretty.netstandard on NuGet - * PR853 Fix poor handling of cache directories - * PR864: Add support for ZIP plugin archives - * PR868: Fix audio streaming via BaseProgressiveStreamingService - * PR869: Remove DLL support and require all packages/plugins to be zip archives - * PR872: Fix potential NullReferenceException - * PR890: Drop ETag and use Last-Modified header - * PR892: Add jellyfin-ffmpeg and versioning to package deps - * PR899: DLNA: Fix race condition leading to missing device names - * PR901: Properly dispose HttpWebResponse when the request failed to avoid 'too many open files' - * PR909: Fix docker arm builds - * PR910: Enhance Dockerfiles - * PR911: Checkout submodules in Docker Hub hook - * jellyfin-web: - * PR51 remove more code for sync and camera roll - * PR56 Use English for fallback translations and clean up language files - * PR58 Css slider fixes - * PR62 remove BOM markers - * PR65 Fix profile image not being shown on profile page - * PR73 Dev sync - * PR74 Add download menu option to media items - * PR75 User profile fixes - * PR76 Fix syntax error caused by deminification - * PR79 Remove unused Connect related from the frontend - * PR80 Remove games - * PR92 Added frontend support for a password field on setup - * PR94 Update british strings - * PR95 add display language option back - * PR112 Removed seasonal theme support - * PR116 Consolidate all strings into a single file per language - * PR117 Fix volume slider behavior - * PR118 Enable and fix PiP for Safari - * PR119 Make the toggle track visible on all themes - * PR121 Fix syntax error in site.js - * PR127 Change sharedcomponents module to core - * PR135 Make sure fallback culture is always available - - -- Jellyfin Packaging Team Fri, 15 Feb 2019 20:51:25 -0500 - -jellyfin (10.1.0-1) unstable; urgency=medium - - * jellyfin: - * PR335 Build scripts and build system consolidation. - * PR424 add jellyfin-web as submodule - * PR455 Cleanup some small things - * PR458 Clean up several minor issues and add TODOs - * PR506 Removing tabs and trailing whitespace - * PR508 Update internal versioning and user agents. - * PR516 Remove useless properties from IEnvironmentInfo - * PR520 Fix potential bug where aspect ratio would be incorrectly calculated - * PR534 Add linux-arm and linux-arm64 native NuGet dependency. - * PR540 Update Emby API keys to our own - * PR541 Change ItemId to Guid in ProviderManager - * PR556 Fix "Password Reset by PIN" page - * PR562 Fix error with uppercase photo extension and fix typo in a log line - * PR563 Update dev from master - * PR566 Avoid printing stacktrace when bind to port 1900 fails - * PR567 Shutdown gracefully when recieving a termination signal - * PR571 Add more NuGet metadata properties - * PR575 Reformat all C# server code to conform with code standards - * PR576 Add code analysers for debug builds - * PR580 Fix Docker build - * PR582 Replace custom image parser with Skia - * PR587 Add nuget info to Emby.Naming - * PR589 Ensure config and log folders exist - * PR596 Fix indentation for xml files - * PR598 Remove MediaBrowser.Text for license violations and hackiness - * PR606 Slim down docker image - * PR613 Update MediaEncoding - * PR616 Add Swagger documentation - * PR619 Really slim down Docker container - * PR621 Minor improvements to library scan code - * PR622 Add unified build script and bump_version script - * PR623 Replaced injections of ILogger with ILoggerFactory - * PR625 Update taglib-sharp - * PR626 Fix extra type name in parameter, add out keyword - * PR627 Use string for ApplicationVersion - * PR628 Update Product Name (User-Agent) - * PR629 Fix subtitle converter misinterpreting 0 valued endTimeTicks - * PR631 Cleanup ImageProcessor and SkiaEncoder - * PR634 Replace our TVDB key with @drakus72's which is V1 - * PR636 Allow subtitle extraction and conversion in direct streaming - * PR637 Remove unused font - * PR638 Removed XmlTv testfiles and nuget install - * PR646: Fix infinite loop bug on subtitle.m3u8 request - * PR655: Support trying local branches in submodule - * PR661: Fix NullRef from progress report - * PR666: Add cross-platform build for arm64 - * jellyfin-web: - * PR1: Change webcomponents to non-minified version - * PR4: Fix user profile regression - * PR6: Make icon into proper ico and large PNG - * PR7: Fix firefox failing to set password for users with no password set - * PR8: Remove premiere stuff and fix crashes caused by earlier removals - * PR12: Fix return from PIN reset to index.html - * PR13: Send android clients to select server before login - * PR14: Reimplement page to add server - * PR16: Fix spinning circle at the end of config wizard - * PR17: Fix directorybrower not resetting scroll - * PR19: Set union merge for CONTRIBUTORS.md - * PR20: Show album thumbnail and artist image in page itemdetail - * PR26: Make the card titles clickable - * PR27: Stop pagination and adding a library from being able to trigger multiple times - * PR28: Add transparent nav bar to BlueRadiance theme CSS - * PR29: Clean up imageuploader - * PR30: Remove iap and simplify registrationservices - * PR36: Open videos in fullscreen on android devices - * PR37: Remove broken features from web interface - * PR38: Fix inconsistent UI coloring around settings drawer - * PR39: Remove back button from dashboard and metadata manager - * PR42: Fix Home backdrop not loading - * PR43: Filter videos by audio stream language - * PR44: Remove filter from library collection type options - * PR45: Fix data-backbutton logic - * PR46: Minor changes to navbar elements - * PR48: Remove Sync code - * PR52: Fix progress color - * PR53: Fix user tabs color - * PR54: Add back button to server dashboard - - -- Jellyfin Packaging Team Sun, 20 Jan 2019 23:19:46 -0500 - -jellyfin (10.0.2-1) unstable; urgency=medium - - * Hotfix release - * jellyfin/jellyfin-web#23: Update Chromecast app ID [via direct commit] - * #540: Update Emby API keys to our own - * #541: Change ItemId to Guid in ProviderManager - * #566: Avoid printing stacktrace when bind to port 1900 fails - - -- Joshua Boniface Sat, 19 Jan 2019 01:19:59 -0500 - -jellyfin (10.0.1-1) unstable; urgency=medium - - * Hotfix release, corrects several small bugs from 10.0.0 - * #512: Fix CONTRIBUTORS.md formatting - * #501: Fix regression in integer divisions in latest movies category - * #498: Change contributing link in settings to readthedocs.io - * #493: Remove unused values.txt resource - * #491: Fix userprofile.js crash - * #519: Fix the DecodeJfif function to get proper image sizes - * #486: Add NuGet package info to plugin projects - - -- Joshua Boniface Tue, 08 Jan 2019 20:06:01 -0500 - -jellyfin (10.0.0-1) unstable; urgency=medium - - * The first Jellyfin release under our new versioning scheme - * Numerous bugfixes and code readability improvements - * Updated logging configuration, including flag for it and configdir - * Updated theming including logo - * Dozens of other improvements as documented in GitHub pull request #419 - - -- Joshua Boniface Sat, 05 Jan 2019 15:39:25 -0500 - -jellyfin (3.5.2-5) unstable; urgency=medium - - * Fully GPL'd release - remove tainted code from MediaBrowser.Common - * Several code cleanups and tweaks - - -- Joshua Boniface Fri, 28 Dec 2018 10:26:30 -0500 - -jellyfin (3.5.2-4) unstable; urgency=medium - - * Correct manifest.json bug and vdpau - - -- Joshua Boniface Thu, 20 Dec 2018 18:31:43 -0500 - -jellyfin (3.5.2-3) unstable; urgency=medium - - * Correct several bugs in 3.5.2-2 packaging - - -- Joshua Boniface Sat, 15 Dec 2018 18:17:32 -0500 - -jellyfin (3.5.2-2) unstable; urgency=medium - - * Major code updates related to rebranding and cleanup - - -- Joshua Boniface Fri, 14 Dec 2018 00:07:46 -0500 - -jellyfin (3.5.2-1) unstable; urgency=medium - - * Add ffmpeg dependency and cleanup work - - -- Joshua Boniface Tue, 11 Dec 2018 20:55:32 -0500 - -jellyfin (3.5.2) unstable; urgency=medium - - * Rename from emby-server on version 3.5.2 - - -- Joshua Boniface Sun, 9 Dec 2018 15:20:58 -0400 diff --git a/deployment/docker/build.sh b/deployment/docker/build.sh deleted file mode 100755 index 444208c85c..0000000000 --- a/deployment/docker/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -source ../common.build.sh - -VERSION=`get_version ../..` - -build_jellyfin_docker ../.. ../../Dockerfile jellyfin:amd64-${VERSION} - -build_jellyfin_docker ../.. ../../Dockerfile.arm jellyfin:arm-${VERSION} - -#build_jellyfin_docker ../.. ../../Dockerfile.arm64v8 jellyfin:arm64v8-${VERSION} -#build_jellyfin_docker ../.. ../../Dockerfile.arm32v7 jellyfin:arm32v7-${VERSION} diff --git a/deployment/docker/package.sh b/deployment/docker/package.sh deleted file mode 100755 index d74426e2fe..0000000000 --- a/deployment/docker/package.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -source ../common.build.sh - -VERSION=`get_version ../..` - -docker manifest create jellyfin:${VERSION} jellyfin:amd64-${VERSION} jellyfin:arm32v7-${VERSION} jellyfin:arm64v8-${VERSION} -docker manifest annotate jellyfin:amd64-${VERSION} --os linux --arch amd64 -#docker manifest annotate jellyfin:arm32v7-${VERSION} --os linux --arch arm --variant armv7 -#docker manifest annotate jellyfin:arm64v8-${VERSION} --os linux --arch arm64 --variant armv8 - -#TODO publish.sh - docker manifest push jellyfin:${VERSION} diff --git a/deployment/fedora-package-x64/Dockerfile b/deployment/fedora-package-x64/Dockerfile index 397c944eae..b8226b1738 100644 --- a/deployment/fedora-package-x64/Dockerfile +++ b/deployment/fedora-package-x64/Dockerfile @@ -8,13 +8,23 @@ ARG SDK_VERSION=2.2 ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist -# Prepare Fedora build environment -RUN dnf update -y \ - && dnf install -y @buildsys-build rpmdevtools dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel \ - && dnf copr enable -y @dotnet-sig/dotnet \ +# Prepare Fedora environment +RUN dnf update -y + +# Install build dependencies +RUN dnf install -y @buildsys-build rpmdevtools dnf-plugins-core libcurl-devel fontconfig-devel freetype-devel openssl-devel glibc-devel libicu-devel nodejs wget git + +# Install DotNET SDK +RUN dnf copr enable -y @dotnet-sig/dotnet \ && rpmdev-setuptree \ - && dnf install -y dotnet-sdk-${SDK_VERSION} dotnet-runtime-${SDK_VERSION} \ - && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \ + && dnf install -y dotnet-sdk-${SDK_VERSION} dotnet-runtime-${SDK_VERSION} + +# Install yarn package manager +RUN wget -q -O /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \ + && dnf install -y yarn + +# Create symlinks and directories +RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \ && mkdir -p ${SOURCE_DIR}/SPECS \ && ln -s ${PLATFORM_DIR}/pkg-src/jellyfin.spec ${SOURCE_DIR}/SPECS/jellyfin.spec \ && mkdir -p ${SOURCE_DIR}/SOURCES \ diff --git a/deployment/fedora-package-x64/clean.sh b/deployment/fedora-package-x64/clean.sh index 408167e49b..700c8f1bb3 100755 --- a/deployment/fedora-package-x64/clean.sh +++ b/deployment/fedora-package-x64/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/fedora-package-x64/create_tarball.sh b/deployment/fedora-package-x64/create_tarball.sh deleted file mode 100755 index e8301c9897..0000000000 --- a/deployment/fedora-package-x64/create_tarball.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -# shellcheck disable=SC1091 -source ../common.build.sh - -WORKDIR="$( pwd )" -VERSION="$( sed -ne '/^Version:/s/.* *//p' "${WORKDIR}"/pkg-src/jellyfin.spec )" - -package_temporary_dir="${WORKDIR}/pkg-dist-tmp" -pkg_src_dir="${WORKDIR}/pkg-src" - -GNU_TAR=1 -echo "Bundling all sources for RPM build." -tar \ ---transform "s,^\.,jellyfin-${VERSION}," \ ---exclude='.git*' \ ---exclude='**/.git' \ ---exclude='**/.hg' \ ---exclude='**/.vs' \ ---exclude='**/.vscode' \ ---exclude='deployment' \ ---exclude='**/bin' \ ---exclude='**/obj' \ ---exclude='**/.nuget' \ ---exclude='*.deb' \ ---exclude='*.rpm' \ --czf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz" \ --C "../.." ./ || GNU_TAR=0 - -if [ $GNU_TAR -eq 0 ]; then - echo "The installed tar binary did not support --transform. Using workaround." - mkdir -p "${package_temporary_dir}/jellyfin"{,-"${VERSION}"} - # Not GNU tar - tar \ - --exclude='.git*' \ - --exclude='**/.git' \ - --exclude='**/.hg' \ - --exclude='**/.vs' \ - --exclude='**/.vscode' \ - --exclude='deployment' \ - --exclude='**/bin' \ - --exclude='**/obj' \ - --exclude='**/.nuget' \ - --exclude='*.deb' \ - --exclude='*.rpm' \ - -zcf \ - "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \ - -C "../.." ./ - echo "Extracting filtered package." - tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}" - echo "Removing filtered package." - rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" - echo "Repackaging package into final tarball." - tar -czf "${pkg_src_dir}/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}" -fi diff --git a/deployment/fedora-package-x64/docker-build.sh b/deployment/fedora-package-x64/docker-build.sh index cefb1652e9..014f582f08 100755 --- a/deployment/fedora-package-x64/docker-build.sh +++ b/deployment/fedora-package-x64/docker-build.sh @@ -8,7 +8,69 @@ set -o xtrace # Move to source directory pushd ${SOURCE_DIR} -ls -al SOURCES/pkg-src/ +VERSION="$( grep '^Version:' ${SOURCE_DIR}/SOURCES/pkg-src/jellyfin.spec | awk '{ print $NF }' )" + +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + +# Create RPM source archive +GNU_TAR=1 +echo "Bundling all sources for RPM build." +tar \ +--transform "s,^\.,jellyfin-${VERSION}," \ +--exclude='.git*' \ +--exclude='**/.git' \ +--exclude='**/.hg' \ +--exclude='**/.vs' \ +--exclude='**/.vscode' \ +--exclude='deployment' \ +--exclude='**/bin' \ +--exclude='**/obj' \ +--exclude='**/.nuget' \ +--exclude='*.deb' \ +--exclude='*.rpm' \ +-czf "${SOURCE_DIR}/SOURCES/pkg-src/jellyfin-${VERSION}.tar.gz" \ +-C ${SOURCE_DIR} ./ || GNU_TAR=0 + +if [ $GNU_TAR -eq 0 ]; then + echo "The installed tar binary did not support --transform. Using workaround." + package_temporary_dir="$( mktemp -d )" + mkdir -p "${package_temporary_dir}/jellyfin" + # Not GNU tar + tar \ + --exclude='.git*' \ + --exclude='**/.git' \ + --exclude='**/.hg' \ + --exclude='**/.vs' \ + --exclude='**/.vscode' \ + --exclude='deployment' \ + --exclude='**/bin' \ + --exclude='**/obj' \ + --exclude='**/.nuget' \ + --exclude='*.deb' \ + --exclude='*.rpm' \ + -czf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" \ + -C ${SOURCE_DIR} ./ + echo "Extracting filtered package." + mkdir -p "${package_temporary_dir}/jellyfin-${VERSION}" + tar -xzf "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}/jellyfin-${VERSION}" + echo "Removing filtered package." + rm -f "${package_temporary_dir}/jellyfin/jellyfin-${VERSION}.tar.gz" + echo "Repackaging package into final tarball." + tar -czf "${SOURCE_DIR}/SOURCES/pkg-src/jellyfin-${VERSION}.tar.gz" -C "${package_temporary_dir}" "jellyfin-${VERSION}" + rm -rf ${package_temporary_dir} +fi # Build RPM spectool -g -R SPECS/jellyfin.spec diff --git a/deployment/fedora-package-x64/package.sh b/deployment/fedora-package-x64/package.sh index e659ee5e9e..ae6962dd1f 100755 --- a/deployment/fedora-package-x64/package.sh +++ b/deployment/fedora-package-x64/package.sh @@ -1,13 +1,15 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done WORKDIR="$( pwd )" -VERSION="$( grep '^Version:' ${WORKDIR}/pkg-src/jellyfin.spec | awk '{ print $NF }' )" package_temporary_dir="${WORKDIR}/pkg-dist-tmp" output_dir="${WORKDIR}/pkg-dist" -pkg_src_dir="${WORKDIR}/pkg-src" current_user="$( whoami )" image_name="jellyfin-fedora-build" @@ -21,14 +23,12 @@ else docker_sudo="" fi -./create_tarball.sh - # Prepare temporary package dir mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile # Build the RPMs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the RPMs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/rpm/* "${output_dir}" diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.spec b/deployment/fedora-package-x64/pkg-src/jellyfin.spec index d591a54e1f..b4cd5b2be3 100644 --- a/deployment/fedora-package-x64/pkg-src/jellyfin.spec +++ b/deployment/fedora-package-x64/pkg-src/jellyfin.spec @@ -158,213 +158,3 @@ fi - New upstream version 10.3.1; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.1 * Fri Apr 19 2019 Jellyfin Packaging Team - New upstream version 10.3.0; release changelog at https://github.com/jellyfin/jellyfin/releases/tag/v10.3.0 -* Thu Feb 28 2019 Jellyfin Packaging Team -- jellyfin: -- PR968 Release 10.2.z copr autobuild -- PR964 Install the dotnet runtime package in Fedora build -- PR979 Build Package releases without debug turned on -- PR990 Fix slow local image validation -- PR991 Fix the ffmpeg compatibility -- PR992 Add Debian armhf (Raspberry Pi) build plus crossbuild -- PR998 Set EnableRaisingEvents to true for processes that require it -- PR1017 Set ffmpeg+ffprobe paths in Docker container -- jellyfin-web: -- PR152 Go back on Media stop -- PR156 Fix volume slider not working on nowplayingbar -* Wed Feb 20 2019 Jellyfin Packaging Team -- jellyfin: -- PR920 Fix cachedir missing from Docker container -- PR924 Use the movie name instead of folder name -- PR933 Semi-revert to prefer old movie grouping behaviour -- PR948 Revert movie matching (supercedes PR933, PR924, PR739) -- PR960 Use jellyfin/ffmpeg image -- jellyfin-web: -- PR136 Re-add OpenSubtitles configuration page -- PR137 Replace HeaderEmbyServer with HeaderJellyfinServer on plugincatalog -- PR138 Remove left-over JS for Customize Home Screen -- PR141 Exit fullscreen automatically after video playback ends -* Fri Feb 15 2019 Jellyfin Packaging Team -- jellyfin: -- PR452 Use EF Core for Activity database -- PR535 Clean up streambuilder -- PR655 Support trying local branches in submodule -- PR656 Do some logging in MediaInfoService -- PR657 Remove conditions that are always true/false -- PR661 Fix NullRef from progress report -- PR663 Use TagLibSharp Nuget package -- PR664 Revert "Fix segment_time_delta for ffmpeg 4.1" -- PR666 Add cross-platform build for arm64 -- PR668 Return Audio objects from MusicAlbum.Tracks -- PR671 Set EnableRaisingEvents correctly -- PR672 Remove unconditional caching, modified since header and use ETags -- PR677 Fix arm32 Docker -- PR681 Fix Windows build script errors + pin ffmpeg to 4.0 -- PR686 Disable some StyleCop warnings -- PR687 Fix some analyzer warnings -- PR689 Fix RPM package build for fedora -- PR702 Fix debug build on windows -- PR706 Make another docker layer reusable -- PR709 Fix always null expressions -- PR710 Fix a spelling mistake -- PR711 Remove remnants of system events -- PR713 Fix empty statement in DidlBuilder.cs -- PR716 Remove more compile time warnings -- PR721 Change image dimentions from double to int -- PR723 Minor improvements to db code -- PR724 Move Skia back into it's own project -- PR726 Clean up IFileSystem wrappers around stdlib. -- PR727 Change default aspect ratio to 2/3 from 0 -- PR728 Use ffmpeg from jrottenberg/ffmpeg -- PR732 Reworked LocalizationManager to load data async -- PR733 Remove unused function -- PR734 Fix more analyzer warnings -- PR736 Start startup tasks async -- PR737 Add AssemblyInfo for Jellyfin.Drawing.Skia -- PR739 Change multi version logic for movies -- PR740 Remove code for pre-installed plugins & properly check if file exists -- PR756 Make cache dir configurable -- PR757 Fix default aspect ratio -- PR758 Add password field to initial setup -- PR764 Remove dead code, made some functions properly async -- PR769 Fix conditions where the ! was swallowed in #726 -- PR774 reimplement support for plugin repository -- PR782 Remove commented file MediaBrowser.LocalMetadata.Savers.PersonXmlSaver -- PR783 Update builds to use #749 and #756 -- PR788 Fix more warnings -- PR794 Remove MoreLINQ -- PR797 Fix all warnings -- PR798 Cleanup around the api endpoints -- PR800 Add CentOS and update rpm spec for the cachedir option -- PR802 Fix build error -- PR804 Handle new option parser properly -- PR805 Add weblate translation status to README -- PR807 Fix restart script in OS packages -- PR810 Fix loading of rating files -- PR812 Fix up the explicit docs links in the README -- PR819 Some small changes in Device.cs and DidlBuilder.cs -- PR822 Complete rename ImageSize -> ImageDimensions -- PR824 Improved Docker pkgbuild -- PR831 Move some arrays to generics -- PR833 Add await to GetCountries in LocalizationService -- PR834 Add donation badge and reorganize badges -- PR838 Quick style fix -- PR840 Fix more warnings -- PR841 Fix OC badge to all and add forum badge -- PR842 Use VAAPI-enabled ffmpeg -- PR852 Use SQLitePCL.pretty.netstandard on NuGet -- PR853 Fix poor handling of cache directories -- PR864 Add support for ZIP plugin archives -- PR868 Fix audio streaming via BaseProgressiveStreamingService -- PR869 Remove DLL support and require all packages/plugins to be zip archives -- PR872 Fix potential NullReferenceException -- PR899: DLNA: Fix race condition leading to missing device names -- PR890 Drop ETag and use Last-Modified header -- PR892: Add jellyfin-ffmpeg and versioning to package deps -- PR901: Properly dispose HttpWebResponse when the request failed to avoid 'too many open files' -- PR909: Fix docker arm builds -- PR910: Enhance Dockerfiles -- PR911: Checkout submodules in Docker Hub hook -- jellyfin-web: -- PR51 remove more code for sync and camera roll -- PR56 Use English for fallback translations and clean up language files -- PR58 Css slider fixes -- PR62 remove BOM markers -- PR65 Fix profile image not being shown on profile page -- PR73 Dev sync -- PR74 Add download menu option to media items -- PR75 User profile fixes -- PR76 Fix syntax error caused by deminification -- PR79 Remove unused Connect related from the frontend -- PR80 Remove games -- PR92 Added frontend support for a password field on setup -- PR94 Update british strings -- PR95 add display language option back -- PR112 Removed seasonal theme support -- PR116 Consolidate all strings into a single file per language -- PR117 Fix volume slider behavior -- PR118 Enable and fix PiP for Safari -- PR119 Make the toggle track visible on all themes -- PR121 Fix syntax error in site.js -- PR127 Change sharedcomponents module to core -- PR135 Make sure fallback culture is always available -* Sun Jan 20 2019 Jellyfin Packaging Team -- jellyfin: -- PR335 Build scripts and build system consolidation. -- PR424 add jellyfin-web as submodule -- PR455 Cleanup some small things -- PR458 Clean up several minor issues and add TODOs -- PR506 Removing tabs and trailing whitespace -- PR508 Update internal versioning and user agents. -- PR516 Remove useless properties from IEnvironmentInfo -- PR520 Fix potential bug where aspect ratio would be incorrectly calculated -- PR534 Add linux-arm and linux-arm64 native NuGet dependency. -- PR540 Update Emby API keys to our own -- PR541 Change ItemId to Guid in ProviderManager -- PR556 Fix "Password Reset by PIN" page -- PR562 Fix error with uppercase photo extension and fix typo in a log line -- PR563 Update dev from master -- PR566 Avoid printing stacktrace when bind to port 1900 fails -- PR567 Shutdown gracefully when recieving a termination signal -- PR571 Add more NuGet metadata properties -- PR575 Reformat all C# server code to conform with code standards -- PR576 Add code analysers for debug builds -- PR580 Fix Docker build -- PR582 Replace custom image parser with Skia -- PR587 Add nuget info to Emby.Naming -- PR589 Ensure config and log folders exist -- PR596 Fix indentation for xml files -- PR598 Remove MediaBrowser.Text for license violations and hackiness -- PR606 Slim down docker image -- PR613 Update MediaEncoding -- PR616 Add Swagger documentation -- PR619 Really slim down Docker container -- PR621 Minor improvements to library scan code -- PR622 Add unified build script and bump_version script -- PR623 Replaced injections of ILogger with ILoggerFactory -- PR625 Update taglib-sharp -- PR626 Fix extra type name in parameter, add out keyword -- PR627 Use string for ApplicationVersion -- PR628 Update Product Name (User-Agent) -- PR629 Fix subtitle converter misinterpreting 0 valued endTimeTicks -- PR631 Cleanup ImageProcessor and SkiaEncoder -- PR634 Replace our TVDB key with @drakus72's which is V1 -- PR636 Allow subtitle extraction and conversion in direct streaming -- PR637 Remove unused font -- PR638 Removed XmlTv testfiles and nuget install -- PR646: Fix infinite loop bug on subtitle.m3u8 request -- PR655: Support trying local branches in submodule -- PR661: Fix NullRef from progress report -- PR666: Add cross-platform build for arm64 -- jellyfin-web: -- PR1: Change webcomponents to non-minified version -- PR4: Fix user profile regression -- PR6: Make icon into proper ico and large PNG -- PR7: Fix firefox failing to set password for users with no password set -- PR8: Remove premiere stuff and fix crashes caused by earlier removals -- PR12: Fix return from PIN reset to index.html -- PR13: Send android clients to select server before login -- PR14: Reimplement page to add server -- PR16: Fix spinning circle at the end of config wizard -- PR17: Fix directorybrower not resetting scroll -- PR19: Set union merge for CONTRIBUTORS.md -- PR20: Show album thumbnail and artist image in page itemdetail -- PR26: Make the card titles clickable -- PR27: Stop pagination and adding a library from being able to trigger multiple times -- PR28: Add transparent nav bar to BlueRadiance theme CSS -- PR29: Clean up imageuploader -- PR30: Remove iap and simplify registrationservices -- PR36: Open videos in fullscreen on android devices -- PR37: Remove broken features from web interface -- PR38: Fix inconsistent UI coloring around settings drawer -- PR39: Remove back button from dashboard and metadata manager -- PR42: Fix Home backdrop not loading -- PR43: Filter videos by audio stream language -- PR44: Remove filter from library collection type options -- PR45: Fix data-backbutton logic -- PR46: Minor changes to navbar elements -- PR48: Remove Sync code -- PR52: Fix progress color -- PR53: Fix user tabs color -- PR54: Add back button to server dashboard -* Fri Jan 11 2019 Thomas Büttner - 10.0.2-1 -- TODO Changelog for 10.0.2 diff --git a/deployment/linux-x64/Dockerfile b/deployment/linux-x64/Dockerfile new file mode 100644 index 0000000000..d634b55de9 --- /dev/null +++ b/deployment/linux-x64/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:10 +# Docker build arguments +ARG SOURCE_DIR=/jellyfin +ARG PLATFORM_DIR=/jellyfin/deployment/linux-x64 +ARG ARTIFACT_DIR=/dist +ARG SDK_VERSION=2.2 +# Docker run environment +ENV SOURCE_DIR=/jellyfin +ENV ARTIFACT_DIR=/dist +ENV DEB_BUILD_OPTIONS=noddebs +ENV ARCH=amd64 + +# Prepare Debian build environment +RUN apt-get update \ + && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0 + +# Install dotnet repository +# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current +RUN wget https://download.visualstudio.microsoft.com/download/pr/228832ea-805f-45ab-8c88-fa36165701b9/16ce29a06031eeb09058dee94d6f5330/dotnet-sdk-2.2.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ + && mkdir -p dotnet-sdk \ + && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ + && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet + +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + +# Link to docker-build script +RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh + +VOLUME ${ARTIFACT_DIR}/ + +COPY . ${SOURCE_DIR}/ + +ENTRYPOINT ["/docker-build.sh"] diff --git a/deployment/linux-x64/build.sh b/deployment/linux-x64/build.sh deleted file mode 100755 index 1f0fb62d36..0000000000 --- a/deployment/linux-x64/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -source ../common.build.sh - -VERSION=`get_version ../..` - -build_jellyfin ../../Jellyfin.Server Release linux-x64 `pwd`/dist/jellyfin_${VERSION} diff --git a/deployment/linux-x64/clean.sh b/deployment/linux-x64/clean.sh index 3df2d7796e..c07501a7bb 100755 --- a/deployment/linux-x64/clean.sh +++ b/deployment/linux-x64/clean.sh @@ -1,7 +1,27 @@ #!/usr/bin/env bash -source ../common.build.sh +keep_artifacts="${1}" -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-linux-build" + +rm -rf "${package_temporary_dir}" &>/dev/null \ + || sudo rm -rf "${package_temporary_dir}" &>/dev/null + +rm -rf "${output_dir}" &>/dev/null \ + || sudo rm -rf "${output_dir}" &>/dev/null + +if [[ ${keep_artifacts} == 'n' ]]; then + docker_sudo="" + if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo=sudo + fi + ${docker_sudo} docker image rm ${image_name} --force +fi diff --git a/deployment/linux-x64/dependencies.txt b/deployment/linux-x64/dependencies.txt index 3d25d1bdf4..bdb9670965 100644 --- a/deployment/linux-x64/dependencies.txt +++ b/deployment/linux-x64/dependencies.txt @@ -1 +1 @@ -dotnet +docker diff --git a/deployment/linux-x64/docker-build.sh b/deployment/linux-x64/docker-build.sh new file mode 100755 index 0000000000..8860f943c9 --- /dev/null +++ b/deployment/linux-x64/docker-build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Builds the TAR archive inside the Docker container + +set -o errexit +set -o xtrace + +# Move to source directory +pushd ${SOURCE_DIR} + +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + +# Get version +version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" + +# Build archives +dotnet publish --configuration Release --self-contained --runtime linux-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true" +tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version} +rm -rf /dist/jellyfin_${version} + +# Move the artifacts out +mkdir -p ${ARTIFACT_DIR}/ +mv /jellyfin[-_]*.tar.gz ${ARTIFACT_DIR}/ +chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} diff --git a/deployment/linux-x64/package.sh b/deployment/linux-x64/package.sh index 13b943ea8f..dfe8a9aa4a 100755 --- a/deployment/linux-x64/package.sh +++ b/deployment/linux-x64/package.sh @@ -1,7 +1,34 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -package_portable ../.. `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-linux-build" + +# Determine if sudo should be used for Docker +if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo="sudo" +else + docker_sudo="" +fi + +# Prepare temporary package dir +mkdir -p "${package_temporary_dir}" +# Set up the build environment Docker image +${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile +# Build the DEBs and copy out to ${package_temporary_dir} +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} +# Move the DEBs to the output directory +mkdir -p "${output_dir}" +mv "${package_temporary_dir}"/* "${output_dir}" diff --git a/deployment/macos/Dockerfile b/deployment/macos/Dockerfile new file mode 100644 index 0000000000..406a2d853e --- /dev/null +++ b/deployment/macos/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:10 +# Docker build arguments +ARG SOURCE_DIR=/jellyfin +ARG PLATFORM_DIR=/jellyfin/deployment/macos +ARG ARTIFACT_DIR=/dist +ARG SDK_VERSION=2.2 +# Docker run environment +ENV SOURCE_DIR=/jellyfin +ENV ARTIFACT_DIR=/dist +ENV DEB_BUILD_OPTIONS=noddebs +ENV ARCH=amd64 + +# Prepare Debian build environment +RUN apt-get update \ + && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0 + +# Install dotnet repository +# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current +RUN wget https://download.visualstudio.microsoft.com/download/pr/228832ea-805f-45ab-8c88-fa36165701b9/16ce29a06031eeb09058dee94d6f5330/dotnet-sdk-2.2.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ + && mkdir -p dotnet-sdk \ + && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ + && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet + +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + +# Link to docker-build script +RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh + +VOLUME ${ARTIFACT_DIR}/ + +COPY . ${SOURCE_DIR}/ + +ENTRYPOINT ["/docker-build.sh"] diff --git a/deployment/macos/build.sh b/deployment/macos/build.sh deleted file mode 100755 index d6bfb9f5e3..0000000000 --- a/deployment/macos/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -source ../common.build.sh - -VERSION=`get_version ../..` - -build_jellyfin ../../Jellyfin.Server Release osx-x64 `pwd`/dist/jellyfin_${VERSION} diff --git a/deployment/macos/clean.sh b/deployment/macos/clean.sh index 3df2d7796e..c07501a7bb 100755 --- a/deployment/macos/clean.sh +++ b/deployment/macos/clean.sh @@ -1,7 +1,27 @@ #!/usr/bin/env bash -source ../common.build.sh +keep_artifacts="${1}" -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-linux-build" + +rm -rf "${package_temporary_dir}" &>/dev/null \ + || sudo rm -rf "${package_temporary_dir}" &>/dev/null + +rm -rf "${output_dir}" &>/dev/null \ + || sudo rm -rf "${output_dir}" &>/dev/null + +if [[ ${keep_artifacts} == 'n' ]]; then + docker_sudo="" + if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo=sudo + fi + ${docker_sudo} docker image rm ${image_name} --force +fi diff --git a/deployment/macos/dependencies.txt b/deployment/macos/dependencies.txt index 3d25d1bdf4..bdb9670965 100644 --- a/deployment/macos/dependencies.txt +++ b/deployment/macos/dependencies.txt @@ -1 +1 @@ -dotnet +docker diff --git a/deployment/macos/docker-build.sh b/deployment/macos/docker-build.sh new file mode 100755 index 0000000000..1b4a554e6d --- /dev/null +++ b/deployment/macos/docker-build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Builds the TAR archive inside the Docker container + +set -o errexit +set -o xtrace + +# Move to source directory +pushd ${SOURCE_DIR} + +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + +# Get version +version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" + +# Build archives +dotnet publish --configuration Release --self-contained --runtime osx-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true" +tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version} +rm -rf /dist/jellyfin_${version} + +# Move the artifacts out +mkdir -p ${ARTIFACT_DIR}/ +mv /jellyfin[-_]*.tar.gz ${ARTIFACT_DIR}/ +chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} diff --git a/deployment/macos/package.sh b/deployment/macos/package.sh index 13b943ea8f..464c0d382f 100755 --- a/deployment/macos/package.sh +++ b/deployment/macos/package.sh @@ -1,7 +1,34 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -package_portable ../.. `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-macos-build" + +# Determine if sudo should be used for Docker +if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo="sudo" +else + docker_sudo="" +fi + +# Prepare temporary package dir +mkdir -p "${package_temporary_dir}" +# Set up the build environment Docker image +${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile +# Build the DEBs and copy out to ${package_temporary_dir} +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} +# Move the DEBs to the output directory +mkdir -p "${output_dir}" +mv "${package_temporary_dir}"/* "${output_dir}" diff --git a/deployment/portable/Dockerfile b/deployment/portable/Dockerfile new file mode 100644 index 0000000000..bdbf978fe7 --- /dev/null +++ b/deployment/portable/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:10 +# Docker build arguments +ARG SOURCE_DIR=/jellyfin +ARG PLATFORM_DIR=/jellyfin/deployment/portable +ARG ARTIFACT_DIR=/dist +ARG SDK_VERSION=2.2 +# Docker run environment +ENV SOURCE_DIR=/jellyfin +ENV ARTIFACT_DIR=/dist +ENV DEB_BUILD_OPTIONS=noddebs +ENV ARCH=amd64 + +# Prepare Debian build environment +RUN apt-get update \ + && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0 + +# Install dotnet repository +# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current +RUN wget https://download.visualstudio.microsoft.com/download/pr/228832ea-805f-45ab-8c88-fa36165701b9/16ce29a06031eeb09058dee94d6f5330/dotnet-sdk-2.2.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ + && mkdir -p dotnet-sdk \ + && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ + && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet + +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + +# Link to docker-build script +RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh + +VOLUME ${ARTIFACT_DIR}/ + +COPY . ${SOURCE_DIR}/ + +ENTRYPOINT ["/docker-build.sh"] diff --git a/deployment/portable/build.sh b/deployment/portable/build.sh deleted file mode 100755 index 4f2e6363ee..0000000000 --- a/deployment/portable/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -source ../common.build.sh - -VERSION=`get_version ../..` - -#Magic word framework will create a non self contained build -build_jellyfin ../../Jellyfin.Server Release framework `pwd`/dist/jellyfin_${VERSION} diff --git a/deployment/portable/clean.sh b/deployment/portable/clean.sh index 3df2d7796e..c07501a7bb 100755 --- a/deployment/portable/clean.sh +++ b/deployment/portable/clean.sh @@ -1,7 +1,27 @@ #!/usr/bin/env bash -source ../common.build.sh +keep_artifacts="${1}" -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-linux-build" + +rm -rf "${package_temporary_dir}" &>/dev/null \ + || sudo rm -rf "${package_temporary_dir}" &>/dev/null + +rm -rf "${output_dir}" &>/dev/null \ + || sudo rm -rf "${output_dir}" &>/dev/null + +if [[ ${keep_artifacts} == 'n' ]]; then + docker_sudo="" + if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo=sudo + fi + ${docker_sudo} docker image rm ${image_name} --force +fi diff --git a/deployment/docker/dependencies.txt b/deployment/portable/dependencies.txt similarity index 100% rename from deployment/docker/dependencies.txt rename to deployment/portable/dependencies.txt diff --git a/deployment/portable/docker-build.sh b/deployment/portable/docker-build.sh new file mode 100755 index 0000000000..3645522d12 --- /dev/null +++ b/deployment/portable/docker-build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Builds the TAR archive inside the Docker container + +set -o errexit +set -o xtrace + +# Move to source directory +pushd ${SOURCE_DIR} + +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + +# Get version +version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" + +# Build archives +dotnet publish --configuration Release --self-contained --runtime framework --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none" +tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version} +rm -rf /dist/jellyfin_${version} + +# Move the artifacts out +mkdir -p ${ARTIFACT_DIR}/ +mv /jellyfin[-_]*.tar.gz ${ARTIFACT_DIR}/ +chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} diff --git a/deployment/portable/package.sh b/deployment/portable/package.sh index 13b943ea8f..0ceb54dda1 100755 --- a/deployment/portable/package.sh +++ b/deployment/portable/package.sh @@ -1,7 +1,34 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -package_portable ../.. `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-portable-build" + +# Determine if sudo should be used for Docker +if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo="sudo" +else + docker_sudo="" +fi + +# Prepare temporary package dir +mkdir -p "${package_temporary_dir}" +# Set up the build environment Docker image +${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile +# Build the DEBs and copy out to ${package_temporary_dir} +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} +# Move the DEBs to the output directory +mkdir -p "${output_dir}" +mv "${package_temporary_dir}"/* "${output_dir}" diff --git a/deployment/ubuntu-package-arm64/Dockerfile.amd64 b/deployment/ubuntu-package-arm64/Dockerfile.amd64 index 95525ec4e0..838e70d505 100644 --- a/deployment/ubuntu-package-arm64/Dockerfile.amd64 +++ b/deployment/ubuntu-package-arm64/Dockerfile.amd64 @@ -40,6 +40,12 @@ RUN rm /etc/apt/sources.list \ && ln -fs /usr/share/zoneinfo/America/Toronto /etc/localtime \ && apt-get install -y gcc-6-source libstdc++6-arm64-cross binutils-aarch64-linux-gnu bison flex libtool gdb sharutils netbase libcloog-isl-dev libmpc-dev libmpfr-dev libgmp-dev systemtap-sdt-dev autogen expect chrpath zlib1g-dev zip libc6-dev:arm64 linux-libc-dev:arm64 libgcc1:arm64 libcurl4-openssl-dev:arm64 libfontconfig1-dev:arm64 libfreetype6-dev:arm64 liblttng-ust0:arm64 libstdc++6:arm64 libssl-dev:arm64 +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + # Link to docker-build script RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh diff --git a/deployment/ubuntu-package-arm64/clean.sh b/deployment/ubuntu-package-arm64/clean.sh index c92c7fdec6..82d427f9e5 100755 --- a/deployment/ubuntu-package-arm64/clean.sh +++ b/deployment/ubuntu-package-arm64/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/ubuntu-package-arm64/docker-build.sh b/deployment/ubuntu-package-arm64/docker-build.sh index 1c75ece8eb..7a13bafcbb 100755 --- a/deployment/ubuntu-package-arm64/docker-build.sh +++ b/deployment/ubuntu-package-arm64/docker-build.sh @@ -11,6 +11,20 @@ pushd ${SOURCE_DIR} # Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image sed -i '/dotnet-sdk-2.2,/d' debian/control +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + # Build DEB export CONFIG_SITE=/etc/dpkg-cross/cross-config.${ARCH} dpkg-buildpackage -us -uc -aarm64 diff --git a/deployment/ubuntu-package-arm64/package.sh b/deployment/ubuntu-package-arm64/package.sh index 5a2bf61c86..d1140a7274 100755 --- a/deployment/ubuntu-package-arm64/package.sh +++ b/deployment/ubuntu-package-arm64/package.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done ARCH="$( arch )" WORKDIR="$( pwd )" @@ -35,7 +39,7 @@ mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./${DOCKERFILE} # Build the DEBs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the DEBs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/deb/* "${output_dir}" diff --git a/deployment/ubuntu-package-armhf/Dockerfile.amd64 b/deployment/ubuntu-package-armhf/Dockerfile.amd64 index f3c7f51632..d1123e0b61 100644 --- a/deployment/ubuntu-package-armhf/Dockerfile.amd64 +++ b/deployment/ubuntu-package-armhf/Dockerfile.amd64 @@ -40,6 +40,12 @@ RUN rm /etc/apt/sources.list \ && ln -fs /usr/share/zoneinfo/America/Toronto /etc/localtime \ && apt-get install -y gcc-6-source libstdc++6-armhf-cross binutils-arm-linux-gnueabihf bison flex libtool gdb sharutils netbase libcloog-isl-dev libmpc-dev libmpfr-dev libgmp-dev systemtap-sdt-dev autogen expect chrpath zlib1g-dev zip libc6-dev:armhf linux-libc-dev:armhf libgcc1:armhf libcurl4-openssl-dev:armhf libfontconfig1-dev:armhf libfreetype6-dev:armhf liblttng-ust0:armhf libstdc++6:armhf libssl-dev:armhf +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + # Link to docker-build script RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh diff --git a/deployment/ubuntu-package-armhf/Dockerfile.armhf b/deployment/ubuntu-package-armhf/Dockerfile.armhf index d67135cfec..c9e093e51e 100644 --- a/deployment/ubuntu-package-armhf/Dockerfile.armhf +++ b/deployment/ubuntu-package-armhf/Dockerfile.armhf @@ -21,6 +21,12 @@ RUN wget https://download.visualstudio.microsoft.com/download/pr/d9f37b73-df8d-4 && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + # Link to docker-build script RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh diff --git a/deployment/ubuntu-package-armhf/clean.sh b/deployment/ubuntu-package-armhf/clean.sh index c92c7fdec6..82d427f9e5 100755 --- a/deployment/ubuntu-package-armhf/clean.sh +++ b/deployment/ubuntu-package-armhf/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/ubuntu-package-armhf/docker-build.sh b/deployment/ubuntu-package-armhf/docker-build.sh index df35345bdd..c48ccb3fb8 100755 --- a/deployment/ubuntu-package-armhf/docker-build.sh +++ b/deployment/ubuntu-package-armhf/docker-build.sh @@ -11,6 +11,20 @@ pushd ${SOURCE_DIR} # Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image sed -i '/dotnet-sdk-2.2,/d' debian/control +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + # Build DEB export CONFIG_SITE=/etc/dpkg-cross/cross-config.${ARCH} dpkg-buildpackage -us -uc -aarmhf diff --git a/deployment/ubuntu-package-armhf/package.sh b/deployment/ubuntu-package-armhf/package.sh index 15f55bff20..2ceb3e8165 100755 --- a/deployment/ubuntu-package-armhf/package.sh +++ b/deployment/ubuntu-package-armhf/package.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done ARCH="$( arch )" WORKDIR="$( pwd )" @@ -35,7 +39,7 @@ mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./${DOCKERFILE} # Build the DEBs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the DEBs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/deb/* "${output_dir}" diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile index 03c253e498..1749d2ad04 100644 --- a/deployment/ubuntu-package-x64/Dockerfile +++ b/deployment/ubuntu-package-x64/Dockerfile @@ -14,6 +14,12 @@ RUN apt-get update \ && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \ && mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + VOLUME ${ARTIFACT_DIR}/ COPY . ${SOURCE_DIR}/ diff --git a/deployment/ubuntu-package-x64/clean.sh b/deployment/ubuntu-package-x64/clean.sh index c92c7fdec6..82d427f9e5 100755 --- a/deployment/ubuntu-package-x64/clean.sh +++ b/deployment/ubuntu-package-x64/clean.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -source ../common.build.sh - keep_artifacts="${1}" WORKDIR="$( pwd )" diff --git a/deployment/ubuntu-package-x64/docker-build.sh b/deployment/ubuntu-package-x64/docker-build.sh index 9781879f6f..97bc45a060 100755 --- a/deployment/ubuntu-package-x64/docker-build.sh +++ b/deployment/ubuntu-package-x64/docker-build.sh @@ -11,6 +11,20 @@ pushd ${SOURCE_DIR} # Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image sed -i '/dotnet-sdk-2.2,/d' debian/control +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + # Build DEB dpkg-buildpackage -us -uc diff --git a/deployment/ubuntu-package-x64/package.sh b/deployment/ubuntu-package-x64/package.sh index 32e6d4fd65..08c003778b 100755 --- a/deployment/ubuntu-package-x64/package.sh +++ b/deployment/ubuntu-package-x64/package.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done WORKDIR="$( pwd )" @@ -24,7 +28,7 @@ mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile # Build the DEBs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the DEBs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/deb/* "${output_dir}" diff --git a/deployment/win-x64/Dockerfile b/deployment/win-x64/Dockerfile new file mode 100644 index 0000000000..7f64c7daed --- /dev/null +++ b/deployment/win-x64/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:10 +# Docker build arguments +ARG SOURCE_DIR=/jellyfin +ARG PLATFORM_DIR=/jellyfin/deployment/win-x64 +ARG ARTIFACT_DIR=/dist +ARG SDK_VERSION=2.2 +# Docker run environment +ENV SOURCE_DIR=/jellyfin +ENV ARTIFACT_DIR=/dist +ENV DEB_BUILD_OPTIONS=noddebs +ENV ARCH=amd64 + +# Prepare Debian build environment +RUN apt-get update \ + && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0 zip + +# Install dotnet repository +# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current +RUN wget https://download.visualstudio.microsoft.com/download/pr/228832ea-805f-45ab-8c88-fa36165701b9/16ce29a06031eeb09058dee94d6f5330/dotnet-sdk-2.2.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ + && mkdir -p dotnet-sdk \ + && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ + && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet + +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + +# Link to docker-build script +RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh + +VOLUME ${ARTIFACT_DIR}/ + +COPY . ${SOURCE_DIR}/ + +ENTRYPOINT ["/docker-build.sh"] diff --git a/deployment/win-x64/build.sh b/deployment/win-x64/build.sh deleted file mode 100755 index 0b30462038..0000000000 --- a/deployment/win-x64/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -source ../common.build.sh - -VERSION=`get_version ../..` - -build_jellyfin ../../Jellyfin.Server Release win-x64 `pwd`/dist/jellyfin_${VERSION} diff --git a/deployment/win-x64/clean.sh b/deployment/win-x64/clean.sh index 3df2d7796e..6c183f3371 100755 --- a/deployment/win-x64/clean.sh +++ b/deployment/win-x64/clean.sh @@ -1,7 +1,27 @@ #!/usr/bin/env bash -source ../common.build.sh +keep_artifacts="${1}" -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-windows-x64-build" + +rm -rf "${package_temporary_dir}" &>/dev/null \ + || sudo rm -rf "${package_temporary_dir}" &>/dev/null + +rm -rf "${output_dir}" &>/dev/null \ + || sudo rm -rf "${output_dir}" &>/dev/null + +if [[ ${keep_artifacts} == 'n' ]]; then + docker_sudo="" + if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo=sudo + fi + ${docker_sudo} docker image rm ${image_name} --force +fi diff --git a/deployment/win-x64/dependencies.txt b/deployment/win-x64/dependencies.txt index 3d25d1bdf4..bdb9670965 100644 --- a/deployment/win-x64/dependencies.txt +++ b/deployment/win-x64/dependencies.txt @@ -1 +1 @@ -dotnet +docker diff --git a/deployment/win-x64/docker-build.sh b/deployment/win-x64/docker-build.sh new file mode 100755 index 0000000000..36d6f77fc5 --- /dev/null +++ b/deployment/win-x64/docker-build.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Builds the ZIP archive inside the Docker container + +set -o errexit +set -o xtrace + +# Version variables +NSSM_VERSION="nssm-2.24-101-g897c7ad" +NSSM_URL="https://nssm.cc/ci/${NSSM_VERSION}.zip" +FFMPEG_VERSION="ffmpeg-4.0.2-win64-static" +FFMPEG_URL="https://ffmpeg.zeranoe.com/builds/win64/static/${FFMPEG_VERSION}.zip" + +# Move to source directory +pushd ${SOURCE_DIR} + +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + +# Get version +version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" + +# Build binary +dotnet publish --configuration Release --self-contained --runtime win-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true" + +# Prepare addins +addin_build_dir="$( mktemp -d )" +wget ${NSSM_URL} -O ${addin_build_dir}/nssm.zip +wget ${FFMPEG_URL} -O ${addin_build_dir}/ffmpeg.zip +unzip ${addin_build_dir}/nssm.zip -d ${addin_build_dir} +cp ${addin_build_dir}/${NSSM_VERSION}/win64/nssm.exe /dist/jellyfin_${version}/nssm.exe +unzip ${addin_build_dir}/ffmpeg.zip -d ${addin_build_dir} +cp ${addin_build_dir}/${FFMPEG_VERSION}/bin/ffmpeg.exe /dist/jellyfin_${version}/ffmpeg.exe +cp ${addin_build_dir}/${FFMPEG_VERSION}/bin/ffprobe.exe /dist/jellyfin_${version}/ffprobe.exe +rm -rf ${addin_build_dir} + +# Prepare scripts +cp ${SOURCE_DIR}/deployment/windows/legacy/install-jellyfin.ps1 /dist/jellyfin_${version}/install-jellyfin.ps1 +cp ${SOURCE_DIR}/deployment/windows/legacy/install.bat /dist/jellyfin_${version}/install.bat + +# Create zip package +pushd /dist +zip /jellyfin_${version}.portable.zip jellyfin_${version} +popd +rm -rf /dist/jellyfin_${version} + +# Move the artifacts out +mkdir -p ${ARTIFACT_DIR}/ +mv /jellyfin[-_]*.zip ${ARTIFACT_DIR}/ +chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} diff --git a/deployment/win-x64/package.sh b/deployment/win-x64/package.sh index b438c28e4b..a8ab190fa5 100755 --- a/deployment/win-x64/package.sh +++ b/deployment/win-x64/package.sh @@ -1,47 +1,34 @@ #!/usr/bin/env bash -set -x -package_win64() ( - local NSSM_VERSION="nssm-2.24-101-g897c7ad" - local NSSM_URL="https://nssm.cc/ci/${NSSM_VERSION}.zip" - local FFMPEG_VERSION="ffmpeg-4.0.2-win64-static" - local FFMPEG_URL="https://ffmpeg.zeranoe.com/builds/win64/static/${FFMPEG_VERSION}.zip" - local ROOT=${1-$DEFAULT_ROOT} - local OUTPUT_DIR=${2-$DEFAULT_OUTPUT_DIR} - local PKG_DIR=${3-$DEFAULT_PKG_DIR} - local ARCHIVE_CMD="zip -r" - # Package portable build result - if [ -d ${OUTPUT_DIR} ]; then - echo -e "${CYAN}Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}'.${NC}" - local TEMP_DIR="$(mktemp -d)" - wget ${NSSM_URL} -O ${TEMP_DIR}/nssm.zip - wget ${FFMPEG_URL} -O ${TEMP_DIR}/ffmpeg.zip - unzip ${TEMP_DIR}/nssm.zip -d $TEMP_DIR - cp ${TEMP_DIR}/${NSSM_VERSION}/win64/nssm.exe ${OUTPUT_DIR}/nssm.exe - unzip ${TEMP_DIR}/ffmpeg.zip -d $TEMP_DIR - cp ${TEMP_DIR}/${FFMPEG_VERSION}/bin/ffmpeg.exe ${OUTPUT_DIR}/ffmpeg.exe - cp ${TEMP_DIR}/${FFMPEG_VERSION}/bin/ffprobe.exe ${OUTPUT_DIR}/ffprobe.exe - rm -r ${TEMP_DIR} - cp ${ROOT}/deployment/windows/install-jellyfin.ps1 ${OUTPUT_DIR}/install-jellyfin.ps1 - cp ${ROOT}/deployment/windows/install.bat ${OUTPUT_DIR}/install.bat - mkdir -p ${PKG_DIR} - pushd ${OUTPUT_DIR} - ${ARCHIVE_CMD} ${ROOT}/${PKG_DIR}/`basename "${OUTPUT_DIR}"`.zip . - popd - local EXIT_CODE=$? - if [ $EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}[DONE] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' complete.${NC}" - else - echo -e "${RED}[FAIL] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' FAILED.${NC}" - fi - else - echo -e "${RED}[FAIL] Build artifacts do not exist for ${OUTPUT_DIR}. Run build.sh first.${NC}" - fi -) -source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -package_win64 ../.. `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-windows-x64-build" -#TODO setup and maybe change above code to produce the Windows native zip format. +# Determine if sudo should be used for Docker +if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo="sudo" +else + docker_sudo="" +fi + +# Prepare temporary package dir +mkdir -p "${package_temporary_dir}" +# Set up the build environment Docker image +${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile +# Build the DEBs and copy out to ${package_temporary_dir} +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} +# Move the DEBs to the output directory +mkdir -p "${output_dir}" +mv "${package_temporary_dir}"/* "${output_dir}" diff --git a/deployment/win-x86/Dockerfile b/deployment/win-x86/Dockerfile new file mode 100644 index 0000000000..fb5f5d6b61 --- /dev/null +++ b/deployment/win-x86/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:10 +# Docker build arguments +ARG SOURCE_DIR=/jellyfin +ARG PLATFORM_DIR=/jellyfin/deployment/win-x86 +ARG ARTIFACT_DIR=/dist +ARG SDK_VERSION=2.2 +# Docker run environment +ENV SOURCE_DIR=/jellyfin +ENV ARTIFACT_DIR=/dist +ENV DEB_BUILD_OPTIONS=noddebs +ENV ARCH=amd64 + +# Prepare Debian build environment +RUN apt-get update \ + && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libssl-dev libssl1.1 liblttng-ust0 zip + +# Install dotnet repository +# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current +RUN wget https://download.visualstudio.microsoft.com/download/pr/228832ea-805f-45ab-8c88-fa36165701b9/16ce29a06031eeb09058dee94d6f5330/dotnet-sdk-2.2.401-linux-x64.tar.gz -O dotnet-sdk.tar.gz \ + && mkdir -p dotnet-sdk \ + && tar -xzf dotnet-sdk.tar.gz -C dotnet-sdk \ + && ln -s $( pwd )/dotnet-sdk/dotnet /usr/bin/dotnet + +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + +# Link to docker-build script +RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh + +VOLUME ${ARTIFACT_DIR}/ + +COPY . ${SOURCE_DIR}/ + +ENTRYPOINT ["/docker-build.sh"] diff --git a/deployment/win-x86/build.sh b/deployment/win-x86/build.sh deleted file mode 100755 index 610db356a5..0000000000 --- a/deployment/win-x86/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -source ../common.build.sh - -VERSION=`get_version ../..` - -build_jellyfin ../../Jellyfin.Server Release win-x86 `pwd`/dist/jellyfin_${VERSION} diff --git a/deployment/win-x86/clean.sh b/deployment/win-x86/clean.sh index 3df2d7796e..8b78c5e4b6 100755 --- a/deployment/win-x86/clean.sh +++ b/deployment/win-x86/clean.sh @@ -1,7 +1,27 @@ #!/usr/bin/env bash -source ../common.build.sh +keep_artifacts="${1}" -VERSION=`get_version ../..` +WORKDIR="$( pwd )" -clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION} +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-windows-x86-build" + +rm -rf "${package_temporary_dir}" &>/dev/null \ + || sudo rm -rf "${package_temporary_dir}" &>/dev/null + +rm -rf "${output_dir}" &>/dev/null \ + || sudo rm -rf "${output_dir}" &>/dev/null + +if [[ ${keep_artifacts} == 'n' ]]; then + docker_sudo="" + if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo=sudo + fi + ${docker_sudo} docker image rm ${image_name} --force +fi diff --git a/deployment/win-x86/dependencies.txt b/deployment/win-x86/dependencies.txt index 3d25d1bdf4..bdb9670965 100644 --- a/deployment/win-x86/dependencies.txt +++ b/deployment/win-x86/dependencies.txt @@ -1 +1 @@ -dotnet +docker diff --git a/deployment/win-x86/docker-build.sh b/deployment/win-x86/docker-build.sh new file mode 100755 index 0000000000..86ede74524 --- /dev/null +++ b/deployment/win-x86/docker-build.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# Builds the ZIP archive inside the Docker container + +set -o errexit +set -o xtrace + +# Version variables +NSSM_VERSION="nssm-2.24-101-g897c7ad" +NSSM_URL="https://nssm.cc/ci/${NSSM_VERSION}.zip" +FFMPEG_VERSION="ffmpeg-4.0.2-win32-static" +FFMPEG_URL="https://ffmpeg.zeranoe.com/builds/win32/static/${FFMPEG_VERSION}.zip" + +# Move to source directory +pushd ${SOURCE_DIR} + +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd +rm -rf ${web_build_dir} + +# Get version +version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" + +# Build binary +dotnet publish --configuration Release --self-contained --runtime win-x86 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true" + +# Prepare addins +addin_build_dir="$( mktemp -d )" +wget ${NSSM_URL} -O ${addin_build_dir}/nssm.zip +wget ${FFMPEG_URL} -O ${addin_build_dir}/ffmpeg.zip +unzip ${addin_build_dir}/nssm.zip -d ${addin_build_dir} +cp ${addin_build_dir}/${NSSM_VERSION}/win64/nssm.exe /dist/jellyfin_${version}/nssm.exe +unzip ${addin_build_dir}/ffmpeg.zip -d ${addin_build_dir} +cp ${addin_build_dir}/${FFMPEG_VERSION}/bin/ffmpeg.exe /dist/jellyfin_${version}/ffmpeg.exe +cp ${addin_build_dir}/${FFMPEG_VERSION}/bin/ffprobe.exe /dist/jellyfin_${version}/ffprobe.exe +rm -rf ${addin_build_dir} + +# Prepare scripts +cp ${SOURCE_DIR}/deployment/windows/legacy/install-jellyfin.ps1 /dist/jellyfin_${version}/install-jellyfin.ps1 +cp ${SOURCE_DIR}/deployment/windows/legacy/install.bat /dist/jellyfin_${version}/install.bat + +# Create zip package +pushd /dist +zip /jellyfin_${version}.portable.zip jellyfin_${version} +popd +rm -rf /dist/jellyfin_${version} + +# Move the artifacts out +mkdir -p ${ARTIFACT_DIR}/ +mv /jellyfin[-_]*.zip ${ARTIFACT_DIR}/ +chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} diff --git a/deployment/win-x86/package.sh b/deployment/win-x86/package.sh index 8752d92a89..65e7e2928c 100755 --- a/deployment/win-x86/package.sh +++ b/deployment/win-x86/package.sh @@ -1,45 +1,34 @@ #!/usr/bin/env bash -package_win32() ( - local NSSM_VERSION="nssm-2.24-101-g897c7ad" - local NSSM_URL="https://nssm.cc/ci/${NSSM_VERSION}.zip" - local FFMPEG_VERSION="ffmpeg-4.0.2-win32-static" - local FFMPEG_URL="https://ffmpeg.zeranoe.com/builds/win32/static/${FFMPEG_VERSION}.zip" - local ROOT=${1-$DEFAULT_ROOT} - local OUTPUT_DIR=${2-$DEFAULT_OUTPUT_DIR} - local PKG_DIR=${3-$DEFAULT_PKG_DIR} - local ARCHIVE_CMD="zip -r" - # Package portable build result - if [ -d ${OUTPUT_DIR} ]; then - echo -e "${CYAN}Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}'.${NC}" - local TEMP_DIR="$(mktemp -d)" - wget ${NSSM_URL} -O ${TEMP_DIR}/nssm.zip - wget ${FFMPEG_URL} -O ${TEMP_DIR}/ffmpeg.zip - unzip ${TEMP_DIR}/nssm.zip -d $TEMP_DIR - cp ${TEMP_DIR}/${NSSM_VERSION}/win32/nssm.exe ${OUTPUT_DIR}/nssm.exe - unzip ${TEMP_DIR}/ffmpeg.zip -d $TEMP_DIR - cp ${TEMP_DIR}/${FFMPEG_VERSION}/bin/ffmpeg.exe ${OUTPUT_DIR}/ffmpeg.exe - cp ${TEMP_DIR}/${FFMPEG_VERSION}/bin/ffprobe.exe ${OUTPUT_DIR}/ffprobe.exe - rm -r ${TEMP_DIR} - cp ${ROOT}/deployment/windows/install-jellyfin.ps1 ${OUTPUT_DIR}/install-jellyfin.ps1 - cp ${ROOT}/deployment/windows/install.bat ${OUTPUT_DIR}/install.bat - mkdir -p ${PKG_DIR} - pushd ${OUTPUT_DIR} - ${ARCHIVE_CMD} ${ROOT}/${PKG_DIR}/`basename "${OUTPUT_DIR}"`.zip . - popd - local EXIT_CODE=$? - if [ $EXIT_CODE -eq 0 ]; then - echo -e "${GREEN}[DONE] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' complete.${NC}" - else - echo -e "${RED}[FAIL] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' FAILED.${NC}" - fi - else - echo -e "${RED}[FAIL] Build artifacts do not exist for ${OUTPUT_DIR}. Run build.sh first.${NC}" - fi -) -source ../common.build.sh -VERSION=`get_version ../..` +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done -package_win32 ../.. `pwd`/dist/jellyfin_${VERSION} +WORKDIR="$( pwd )" -#TODO setup and maybe change above code to produce the Windows native zip format. +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-windows-x86-build" + +# Determine if sudo should be used for Docker +if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo="sudo" +else + docker_sudo="" +fi + +# Prepare temporary package dir +mkdir -p "${package_temporary_dir}" +# Set up the build environment Docker image +${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile +# Build the DEBs and copy out to ${package_temporary_dir} +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} +# Move the DEBs to the output directory +mkdir -p "${output_dir}" +mv "${package_temporary_dir}"/* "${output_dir}"