mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 04:07:07 +00:00
Fix conflicts with the mycalls branch
This commit is contained in:
parent
789fd5a5a7
commit
4a1b0f4ccc
4 changed files with 41 additions and 44 deletions
4
Makefile
4
Makefile
|
|
@ -19,7 +19,7 @@ all:
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
CGO_ENABLED=1 \
|
CGO_ENABLED=1 \
|
||||||
CGO_CFLAGS="-I$(NTG_INC_DIR)" \
|
CGO_CFLAGS="-I$(NTG_INC_DIR)" \
|
||||||
CGO_LDFLAGS="-L$(NTG_LIB_DIR) -lntgcalls -lresolv_shim -lstdc++ -lm -ldl -lrt -lpthread -lz -lresolv -fuse-ld=mold" \
|
CGO_LDFLAGS="-L$(NTG_LIB_DIR) -lntgcalls -lresolv_shim -lstdc++ -lm -ldl -lrt -lpthread -lz -lresolv $(if $(filter-out 0,$(NO_MOLD)),,-fuse-ld=mold)" \
|
||||||
go build -ldflags "-X main.commit=${COMMIT}" -tags "${GOTAGS}" -o release/telegabber
|
go build -ldflags "-X main.commit=${COMMIT}" -tags "${GOTAGS}" -o release/telegabber
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
|
@ -36,7 +36,7 @@ lint:
|
||||||
$(GOPATH)/bin/golint ./...
|
$(GOPATH)/bin/golint ./...
|
||||||
|
|
||||||
build_indocker:
|
build_indocker:
|
||||||
DOCKER_BUILDKIT=1 docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "VERSION=${VERSION}" --build-arg "MAKEOPTS=${MAKEOPTS}" --output=release --target binaries .
|
DOCKER_BUILDKIT=1 docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "MAKEOPTS=${MAKEOPTS}" --output=release --target binaries .
|
||||||
|
|
||||||
build_indocker_staging:
|
build_indocker_staging:
|
||||||
DOCKER_BUILDKIT=1 docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "MAKEOPTS=${MAKEOPTS}" --network host --output=release --target binaries -f staging.Dockerfile .
|
DOCKER_BUILDKIT=1 docker build --build-arg "TD_COMMIT=${TD_COMMIT}" --build-arg "MAKEOPTS=${MAKEOPTS}" --network host --output=release --target binaries -f staging.Dockerfile .
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
LIB=/usr/local/lib/libntgcalls.a
|
LIB=/usr/local/lib/libntgcalls.a
|
||||||
SYS_CRYPTO=/usr/lib/x86_64-linux-gnu/libcrypto.so.3
|
SYS_CRYPTO="${SYS_CRYPTO:-/usr/lib/x86_64-linux-gnu/libcrypto.so.3}"
|
||||||
SYS_SSL=/usr/lib/x86_64-linux-gnu/libssl.so.3
|
SYS_SSL="${SYS_SSL:-/usr/lib/x86_64-linux-gnu/libssl.so.3}"
|
||||||
PREFIX=ntgssl_
|
PREFIX=ntgssl_
|
||||||
|
|
||||||
work=$(mktemp -d)
|
work=$(mktemp -d)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.24-bookworm AS base
|
FROM golang:1.24-bullseye AS base
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y libssl-dev cmake build-essential gperf libz-dev make git php libsignal-protocol-c-dev
|
RUN apt-get install -y libssl-dev cmake build-essential gperf libz-dev make git php libsignal-protocol-c-dev
|
||||||
|
|
@ -26,32 +26,37 @@ ARG CMAKE_VERSION=3.31.6
|
||||||
RUN curl -fsSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz \
|
RUN curl -fsSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-$(uname -m).tar.gz \
|
||||||
| tar xz -C /usr/local --strip-components=1
|
| tar xz -C /usr/local --strip-components=1
|
||||||
RUN apt-get install -y libasound2-dev libpulse-dev
|
RUN apt-get install -y libasound2-dev libpulse-dev
|
||||||
# Note: ntgcalls submodule must be initialized on host before docker build
|
COPY ntgcalls/ /ntgcalls-src/
|
||||||
RUN --mount=type=bind,source=./ntgcalls,target=/ntgcalls-src,rw \
|
WORKDIR /ntgcalls-build/
|
||||||
mkdir -p /ntgcalls-build && cd /ntgcalls-build && \
|
RUN cmake -DCMAKE_BUILD_TYPE=Release \
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_TOOLCHAIN_FILE=/ntgcalls-src/cmake/Toolchain.cmake \
|
-DCMAKE_TOOLCHAIN_FILE=/ntgcalls-src/cmake/Toolchain.cmake \
|
||||||
-DPython_EXECUTABLE=$(which python3) \
|
-DPython_EXECUTABLE=$(which python3) \
|
||||||
-DSTATIC_BUILD=ON \
|
-DSTATIC_BUILD=ON \
|
||||||
/ntgcalls-src/ && \
|
/ntgcalls-src/
|
||||||
cmake --build . ${MAKEOPTS} && \
|
RUN cmake --build . ${MAKEOPTS}
|
||||||
cp -r /ntgcalls-src/static-output /ntgcalls-output
|
|
||||||
|
|
||||||
FROM base AS cache
|
FROM base AS deps
|
||||||
ARG VERSION
|
|
||||||
COPY --from=tdlib /compiled/ /usr/local/
|
COPY --from=tdlib /compiled/ /usr/local/
|
||||||
COPY --from=ntgcalls-build /ntgcalls-output/lib/libntgcalls.a /usr/local/lib/
|
COPY --from=ntgcalls-build /ntgcalls-src/static-output/lib/libntgcalls.a /usr/local/lib/
|
||||||
COPY --from=ntgcalls-build /ntgcalls-output/include/ /usr/local/include/
|
COPY --from=ntgcalls-build /ntgcalls-src/static-output/include/ /usr/local/include/
|
||||||
RUN --mount=type=bind,source=./docker/resolv_shim.c,target=/tmp/resolv_shim.c \
|
COPY docker/resolv_shim.c /tmp/resolv_shim.c
|
||||||
gcc -c -o /tmp/resolv_shim.o /tmp/resolv_shim.c && \
|
RUN gcc -c -o /tmp/resolv_shim.o /tmp/resolv_shim.c && \
|
||||||
ar rcs /usr/local/lib/libresolv_shim.a /tmp/resolv_shim.o
|
ar rcs /usr/local/lib/libresolv_shim.a /tmp/resolv_shim.o
|
||||||
|
# Needed by gopkg.in/hraban/opus.v2 (cgo pkg-config).
|
||||||
|
# Installed here (not in `base`) to keep tdlib/ntgcalls layers cached.
|
||||||
|
RUN apt-get install -y libopus-dev libopusfile-dev
|
||||||
|
# Isolate libntgcalls.a's bundled BoringSSL so its symbols don't displace
|
||||||
|
# system OpenSSL at link time (TDLib was built against the latter).
|
||||||
|
COPY docker/isolate_ntgcalls_crypto.sh /tmp/isolate_ntgcalls_crypto.sh
|
||||||
|
RUN SYS_CRYPTO=/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 \
|
||||||
|
SYS_SSL=/usr/lib/x86_64-linux-gnu/libssl.so.1.1 \
|
||||||
|
bash /tmp/isolate_ntgcalls_crypto.sh
|
||||||
|
|
||||||
|
FROM deps AS cache
|
||||||
|
COPY ./ /src
|
||||||
|
RUN git -C /src submodule update --init
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN go env -w GOCACHE=/go-cache
|
RUN --mount=type=cache,target=/go/pkg/mod go get
|
||||||
RUN go env -w GOMODCACHE=/gomod-cache
|
|
||||||
# Note: submodules must be initialized on host before docker build (bind mount)
|
|
||||||
RUN --mount=type=cache,target=/gomod-cache \
|
|
||||||
--mount=type=bind,source=./,target=/src,rw \
|
|
||||||
/bin/bash -c 'go mod tidy; go get'
|
|
||||||
|
|
||||||
FROM cache AS build
|
FROM cache AS build
|
||||||
ARG MAKEOPTS
|
ARG MAKEOPTS
|
||||||
|
|
@ -62,15 +67,13 @@ WORKDIR /src
|
||||||
# Bullseye only has the pre-fork libsignal-protocol-c packaged (libomemo-c
|
# Bullseye only has the pre-fork libsignal-protocol-c packaged (libomemo-c
|
||||||
# is bookworm+) - GOTAGS=signal_legacy builds telegabber's OMEMO bindings
|
# is bookworm+) - GOTAGS=signal_legacy builds telegabber's OMEMO bindings
|
||||||
# against it, which only supports legacy/siacs OMEMO, not modern OMEMO 1/2.
|
# against it, which only supports legacy/siacs OMEMO, not modern OMEMO 1/2.
|
||||||
RUN --mount=type=bind,source=./,target=/src,rw \
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
--mount=type=cache,target=/go-cache \
|
--mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/gomod-cache \
|
make ${MAKEOPTS} GOTAGS=signal_legacy NO_MOLD=1
|
||||||
--mount=type=cache,destination=/src/release \
|
|
||||||
make ${MAKEOPTS} GOTAGS=signal_legacy
|
|
||||||
|
|
||||||
FROM build AS release
|
FROM scratch AS telegabber
|
||||||
RUN --mount=type=cache,destination=/src/release \
|
COPY --from=build /src/release/telegabber /usr/local/bin/
|
||||||
cp /src/release/telegabber /
|
ENTRYPOINT ["/usr/local/bin/telegabber"]
|
||||||
|
|
||||||
FROM scratch AS binaries
|
FROM scratch AS binaries
|
||||||
COPY --from=release /telegabber /
|
COPY --from=telegabber /usr/local/bin/telegabber /
|
||||||
|
|
|
||||||
|
|
@ -146,16 +146,10 @@ func (c *Client) updateHandler() {
|
||||||
typedUpdate, _ := update.(*client.UpdateFile)
|
typedUpdate, _ := update.(*client.UpdateFile)
|
||||||
c.updateFile(typedUpdate)
|
c.updateFile(typedUpdate)
|
||||||
case client.TypeUpdateCall:
|
case client.TypeUpdateCall:
|
||||||
typedUpdate, ok := update.(*client.UpdateCall)
|
typedUpdate, _ := update.(*client.UpdateCall)
|
||||||
if !ok {
|
|
||||||
uhOh()
|
|
||||||
}
|
|
||||||
c.callDeps.TgManager.OnUpdateCall(c.jid, typedUpdate)
|
c.callDeps.TgManager.OnUpdateCall(c.jid, typedUpdate)
|
||||||
case client.TypeUpdateNewCallSignalingData:
|
case client.TypeUpdateNewCallSignalingData:
|
||||||
typedUpdate, ok := update.(*client.UpdateNewCallSignalingData)
|
typedUpdate, _ := update.(*client.UpdateNewCallSignalingData)
|
||||||
if !ok {
|
|
||||||
uhOh()
|
|
||||||
}
|
|
||||||
c.callDeps.TgManager.OnNewSignalingData(c.jid, typedUpdate)
|
c.callDeps.TgManager.OnNewSignalingData(c.jid, typedUpdate)
|
||||||
default:
|
default:
|
||||||
// log only handled types
|
// log only handled types
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue