Build libcec for Docker image (#5230)
* Build libcec for Docker image * Update development dockerfile as well * Dynamically load python paths for current version
This commit is contained in:
parent
bb02fc707c
commit
c7249a3e3a
3 changed files with 63 additions and 2 deletions
|
@ -13,7 +13,7 @@ RUN echo "deb http://download.telldus.com/debian/ stable main" >> /etc/apt/sourc
|
|||
wget -qO - http://download.telldus.se/debian/telldus-public.key | apt-key add - && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends nmap net-tools cython3 libudev-dev sudo libglib2.0-dev bluetooth libbluetooth-dev \
|
||||
libtelldus-core2 && \
|
||||
libtelldus-core2 cmake libxrandr-dev swig && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
COPY script/build_python_openzwave script/build_python_openzwave
|
||||
|
@ -21,6 +21,9 @@ RUN script/build_python_openzwave && \
|
|||
mkdir -p /usr/local/share/python-openzwave && \
|
||||
ln -sf /usr/src/app/build/python-openzwave/openzwave/config /usr/local/share/python-openzwave/config
|
||||
|
||||
COPY script/build_libcec script/build_libcec
|
||||
RUN script/build_libcec
|
||||
|
||||
COPY requirements_all.txt requirements_all.txt
|
||||
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop
|
||||
|
|
55
script/build_libcec
Executable file
55
script/build_libcec
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
# Sets up and builds libcec to be used with Home Assistant.
|
||||
# Dependencies that need to be installed:
|
||||
# apt-get install cmake libudev-dev libxrandr-dev python-dev swig
|
||||
|
||||
# Stop on errors
|
||||
set -e
|
||||
|
||||
# Load required information about the current python environment
|
||||
PYTHON_LIBDIR=$(python -c 'from distutils import sysconfig; print(sysconfig.get_config_var("LIBDIR"))')
|
||||
PYTHON_LDLIBRARY=$(python -c 'from distutils import sysconfig; print(sysconfig.get_config_var("LDLIBRARY"))')
|
||||
PYTHON_LIBRARY="${PYTHON_LIBDIR}/${PYTHON_LDLIBRARY}"
|
||||
PYTHON_INCLUDE_DIR=$(python -c 'from distutils import sysconfig; print(sysconfig.get_python_inc())')
|
||||
PYTHON_SITE_DIR=$(python -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(prefix=""))')
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p build && cd build
|
||||
|
||||
if [ ! -d libcec ]; then
|
||||
git clone --branch release --depth 1 https://github.com/Pulse-Eight/libcec.git
|
||||
fi
|
||||
|
||||
cd libcec
|
||||
git checkout release
|
||||
git pull
|
||||
git submodule update --init src/platform
|
||||
|
||||
# Build libcec platform libs
|
||||
(
|
||||
mkdir -p src/platform/build
|
||||
cd src/platform/build
|
||||
cmake ..
|
||||
make
|
||||
make install
|
||||
)
|
||||
|
||||
# Fix upstream install hardcoded Debian path.
|
||||
# See: https://github.com/Pulse-Eight/libcec/issues/288
|
||||
sed -i \
|
||||
-e '/DESTINATION/s:lib/python${PYTHON_VERSION}/dist-packages:${PYTHON_SITE_DIR}:' \
|
||||
src/libcec/cmake/CheckPlatformSupport.cmake
|
||||
|
||||
# Build libcec
|
||||
(
|
||||
mkdir -p build && cd build
|
||||
|
||||
cmake \
|
||||
-DPYTHON_LIBRARY="${PYTHON_LIBRARY}" \
|
||||
-DPYTHON_INCLUDE_DIR="${PYTHON_INCLUDE_DIR}" \
|
||||
-DPYTHON_SITE_DIR="${PYTHON_SITE_DIR}" \
|
||||
..
|
||||
make
|
||||
make install
|
||||
ldconfig
|
||||
)
|
|
@ -17,7 +17,7 @@ RUN echo "deb http://download.telldus.com/debian/ stable main" >> /etc/apt/sourc
|
|||
wget -qO - http://download.telldus.se/debian/telldus-public.key | apt-key add - && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends nmap net-tools cython3 libudev-dev sudo libglib2.0-dev bluetooth libbluetooth-dev \
|
||||
libtelldus-core2 && \
|
||||
libtelldus-core2 cmake libxrandr-dev swig && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
COPY script/build_python_openzwave script/build_python_openzwave
|
||||
|
@ -25,6 +25,9 @@ RUN script/build_python_openzwave && \
|
|||
mkdir -p /usr/local/share/python-openzwave && \
|
||||
ln -sf /usr/src/app/build/python-openzwave/openzwave/config /usr/local/share/python-openzwave/config
|
||||
|
||||
COPY script/build_libcec script/build_libcec
|
||||
RUN script/build_libcec
|
||||
|
||||
COPY requirements_all.txt requirements_all.txt
|
||||
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop
|
||||
|
|
Loading…
Add table
Reference in a new issue