Skip to content

Commit

Permalink
Update default spksrc image to Debian12 (#6183)
Browse files Browse the repository at this point in the history
* 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: #6183 (comment)

* 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 <[email protected]>

* 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 <[email protected]>
  • Loading branch information
th0ma7 and hgy59 authored Aug 27, 2024
1 parent 978b560 commit 53a380a
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 83 deletions.
59 changes: 36 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/SynoCommunity/spksrc/graphs/contributors>"
LABEL url="https://synocommunity.com"
Expand All @@ -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 \
Expand All @@ -29,6 +30,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
expect \
fakeroot \
flex \
gh \
g++-multilib \
gawk \
gettext \
Expand All @@ -51,44 +53,55 @@ 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 \
subversion \
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
Expand Down
78 changes: 27 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].

Expand All @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cross/ffmpeg4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cross/ffmpeg5/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cross/ffmpeg6/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 12 additions & 6 deletions mk/spksrc.cross-cmake-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 53a380a

Please sign in to comment.