From 53a380afca6113139dac8145f201bbe0b1d5f010 Mon Sep 17 00:00:00 2001 From: Vincent Fortier Date: Tue, 27 Aug 2024 11:00:42 -0400 Subject: [PATCH] Update default spksrc image to Debian12 (#6183) * docker-image: Update to debian 12 and migrate pip to deb packages * spksrc: Update master readme file * docker-image: Add python3-mako, nasm and yasm to default image * spksrc: Update master readme file (mako, nasm, yasm) * docker-image: Re-organise RUN to limit max characters * ffmpeg456: Add -latomic only for qoriq (@hgy59) Ref: https://github.com/SynoCommunity/spksrc/pull/6183#issuecomment-2254633684 * docker-image: Add python3-yaml as mandatory for IGC build * docker-image: Fixed debian12, hg install and updatedb * Update Dockerfile - remove duplicate apt update Co-authored-by: hgy59 * docker-image: apt-get is so Y2K, use apt instead * readme: Add missing python3-yaml * docker-image: Install gf from default debian repository * cross-cmake.mk: Use host nasm if available --------- Co-authored-by: hgy59 --- Dockerfile | 59 ++++++++++++++++----------- README.md | 78 +++++++++++++----------------------- cross/ffmpeg4/Makefile | 2 +- cross/ffmpeg5/Makefile | 2 +- cross/ffmpeg6/Makefile | 2 +- mk/spksrc.cross-cmake-env.mk | 18 ++++++--- 6 files changed, 78 insertions(+), 83 deletions(-) diff --git a/Dockerfile b/Dockerfile index db92d7f9a91..27c0b498c37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye +FROM debian:bookworm LABEL description="Framework for maintaining and compiling native community packages for Synology devices" LABEL maintainer="SynoCommunity " LABEL url="https://synocommunity.com" @@ -11,12 +11,13 @@ RUN dpkg --add-architecture i386 # Install required packages (in sync with README.rst instructions) # ATTENTION: the total length of the following RUN command must not exceed 1024 characters -RUN apt-get update && apt-get install --no-install-recommends -y \ +RUN apt update && apt install --no-install-recommends -y \ autoconf-archive \ autogen \ automake \ autopoint \ bash \ + bash-completion \ bc \ bison \ build-essential \ @@ -29,6 +30,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ expect \ fakeroot \ flex \ + gh \ g++-multilib \ gawk \ gettext \ @@ -51,16 +53,16 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ libtool \ libunistring-dev \ lzip \ - mercurial \ + man-db \ + manpages-dev \ + mlocate \ moreutils \ - ninja-build \ + nasm \ patchelf \ php \ pkg-config \ - python2 \ - python3 \ - python3-distutils \ rename \ + ripgrep \ rsync \ ruby-mustache \ scons \ @@ -68,27 +70,38 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ sudo \ swig \ texinfo \ + time \ + tree \ unzip \ xmlto \ + yasm \ zip \ - zlib1g-dev && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ - adduser --disabled-password --gecos '' user && \ - adduser user sudo && \ - echo "%user ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/users + zlib1g-dev + +# Python based apps +RUN apt install --no-install-recommends -y \ + httpie \ + mercurial \ + meson \ + ninja-build \ + python3 \ + python3-distutils \ + python3-mako \ + python3-pip \ + python3-virtualenv \ + python3-yaml -# Install setuptools, wheel and pip for Python2 -RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O - | python2 -# Install virtualenv and httpie for Python2 -# Use pip2 as default pip -> python3 -RUN pip2 install virtualenv httpie +# Clean-up apt db +RUN apt clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Install setuptools, wheel and pip for Python3 -# Default pip -> python3 aware for native python wheels builds -RUN wget https://bootstrap.pypa.io/get-pip.py -O - | python3 -# Install meson cross-platform build system -RUN pip3 install meson==1.0.0 +# Update locate db +RUN updatedb + +# Add user +RUN adduser --disabled-password --gecos '' user && \ + adduser user sudo && \ + echo "%user ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/users # Volume pointing to spksrc sources VOLUME /spksrc diff --git a/README.md b/README.md index d184f005a22..8d8fe213dd1 100644 --- a/README.md +++ b/README.md @@ -47,23 +47,24 @@ docker run -it --platform=linux/amd64 -v $(pwd):/spksrc -w /spksrc -e TAR_CMD="f ### Virtual machine -A virtual machine based on an 64-bit version of Debian 11 stable OS is recommended. Non-x86 architectures are not supported. +A virtual machine based on an 64-bit version of Debian 12 stable OS is recommended. Non-x86 architectures are not supported. Install the requirements (in sync with `Dockerfile`): ```bash sudo dpkg --add-architecture i386 && sudo apt-get update sudo apt update -sudo apt install autoconf-archive autogen automake autopoint bash bc bison \ - build-essential check cmake curl cython3 debootstrap ed expect fakeroot flex \ - g++-multilib gawk gettext git gperf imagemagick intltool jq libbz2-dev libc6-i386 \ - libcppunit-dev libffi-dev libgc-dev libgmp3-dev libltdl-dev libmount-dev libncurses-dev \ - libpcre3-dev libssl-dev libtool libunistring-dev lzip mercurial moreutils ninja-build \ - patchelf php pkg-config python2 python3 python3-distutils rename ruby-mustache rsync scons subversion \ - swig texinfo unzip xmlto zip zlib1g-dev -wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O - | sudo python2 -sudo pip2 install wheel httpie -wget https://bootstrap.pypa.io/get-pip.py -O - | sudo python3 -sudo pip3 install meson==1.0.0 +sudo apt install autoconf-archive autogen automake autopoint bash \ + bash-completion bc bison build-essential check cmake \ + curl cython3 debootstrap ed expect fakeroot flex \ + g++-multilib gawk gettext gh git gperf httpie imagemagick \ + intltool jq libbz2-dev libc6-i386 libcppunit-dev libffi-dev \ + libgc-dev libgmp3-dev libltdl-dev libmount-dev libncurses-dev \ + libpcre3-dev libssl-dev libtool libunistring-dev lzip \ + man-db manpages-dev mercurial meson mlocate moreutils nasm \ + ninja-build patchelf php pkg-config python3 python3-distutils \ + python3-mako python3-pip python3-virtualenv python3-yaml \ + rename ripgrep ruby-mustache rsync scons subversion \ + swig texinfo time tree unzip xmlto yasm zip zlib1g-dev ``` From there, follow the instructions in the [Developers HOW TO]. @@ -73,35 +74,26 @@ From there, follow the instructions in the [Developers HOW TO]. ### LXC -A container based on 64-bit version of Debian 11 stable OS is recommended. Non-x86 architectures are not supported. The following assumes your LXD/LXC environment is already initiated (e.g. `lxc init`) and you have minimal LXD/LXC basic knowledge : -1. Create a new container (will use x86_64/amd64 arch by default): `lxc launch images:debian/11 spksrc` +A container based on 64-bit version of Debian 12 stable OS is recommended. Non-x86 architectures are not supported. The following assumes your LXD/LXC environment is already initiated (e.g. `lxc init`) and you have minimal LXD/LXC basic knowledge : +1. Create a new container (will use x86_64/amd64 arch by default): `lxc launch images:debian/12 spksrc` 2. Enable i386 arch: `lxc exec spksrc -- /usr/bin/dpkg --add-architecture i386` 3. Update apt channels: `lxc exec spksrc -- /usr/bin/apt update` 4. Install all required packages: ```bash -lxc exec spksrc -- /usr/bin/apt install autoconf-archive autogen automake autopoint bash bc bison \ - build-essential check cmake curl cython3 debootstrap ed expect fakeroot flex \ - g++-multilib gawk gettext git gperf imagemagick intltool jq libbz2-dev libc6-i386 \ - libcppunit-dev libffi-dev libgc-dev libgmp3-dev libltdl-dev libmount-dev libncurses-dev \ - libpcre3-dev libssl-dev libtool libunistring-dev lzip mercurial moreutils ninja-build \ - patchelf php pkg-config python2 python3 python3-distutils rename rsync ruby-mustache scons subversion \ - swig texinfo unzip xmlto zip zlib1g-dev -``` -5. Install `python2` wheels: -```bash -lxc exec spksrc -- /bin/bash -c "wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O - | python2" -lxc exec spksrc -- /bin/bash -c "pip2 install virtualenv httpie" -``` -6. Install `python3` `pip`: -```bash -lxc exec spksrc -- /bin/bash -c "wget https://bootstrap.pypa.io/get-pip.py -O - | python3" -``` -7. Install `meson`: -```bash -lxc exec spksrc -- /bin/bash -c "pip3 install meson==1.0.0" +lxc exec spksrc -- /usr/bin/apt install autoconf-archive autogen automake autopoint bash \ + bash-completion bc bison build-essential check cmake \ + curl cython3 debootstrap ed expect fakeroot flex \ + g++-multilib gawk gettext gh git gperf httpie imagemagick \ + intltool jq libbz2-dev libc6-i386 libcppunit-dev libffi-dev \ + libgc-dev libgmp3-dev libltdl-dev libmount-dev libncurses-dev \ + libpcre3-dev libssl-dev libtool libunistring-dev lzip \ + man-db manpages-dev mercurial meson mlocate moreutils nasm \ + ninja-build patchelf php pkg-config python3 python3-distutils \ + python3-mako python3-pip python3-virtualenv python3-yaml \ + rename ripgrep ruby-mustache rsync scons subversion \ + swig texinfo time tree unzip xmlto yasm zip zlib1g-dev ``` - #### LXC: `spksrc` user 8. By default it is assumed that you will be running as `spksrc` user into the LXC container. Such user needs to be created into the default container image: ```bash @@ -118,22 +110,6 @@ lxc exec spksrc -- su --login spksrc spksrc@spksrc:~$ ``` -#### (OPTIONAL) Install misc base tools: -```bash -lxc exec spksrc -- /usr/bin/apt install bash-completion man-db manpages-dev \ - mlocate ripgrep rsync tree time -lxc exec spksrc -- /usr/bin/updatedb -``` -Install github client: -``` -$ lxc exec spksrc -- su --login root -# curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg -# echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null -# sudo apt update -# sudo apt install gh -# exit -``` - #### (OPTIONAL) LXC: Shared `spksrc` user You can create a shared user between your Debian/Ubuntu host and the LXC Debian container which simplifies greatly file management between the two. The following assumes you already created a user `spksrc` with uid 1001 in your Debian/Ubuntu host environment and that you which to share its `/home` userspace. 1. Create a mapping rule between the hosts and the LXC image: diff --git a/cross/ffmpeg4/Makefile b/cross/ffmpeg4/Makefile index 4fb82d83e5f..2715995c68f 100644 --- a/cross/ffmpeg4/Makefile +++ b/cross/ffmpeg4/Makefile @@ -225,10 +225,10 @@ CONFIGURE_ARGS += --arch=arm64 --enable-neon --enable-thumb endif ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH)) -CONFIGURE_ARGS += --extra-libs=-latomic CONFIGURE_ARGS += --arch=ppc ifeq ($(findstring $(ARCH),qoriq),$(ARCH)) CONFIGURE_ARGS += --cpu=e500v2 +CONFIGURE_ARGS += --extra-libs=-latomic else CONFIGURE_ARGS += --cpu=e500 --disable-altivec endif diff --git a/cross/ffmpeg5/Makefile b/cross/ffmpeg5/Makefile index f4046041b6e..f05b5a48ead 100644 --- a/cross/ffmpeg5/Makefile +++ b/cross/ffmpeg5/Makefile @@ -224,10 +224,10 @@ CONFIGURE_ARGS += --arch=arm64 --enable-neon --enable-thumb endif ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH)) -CONFIGURE_ARGS += --extra-libs=-latomic CONFIGURE_ARGS += --arch=ppc ifeq ($(findstring $(ARCH),qoriq),$(ARCH)) CONFIGURE_ARGS += --cpu=e500v2 +CONFIGURE_ARGS += --extra-libs=-latomic else CONFIGURE_ARGS += --cpu=e500 --disable-altivec endif diff --git a/cross/ffmpeg6/Makefile b/cross/ffmpeg6/Makefile index e052e395672..99818edf098 100644 --- a/cross/ffmpeg6/Makefile +++ b/cross/ffmpeg6/Makefile @@ -224,10 +224,10 @@ CONFIGURE_ARGS += --arch=arm64 --enable-neon --enable-thumb endif ifeq ($(findstring $(ARCH),$(PPC_ARCHS)),$(ARCH)) -CONFIGURE_ARGS += --extra-libs=-latomic CONFIGURE_ARGS += --arch=ppc ifeq ($(findstring $(ARCH),qoriq),$(ARCH)) CONFIGURE_ARGS += --cpu=e500v2 +CONFIGURE_ARGS += --extra-libs=-latomic else CONFIGURE_ARGS += --cpu=e500 --disable-altivec endif diff --git a/mk/spksrc.cross-cmake-env.mk b/mk/spksrc.cross-cmake-env.mk index b0000ada2cb..5c53a57c059 100644 --- a/mk/spksrc.cross-cmake-env.mk +++ b/mk/spksrc.cross-cmake-env.mk @@ -102,12 +102,18 @@ endif ifeq ($(strip $(CMAKE_USE_NASM)),1) # Define x86asm ifeq ($(findstring $(ARCH),$(i686_ARCHS) $(x64_ARCHS)),$(ARCH)) - DEPENDS += native/nasm - NASM_PATH = $(abspath $(CURDIR)/../../native/nasm/work-native/install/usr/local/bin) - ENV += PATH=$(NASM_PATH):$$PATH - ENV += AS=$(NASM_PATH)/nasm - ENABLE_ASSEMBLY = ON - CMAKE_ASM_COMPILER = $(NASM_PATH)/nasm + HOST_NASM = $(shell command -v nasm 2>/dev/null) + ENABLE_ASSEMBLY = ON + ifneq ($(HOST_NASM),) + ENV += AS=$(HOST_NASM) + CMAKE_ASM_COMPILER = $(HOST_NASM) + else + DEPENDS += native/nasm + NASM_PATH = $(abspath $(CURDIR)/../../native/nasm/work-native/install/usr/local/bin) + ENV += PATH=$(NASM_PATH):$$PATH + ENV += AS=$(NASM_PATH)/nasm + CMAKE_ASM_COMPILER = $(NASM_PATH)/nasm + endif endif else CMAKE_USE_NASM = 0