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
|
||||
CGO_ENABLED=1 \
|
||||
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
|
||||
|
||||
test:
|
||||
|
|
@ -36,7 +36,7 @@ lint:
|
|||
$(GOPATH)/bin/golint ./...
|
||||
|
||||
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:
|
||||
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
|
||||
|
||||
LIB=/usr/local/lib/libntgcalls.a
|
||||
SYS_CRYPTO=/usr/lib/x86_64-linux-gnu/libcrypto.so.3
|
||||
SYS_SSL=/usr/lib/x86_64-linux-gnu/libssl.so.3
|
||||
SYS_CRYPTO="${SYS_CRYPTO:-/usr/lib/x86_64-linux-gnu/libcrypto.so.3}"
|
||||
SYS_SSL="${SYS_SSL:-/usr/lib/x86_64-linux-gnu/libssl.so.3}"
|
||||
PREFIX=ntgssl_
|
||||
|
||||
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 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 \
|
||||
| tar xz -C /usr/local --strip-components=1
|
||||
RUN apt-get install -y libasound2-dev libpulse-dev
|
||||
# Note: ntgcalls submodule must be initialized on host before docker build
|
||||
RUN --mount=type=bind,source=./ntgcalls,target=/ntgcalls-src,rw \
|
||||
mkdir -p /ntgcalls-build && cd /ntgcalls-build && \
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/ntgcalls-src/cmake/Toolchain.cmake \
|
||||
-DPython_EXECUTABLE=$(which python3) \
|
||||
-DSTATIC_BUILD=ON \
|
||||
/ntgcalls-src/ && \
|
||||
cmake --build . ${MAKEOPTS} && \
|
||||
cp -r /ntgcalls-src/static-output /ntgcalls-output
|
||||
COPY ntgcalls/ /ntgcalls-src/
|
||||
WORKDIR /ntgcalls-build/
|
||||
RUN cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/ntgcalls-src/cmake/Toolchain.cmake \
|
||||
-DPython_EXECUTABLE=$(which python3) \
|
||||
-DSTATIC_BUILD=ON \
|
||||
/ntgcalls-src/
|
||||
RUN cmake --build . ${MAKEOPTS}
|
||||
|
||||
FROM base AS cache
|
||||
ARG VERSION
|
||||
FROM base AS deps
|
||||
COPY --from=tdlib /compiled/ /usr/local/
|
||||
COPY --from=ntgcalls-build /ntgcalls-output/lib/libntgcalls.a /usr/local/lib/
|
||||
COPY --from=ntgcalls-build /ntgcalls-output/include/ /usr/local/include/
|
||||
RUN --mount=type=bind,source=./docker/resolv_shim.c,target=/tmp/resolv_shim.c \
|
||||
gcc -c -o /tmp/resolv_shim.o /tmp/resolv_shim.c && \
|
||||
COPY --from=ntgcalls-build /ntgcalls-src/static-output/lib/libntgcalls.a /usr/local/lib/
|
||||
COPY --from=ntgcalls-build /ntgcalls-src/static-output/include/ /usr/local/include/
|
||||
COPY docker/resolv_shim.c /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
|
||||
# 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
|
||||
RUN go env -w GOCACHE=/go-cache
|
||||
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'
|
||||
RUN --mount=type=cache,target=/go/pkg/mod go get
|
||||
|
||||
FROM cache AS build
|
||||
ARG MAKEOPTS
|
||||
|
|
@ -62,15 +67,13 @@ WORKDIR /src
|
|||
# Bullseye only has the pre-fork libsignal-protocol-c packaged (libomemo-c
|
||||
# is bookworm+) - GOTAGS=signal_legacy builds telegabber's OMEMO bindings
|
||||
# against it, which only supports legacy/siacs OMEMO, not modern OMEMO 1/2.
|
||||
RUN --mount=type=bind,source=./,target=/src,rw \
|
||||
--mount=type=cache,target=/go-cache \
|
||||
--mount=type=cache,target=/gomod-cache \
|
||||
--mount=type=cache,destination=/src/release \
|
||||
make ${MAKEOPTS} GOTAGS=signal_legacy
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
make ${MAKEOPTS} GOTAGS=signal_legacy NO_MOLD=1
|
||||
|
||||
FROM build AS release
|
||||
RUN --mount=type=cache,destination=/src/release \
|
||||
cp /src/release/telegabber /
|
||||
FROM scratch AS telegabber
|
||||
COPY --from=build /src/release/telegabber /usr/local/bin/
|
||||
ENTRYPOINT ["/usr/local/bin/telegabber"]
|
||||
|
||||
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)
|
||||
c.updateFile(typedUpdate)
|
||||
case client.TypeUpdateCall:
|
||||
typedUpdate, ok := update.(*client.UpdateCall)
|
||||
if !ok {
|
||||
uhOh()
|
||||
}
|
||||
typedUpdate, _ := update.(*client.UpdateCall)
|
||||
c.callDeps.TgManager.OnUpdateCall(c.jid, typedUpdate)
|
||||
case client.TypeUpdateNewCallSignalingData:
|
||||
typedUpdate, ok := update.(*client.UpdateNewCallSignalingData)
|
||||
if !ok {
|
||||
uhOh()
|
||||
}
|
||||
typedUpdate, _ := update.(*client.UpdateNewCallSignalingData)
|
||||
c.callDeps.TgManager.OnNewSignalingData(c.jid, typedUpdate)
|
||||
default:
|
||||
// log only handled types
|
||||
|
|
|
|||
Loading…
Reference in a new issue