Merge commit '3105cc20ef3173b87fdc1688962ed6318a1fd039'
This commit is contained in:
@ -262,6 +262,8 @@ int main(int argc, char *argv[])
|
||||
last_lan_discovery = mono_time_get(mono_time);
|
||||
}
|
||||
|
||||
do_gca(mono_time, gc_announces_list);
|
||||
|
||||
#ifdef TCP_RELAY_ENABLED
|
||||
do_tcp_server(tcp_s, mono_time);
|
||||
#endif
|
||||
|
@ -1 +1 @@
|
||||
9ec2993a28988bd147bf8f4f21a824c2fc5dbf7255e391b3ce517d337ebce5c1 /usr/local/bin/tox-bootstrapd
|
||||
abd103553021d86f54c874fe582001f28372b4e56502421955552117ac5f7b3b /usr/local/bin/tox-bootstrapd
|
||||
|
@ -595,6 +595,8 @@ int main(int argc, char *argv[])
|
||||
last_lan_discovery = mono_time_get(mono_time);
|
||||
}
|
||||
|
||||
do_gca(mono_time, group_announce);
|
||||
|
||||
if (enable_tcp_relay) {
|
||||
do_tcp_server(tcp_server, mono_time);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
@ -17,6 +19,7 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -8,6 +8,7 @@
|
||||
// - Proper logging.
|
||||
// - Proper error handling in general.
|
||||
// - Support both websocket and regular GET requests on /.
|
||||
// - Write logs in the standard Tox format.
|
||||
//
|
||||
// Copyright 2022-2025 The TokTok team.
|
||||
// Copyright 2021 Michael.liu.
|
||||
@ -22,6 +23,9 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
@ -31,10 +35,12 @@ var (
|
||||
targetAddr = flag.String("t", "127.0.0.1:5900", "tcp service address")
|
||||
)
|
||||
|
||||
// Should be enough to fit any Tox TCP packets.
|
||||
const bufferSize = 2048
|
||||
|
||||
var upgrader = websocket.Upgrader{
|
||||
// Should be enough to fit any Tox TCP packets.
|
||||
ReadBufferSize: 2048,
|
||||
WriteBufferSize: 2048,
|
||||
ReadBufferSize: bufferSize,
|
||||
WriteBufferSize: bufferSize,
|
||||
Subprotocols: []string{"binary"},
|
||||
CheckOrigin: func(r *http.Request) bool {
|
||||
return true
|
||||
@ -42,7 +48,7 @@ var upgrader = websocket.Upgrader{
|
||||
}
|
||||
|
||||
func forwardTCP(wsconn *websocket.Conn, conn net.Conn) {
|
||||
var tcpbuffer [2048]byte
|
||||
var tcpbuffer [bufferSize]byte
|
||||
defer wsconn.Close()
|
||||
defer conn.Close()
|
||||
for {
|
||||
@ -97,7 +103,52 @@ func serveWs(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
}
|
||||
|
||||
type logEntry struct {
|
||||
time string
|
||||
file string
|
||||
line string
|
||||
message string
|
||||
}
|
||||
|
||||
type logWriter struct{}
|
||||
|
||||
// Write implements the io.Writer interface.
|
||||
//
|
||||
// This parses the Go log format and outputs it as the standard Tox format.
|
||||
//
|
||||
// Go format:
|
||||
// "15:02:46.433968 websockify.go:106: Starting up websockify endpoint\n"
|
||||
//
|
||||
// Standard Tox format:
|
||||
// "[15:02:46.433 UTC] (websockify) websockify.go:106 : Debug: Starting up websockify endpoint"
|
||||
func (writer *logWriter) Write(bytes []byte) (int, error) {
|
||||
// Parse the Go log format (skipping the last 3 digits of the microseconds).
|
||||
re := regexp.MustCompile(`^(\d{2}:\d{2}:\d{2}\.\d{3})\d{3} ([^:]+):(\d+): (.*)$`)
|
||||
matches := re.FindStringSubmatch(strings.TrimSuffix(string(bytes), "\n"))
|
||||
if len(matches) != 5 {
|
||||
// If the log format doesn't match, just print it as is.
|
||||
fmt.Fprintf(os.Stderr, "%s (unparsed)", string(bytes))
|
||||
return len(bytes), nil
|
||||
}
|
||||
|
||||
// Extract the log fields.
|
||||
entry := logEntry{
|
||||
time: matches[1],
|
||||
file: matches[2],
|
||||
line: matches[3],
|
||||
message: matches[4],
|
||||
}
|
||||
|
||||
// Print the Go log format in the standard Tox format to stderr.
|
||||
fmt.Fprintf(os.Stderr, "[%s UTC] (websockify) %s:%s : Debug: %s\n", entry.time, entry.file, entry.line, entry.message)
|
||||
|
||||
return len(bytes), nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.SetFlags(log.Ltime | log.Lshortfile | log.LUTC | log.Lmicroseconds)
|
||||
log.SetOutput(new(logWriter))
|
||||
|
||||
flag.Parse()
|
||||
log.Println("Starting up websockify endpoint")
|
||||
|
||||
|
102
external/toxcore/c-toxcore/other/deploy/android.sh
vendored
Executable file
102
external/toxcore/c-toxcore/other/deploy/android.sh
vendored
Executable file
@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [ -n "${CI-}" ]; then
|
||||
sudo apt-get install -y --no-install-recommends ninja-build yasm
|
||||
fi
|
||||
|
||||
# Set up environment
|
||||
NDK=$ANDROID_NDK_HOME
|
||||
|
||||
ABI=${1:-"armeabi-v7a"}
|
||||
|
||||
case $ABI in
|
||||
armeabi-v7a)
|
||||
TARGET=armv7a-linux-androideabi
|
||||
NDK_API=21
|
||||
ANDROID_VPX_ABI=armv7-android-gcc
|
||||
;;
|
||||
arm64-v8a)
|
||||
TARGET=aarch64-linux-android
|
||||
NDK_API=21
|
||||
ANDROID_VPX_ABI=arm64-android-gcc
|
||||
;;
|
||||
x86)
|
||||
TARGET=i686-linux-android
|
||||
NDK_API=21
|
||||
ANDROID_VPX_ABI=x86-android-gcc
|
||||
;;
|
||||
x86_64)
|
||||
TARGET=x86_64-linux-android
|
||||
NDK_API=21
|
||||
ANDROID_VPX_ABI=x86_64-android-gcc
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
PREFIX="$PWD/deps-prefix-android-$ABI"
|
||||
|
||||
TOOLCHAIN="$NDK/toolchains/llvm/prebuilt/linux-x86_64"
|
||||
SYSROOT="$TOOLCHAIN/sysroot"
|
||||
|
||||
export CC="$TOOLCHAIN/bin/$TARGET$NDK_API-clang"
|
||||
export CXX="$TOOLCHAIN/bin/$TARGET$NDK_API-clang++"
|
||||
export LDFLAGS=-static-libstdc++
|
||||
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
|
||||
|
||||
# Build libsodium
|
||||
if [ ! -f "$PREFIX/lib/libsodium.a" ]; then
|
||||
tar zxf <(wget -O- https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20.tar.gz)
|
||||
pushd libsodium-1.0.20
|
||||
./configure --prefix="$PREFIX" --host="$TARGET" --with-sysroot="$SYSROOT" --disable-shared --disable-pie
|
||||
make -j"$(nproc)" install
|
||||
popd
|
||||
rm -rf libsodium-1.0.20
|
||||
fi
|
||||
|
||||
# Build opus
|
||||
if [ ! -f "$PREFIX/lib/libopus.a" ]; then
|
||||
tar zxf <(wget -O- https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz)
|
||||
pushd opus-1.5.2
|
||||
CFLAGS="-fPIC" ./configure --prefix="$PREFIX" --host="$TARGET" --with-sysroot="$SYSROOT" --disable-shared
|
||||
make "-j$(nproc)"
|
||||
make install
|
||||
popd
|
||||
rm -rf opus-1.5.2
|
||||
fi
|
||||
|
||||
# Build libvpx
|
||||
if [ ! -f "$PREFIX/lib/libvpx.a" ]; then
|
||||
tar zxf <(wget -O- https://github.com/webmproject/libvpx/archive/refs/tags/v1.15.0.tar.gz)
|
||||
pushd libvpx-1.15.0
|
||||
./configure --prefix="$PREFIX" --libc="$SYSROOT" --target="$ANDROID_VPX_ABI" --disable-examples --disable-unit-tests --enable-pic ||
|
||||
(cat config.log && exit 1)
|
||||
sed -i -e "s!^AS=as!AS=$CC -c!" ./*.mk
|
||||
sed -i -e "s!^STRIP=strip!STRIP=$TOOLCHAIN/bin/llvm-strip!" ./*.mk
|
||||
make "-j$(nproc)"
|
||||
make install
|
||||
popd
|
||||
rm -rf libvpx-1.15.0
|
||||
fi
|
||||
|
||||
# Build c-toxcore
|
||||
rm -rf _build
|
||||
cmake -B _build -G Ninja \
|
||||
-DANDROID_ABI="$ABI" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$NDK/build/cmake/android.toolchain.cmake" \
|
||||
-DCMAKE_INSTALL_PREFIX="$PWD/toxcore-android-$ABI" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DENABLE_STATIC=OFF \
|
||||
-DENABLE_SHARED=ON \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DDHT_BOOTSTRAP=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DUNITTEST=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DEXPERIMENTAL_API=ON
|
||||
cmake --build _build
|
||||
cmake --install _build
|
5
external/toxcore/c-toxcore/other/deploy/apple/.gitignore
vendored
Normal file
5
external/toxcore/c-toxcore/other/deploy/apple/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/Tox.xcframework
|
||||
/toxcore-ios*
|
||||
/toxcore-iphonesimulator*
|
||||
/toxcore-macos*
|
||||
/smoke-test.c
|
28
external/toxcore/c-toxcore/other/deploy/apple/Info.plist
vendored
Normal file
28
external/toxcore/c-toxcore/other/deploy/apple/Info.plist
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Tox</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Tox</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>chat.tox.toxcore</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.2.20</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.2.20</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Tox Framework</string>
|
||||
</dict>
|
||||
</plist>
|
1
external/toxcore/c-toxcore/other/deploy/apple/LICENSE
vendored
Symbolic link
1
external/toxcore/c-toxcore/other/deploy/apple/LICENSE
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../../LICENSE
|
29
external/toxcore/c-toxcore/other/deploy/apple/download-nightly.sh
vendored
Executable file
29
external/toxcore/c-toxcore/other/deploy/apple/download-nightly.sh
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
# Download the nightly builds of Tox for iOS, iPhone simulator, and macOS.
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
for arch in arm64 armv7 armv7s; do
|
||||
if [ ! -d "toxcore-ios-$arch" ]; then
|
||||
tar -zxf \
|
||||
<(curl -L "https://github.com/TokTok/c-toxcore/releases/download/nightly/toxcore-nightly-ios-$arch.tar.gz")
|
||||
fi
|
||||
done
|
||||
|
||||
for arch in arm64 x86_64; do
|
||||
if [ ! -d "toxcore-iphonesimulator-$arch" ]; then
|
||||
tar -zxf \
|
||||
<(curl -L "https://github.com/TokTok/c-toxcore/releases/download/nightly/toxcore-nightly-iphonesimulator-$arch.tar.gz")
|
||||
fi
|
||||
done
|
||||
|
||||
for arch in arm64 x86_64; do
|
||||
if [ ! -d "toxcore-macos-$arch" ]; then
|
||||
tar -zxf \
|
||||
<(curl -L "https://github.com/TokTok/c-toxcore/releases/download/nightly/toxcore-nightly-macos-$arch.tar.gz")
|
||||
fi
|
||||
done
|
71
external/toxcore/c-toxcore/other/deploy/apple/make-framework.sh
vendored
Executable file
71
external/toxcore/c-toxcore/other/deploy/apple/make-framework.sh
vendored
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# Make a Tox.xcframework for iOS, iPhone simulator, and macOS from the nightly builds.
|
||||
#
|
||||
# Run download-nightly.sh before running this script if you run it locally.
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Make a Tox.framework for iOS.
|
||||
rm -rf toxcore-ios/Tox.framework
|
||||
mkdir -p toxcore-ios/Tox.framework
|
||||
cp Info.plist toxcore-ios/Tox.framework
|
||||
cp -r toxcore-ios-arm64/include/tox toxcore-ios/Tox.framework/Headers
|
||||
lipo -create -output toxcore-ios/Tox.framework/Tox \
|
||||
toxcore-ios-arm64/lib/libtoxcore.dylib \
|
||||
toxcore-ios-armv7/lib/libtoxcore.dylib \
|
||||
toxcore-ios-armv7s/lib/libtoxcore.dylib
|
||||
install_name_tool -id @rpath/Tox.framework/Tox toxcore-ios/Tox.framework/Tox
|
||||
|
||||
# Make a Tox.framework for iPhone simulator.
|
||||
rm -rf toxcore-iphonesimulator/Tox.framework
|
||||
mkdir -p toxcore-iphonesimulator/Tox.framework
|
||||
cp Info.plist toxcore-iphonesimulator/Tox.framework
|
||||
cp -r toxcore-iphonesimulator-arm64/include/tox toxcore-iphonesimulator/Tox.framework/Headers
|
||||
lipo -create -output toxcore-iphonesimulator/Tox.framework/Tox \
|
||||
toxcore-iphonesimulator-arm64/lib/libtoxcore.dylib \
|
||||
toxcore-iphonesimulator-x86_64/lib/libtoxcore.dylib
|
||||
install_name_tool -id @rpath/Tox.framework/Tox toxcore-iphonesimulator/Tox.framework/Tox
|
||||
|
||||
# Make a Tox.framework for macOS.
|
||||
rm -rf toxcore-macos/Tox.framework
|
||||
mkdir -p toxcore-macos/Tox.framework
|
||||
cp Info.plist toxcore-macos/Tox.framework
|
||||
cp -r toxcore-macos-arm64/include/tox toxcore-macos/Tox.framework/Headers
|
||||
lipo -create -output toxcore-macos/Tox.framework/Tox \
|
||||
toxcore-macos-arm64/lib/libtoxcore.dylib \
|
||||
toxcore-macos-x86_64/lib/libtoxcore.dylib
|
||||
install_name_tool -id @rpath/Tox.framework/Tox toxcore-macos/Tox.framework/Tox
|
||||
|
||||
# Make a Tox.xcframework for iOS, iPhone simulator, and macOS.
|
||||
rm -rf Tox.xcframework
|
||||
xcodebuild -create-xcframework -output Tox.xcframework \
|
||||
-framework toxcore-ios/Tox.framework \
|
||||
-framework toxcore-iphonesimulator/Tox.framework \
|
||||
-framework toxcore-macos/Tox.framework
|
||||
|
||||
# Test the Tox.xcframework.
|
||||
cat >smoke-test.c <<'EOF'
|
||||
#include <stdio.h>
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdocumentation-deprecated-sync"
|
||||
#include <tox/tox.h>
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
int main(void) {
|
||||
Tox *tox = tox_new(NULL, NULL);
|
||||
if (tox == NULL) {
|
||||
fprintf(stderr, "tox_new failed\n");
|
||||
return 1;
|
||||
}
|
||||
tox_kill(tox);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
pod lib lint toxcore.podspec
|
||||
|
||||
rm smoke-test.c
|
24
external/toxcore/c-toxcore/other/deploy/apple/toxcore.podspec
vendored
Normal file
24
external/toxcore/c-toxcore/other/deploy/apple/toxcore.podspec
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "toxcore"
|
||||
s.version = "0.2.20"
|
||||
s.summary = "Cocoapods wrapper for toxcore"
|
||||
s.homepage = "https://github.com/TokTok/c-toxcore"
|
||||
s.license = 'GPLv3'
|
||||
s.author = { "Iphigenia Df" => "iphydf@gmail.com" }
|
||||
s.source = {
|
||||
:git => "https://github.com/TokTok/c-toxcore.git",
|
||||
:tag => s.version.to_s,
|
||||
:submodules => true
|
||||
}
|
||||
|
||||
s.requires_arc = false
|
||||
|
||||
s.ios.deployment_target = '12.0'
|
||||
s.osx.deployment_target = '10.15'
|
||||
|
||||
s.vendored_frameworks = 'Tox.xcframework'
|
||||
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"${PODS_ROOT}"' }
|
||||
s.test_spec 'Tests' do |test_spec|
|
||||
test_spec.source_files = 'smoke-test.c'
|
||||
end
|
||||
end
|
30
external/toxcore/c-toxcore/other/deploy/deps.sh
vendored
Executable file
30
external/toxcore/c-toxcore/other/deploy/deps.sh
vendored
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
SYSTEM="$1"
|
||||
ARCH="$2"
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
DEP_PREFIX="$PWD/deps-prefix-$SYSTEM-$ARCH"
|
||||
|
||||
if [ -d "$DEP_PREFIX" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -d ../dockerfiles ]; then
|
||||
DOCKERFILES="$(realpath ../dockerfiles)"
|
||||
else
|
||||
git clone --depth=1 https://github.com/TokTok/dockerfiles "$SCRIPT_DIR/dockerfiles"
|
||||
DOCKERFILES="$SCRIPT_DIR/dockerfiles"
|
||||
fi
|
||||
|
||||
for dep in sodium opus vpx; do
|
||||
mkdir -p "external/$dep"
|
||||
pushd "external/$dep"
|
||||
SCRIPT="$DOCKERFILES/qtox/build_$dep.sh"
|
||||
"$SCRIPT" --arch "$SYSTEM-$ARCH" --libtype "static" --buildtype "release" --prefix "$DEP_PREFIX" --macos "10.15"
|
||||
popd
|
||||
rm -rf "external/$dep"
|
||||
done
|
58
external/toxcore/c-toxcore/other/deploy/ios.sh
vendored
Executable file
58
external/toxcore/c-toxcore/other/deploy/ios.sh
vendored
Executable file
@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
TARGET="$1"
|
||||
|
||||
if [ -n "${CI-}" ]; then
|
||||
brew install bash coreutils ninja yasm
|
||||
fi
|
||||
|
||||
SYSTEM="${TARGET%%-*}"
|
||||
ARCH="${TARGET#*-}"
|
||||
|
||||
"$SCRIPT_DIR/deps.sh" "$SYSTEM" "$ARCH"
|
||||
|
||||
export PKG_CONFIG_PATH="$PWD/deps-prefix-$SYSTEM-$ARCH/lib/pkgconfig"
|
||||
|
||||
if [ "$SYSTEM" = "ios" ]; then
|
||||
XC_SDK="iphoneos"
|
||||
TARGET_IPHONE_SIMULATOR=OFF
|
||||
IOS_FLAGS="-miphoneos-version-min=10.0 -arch $ARCH"
|
||||
elif [ "$SYSTEM" = "iphonesimulator" ]; then
|
||||
XC_SDK="iphonesimulator"
|
||||
TARGET_IPHONE_SIMULATOR=ON
|
||||
IOS_FLAGS="-arch $ARCH"
|
||||
else
|
||||
echo "Unexpected system $SYSTEM"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUILD_DIR="_build-$SYSTEM-$ARCH"
|
||||
|
||||
# Build for iOS 10
|
||||
cmake \
|
||||
-B "$BUILD_DIR" \
|
||||
-G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX="$PWD/toxcore-$SYSTEM-$ARCH" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_STATIC=OFF \
|
||||
-DENABLE_SHARED=ON \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DDHT_BOOTSTRAP=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DUNITTEST=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DEXPERIMENTAL_API=ON \
|
||||
-DCMAKE_C_FLAGS="$IOS_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$IOS_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$IOS_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$IOS_FLAGS" \
|
||||
-DCMAKE_OSX_SYSROOT="$(xcrun --sdk "$XC_SDK" --show-sdk-path)" \
|
||||
-DCMAKE_OSX_ARCHITECTURES="$ARCH"
|
||||
|
||||
cmake --build "$BUILD_DIR"
|
||||
cmake --install "$BUILD_DIR"
|
29
external/toxcore/c-toxcore/other/deploy/linux.sh
vendored
Executable file
29
external/toxcore/c-toxcore/other/deploy/linux.sh
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
ARCH="$1"
|
||||
"$SCRIPT_DIR/deps.sh" linux "$ARCH"
|
||||
|
||||
export PKG_CONFIG_PATH="$PWD/deps-prefix-linux-$ARCH/lib/pkgconfig"
|
||||
|
||||
# Build
|
||||
cmake \
|
||||
-B _build \
|
||||
-G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX="$PWD/toxcore-linux-$ARCH" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_STATIC=OFF \
|
||||
-DENABLE_SHARED=ON \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DDHT_BOOTSTRAP=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DUNITTEST=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DEXPERIMENTAL_API=ON
|
||||
|
||||
cmake --build _build
|
||||
cmake --install _build
|
37
external/toxcore/c-toxcore/other/deploy/macos.sh
vendored
Executable file
37
external/toxcore/c-toxcore/other/deploy/macos.sh
vendored
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
ARCH="$1"
|
||||
|
||||
if [ -n "${CI-}" ]; then
|
||||
brew install bash coreutils ninja yasm
|
||||
fi
|
||||
|
||||
"$SCRIPT_DIR/deps.sh" macos "$ARCH"
|
||||
|
||||
export PKG_CONFIG_PATH="$PWD/deps-prefix-macos-$ARCH/lib/pkgconfig"
|
||||
|
||||
BUILD_DIR="_build-macos-$ARCH"
|
||||
|
||||
# Build for macOS
|
||||
cmake \
|
||||
-B "$BUILD_DIR" \
|
||||
-G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX="$PWD/toxcore-macos-$ARCH" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_STATIC=OFF \
|
||||
-DENABLE_SHARED=ON \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DDHT_BOOTSTRAP=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DUNITTEST=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DEXPERIMENTAL_API=ON \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
|
||||
|
||||
cmake --build "$BUILD_DIR"
|
||||
cmake --install "$BUILD_DIR"
|
1
external/toxcore/c-toxcore/other/deploy/single-file/.gitignore
vendored
Normal file
1
external/toxcore/c-toxcore/other/deploy/single-file/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
!/Makefile
|
26
external/toxcore/c-toxcore/other/deploy/single-file/Makefile
vendored
Normal file
26
external/toxcore/c-toxcore/other/deploy/single-file/Makefile
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
TARGETS = libtoxcore.a libtoxcore-minimal.a
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
libtoxcore.o: $(wildcard toxcore-*av.c)
|
||||
$(CC) -c -o $@ $< \
|
||||
-O2 \
|
||||
-Wno-discarded-qualifiers \
|
||||
-fPIC \
|
||||
-Wl,-Bstatic \
|
||||
$(shell pkg-config --cflags --libs libsodium) \
|
||||
-Wl,-Bdynamic \
|
||||
$(shell pkg-config --cflags --libs opus vpx) \
|
||||
-pthread
|
||||
|
||||
libtoxcore-minimal.o: $(wildcard toxcore-*core.c)
|
||||
$(CC) -c -o $@ $< \
|
||||
-O2 \
|
||||
-Wno-discarded-qualifiers \
|
||||
-fPIC \
|
||||
-Wl,-Bstatic \
|
||||
$(shell pkg-config --cflags --libs libsodium) \
|
||||
-pthread
|
||||
|
||||
%.a: %.o
|
||||
$(AR) rcs $@ $^
|
@ -6,10 +6,10 @@
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# other/make_single_file auto_tests/toxav_basic_test.c auto_tests/auto_test_support.c testing/misc_tools.c | \
|
||||
# other/deploy/single-file/make_single_file auto_tests/toxav_basic_test.c auto_tests/auto_test_support.c testing/misc_tools.c | \
|
||||
# tcc -o toxav_basic_test - $(pkg-config --cflags --libs libsodium opus vpx)
|
||||
#
|
||||
# other/make_single_file -core auto_tests/send_message_test.c auto_tests/auto_test_support.c testing/misc_tools.c | \
|
||||
# other/deploy/single-file/make_single_file -core auto_tests/send_message_test.c auto_tests/auto_test_support.c testing/misc_tools.c | \
|
||||
# tcc -o send_message_test - $(pkg-config --cflags --libs libsodium)
|
||||
|
||||
use strict;
|
||||
@ -45,15 +45,16 @@ sub emit {
|
||||
}
|
||||
}
|
||||
|
||||
my @core = (<toxcore/*.c>, <toxcore/*/*.c>, <toxencryptsave/*.c>, <third_party/cmp/*.c>);
|
||||
if (@ARGV and $ARGV[0] eq "-core") {
|
||||
shift @ARGV;
|
||||
for my $fn (<toxcore/*.c>, <toxcore/*/*.c>, <third_party/cmp/*.c>) {
|
||||
emit(abs_path $fn);
|
||||
}
|
||||
emit(abs_path $_) for @core;
|
||||
} else {
|
||||
for my $fn (<toxav/*.c>, <toxcore/*.c>, <toxcore/*/*.c>, <toxencryptsave/*.c>, <third_party/cmp/*.c>) {
|
||||
emit(abs_path $fn);
|
||||
if (@ARGV and $ARGV[0] eq "-av") {
|
||||
# Ignore -av, it's the default.
|
||||
shift @ARGV;
|
||||
}
|
||||
emit(abs_path $_) for (<toxav/*.c>, @core);
|
||||
}
|
||||
|
||||
emit(abs_path $_) for @ARGV;
|
24
external/toxcore/c-toxcore/other/docker/alpine-s390x/alpine-s390x.Dockerfile.dockerignore
vendored
Normal file
24
external/toxcore/c-toxcore/other/docker/alpine-s390x/alpine-s390x.Dockerfile.dockerignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# ===== common =====
|
||||
# Ignore everything ...
|
||||
**/*
|
||||
# ... except sources
|
||||
!**/*.[ch]
|
||||
!**/*.cc
|
||||
!**/*.hh
|
||||
!CHANGELOG.md
|
||||
!LICENSE
|
||||
!README.md
|
||||
!auto_tests/data/*
|
||||
!other/bootstrap_daemon/bash-completion/**
|
||||
!other/bootstrap_daemon/tox-bootstrapd.*
|
||||
!other/proxy/*.mod
|
||||
!other/proxy/*.sum
|
||||
!other/proxy/*.go
|
||||
# ... and CMake build files (used by most builds).
|
||||
!**/CMakeLists.txt
|
||||
!.github/scripts/flags*.sh
|
||||
!cmake/*.cmake
|
||||
!other/pkgconfig/*
|
||||
!other/rpm/*
|
||||
!so.version
|
||||
!.github/scripts/cmake-alpine-s390x
|
1
external/toxcore/c-toxcore/other/docker/alpine-s390x/dockerignore
vendored
Normal file
1
external/toxcore/c-toxcore/other/docker/alpine-s390x/dockerignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
!.github/scripts/cmake-alpine-s390x
|
@ -1,5 +1,3 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
BUILD=alpine-s390x
|
||||
docker build -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/Dockerfile" .
|
||||
. "$(cd "$(dirname "${BASH_SOURCE[0]}")/../sources" && pwd)/run.sh"
|
||||
|
@ -92,10 +92,6 @@
|
||||
<alloc init="true">new_networking_no_udp</alloc>
|
||||
<dealloc arg="1">kill_networking</dealloc>
|
||||
</resource>
|
||||
<resource>
|
||||
<alloc init="true">net_new_strerror</alloc>
|
||||
<dealloc arg="1">net_kill_strerror</dealloc>
|
||||
</resource>
|
||||
<resource>
|
||||
<alloc init="true">new_onion</alloc>
|
||||
<dealloc arg="1">kill_onion</dealloc>
|
||||
|
@ -11,9 +11,9 @@ RUN apt-get update && \
|
||||
WORKDIR /work
|
||||
COPY --from=sources /src/ /work/
|
||||
|
||||
COPY other/make_single_file /work/other/
|
||||
COPY other/deploy/single-file/make_single_file /work/
|
||||
|
||||
RUN other/make_single_file -core auto_tests/tox_new_test.c other/docker/goblint/sodium.c > analysis.c
|
||||
RUN ./make_single_file -core auto_tests/tox_new_test.c other/docker/goblint/sodium.c > analysis.c
|
||||
# Try compiling+linking just to make sure we have all the fake functions.
|
||||
RUN tcc analysis.c
|
||||
|
||||
|
@ -98,6 +98,17 @@ int crypto_hash_sha512(unsigned char *out, const unsigned char *in,
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int crypto_pwhash_scryptsalsa208sha256(unsigned char *const out,
|
||||
unsigned long long outlen,
|
||||
const char *const passwd,
|
||||
unsigned long long passwdlen,
|
||||
const unsigned char *const salt,
|
||||
unsigned long long opslimit,
|
||||
size_t memlimit)
|
||||
{
|
||||
memset(out, 0, outlen);
|
||||
return 0;
|
||||
}
|
||||
void randombytes(unsigned char *const buf, const unsigned long long buf_len)
|
||||
{
|
||||
memset(buf, 0, buf_len);
|
||||
|
@ -12,24 +12,24 @@ MODS = {}
|
||||
STD_MODULE = """module std [system] {
|
||||
textual header "/usr/include/alloca.h"
|
||||
textual header "/usr/include/assert.h"
|
||||
textual header "/usr/include/c++/13.2.1/algorithm"
|
||||
textual header "/usr/include/c++/13.2.1/array"
|
||||
textual header "/usr/include/c++/13.2.1/chrono"
|
||||
textual header "/usr/include/c++/13.2.1/cstddef"
|
||||
textual header "/usr/include/c++/13.2.1/cstdint"
|
||||
textual header "/usr/include/c++/13.2.1/cstdio"
|
||||
textual header "/usr/include/c++/13.2.1/cstdlib"
|
||||
textual header "/usr/include/c++/13.2.1/cstring"
|
||||
textual header "/usr/include/c++/13.2.1/iomanip"
|
||||
textual header "/usr/include/c++/13.2.1/iosfwd"
|
||||
textual header "/usr/include/c++/13.2.1/limits"
|
||||
textual header "/usr/include/c++/13.2.1/memory"
|
||||
textual header "/usr/include/c++/13.2.1/ostream"
|
||||
textual header "/usr/include/c++/13.2.1/random"
|
||||
textual header "/usr/include/c++/13.2.1/stdlib.h"
|
||||
textual header "/usr/include/c++/13.2.1/thread"
|
||||
textual header "/usr/include/c++/13.2.1/type_traits"
|
||||
textual header "/usr/include/c++/13.2.1/vector"
|
||||
textual header "/usr/include/c++/14.2.0/algorithm"
|
||||
textual header "/usr/include/c++/14.2.0/array"
|
||||
textual header "/usr/include/c++/14.2.0/chrono"
|
||||
textual header "/usr/include/c++/14.2.0/cstddef"
|
||||
textual header "/usr/include/c++/14.2.0/cstdint"
|
||||
textual header "/usr/include/c++/14.2.0/cstdio"
|
||||
textual header "/usr/include/c++/14.2.0/cstdlib"
|
||||
textual header "/usr/include/c++/14.2.0/cstring"
|
||||
textual header "/usr/include/c++/14.2.0/iomanip"
|
||||
textual header "/usr/include/c++/14.2.0/iosfwd"
|
||||
textual header "/usr/include/c++/14.2.0/limits"
|
||||
textual header "/usr/include/c++/14.2.0/memory"
|
||||
textual header "/usr/include/c++/14.2.0/ostream"
|
||||
textual header "/usr/include/c++/14.2.0/random"
|
||||
textual header "/usr/include/c++/14.2.0/stdlib.h"
|
||||
textual header "/usr/include/c++/14.2.0/thread"
|
||||
textual header "/usr/include/c++/14.2.0/type_traits"
|
||||
textual header "/usr/include/c++/14.2.0/vector"
|
||||
textual header "/usr/include/errno.h"
|
||||
textual header "/usr/include/fortify/stdio.h"
|
||||
textual header "/usr/include/fortify/string.h"
|
||||
|
2
external/toxcore/c-toxcore/other/docker/modules/dockerignore
vendored
Normal file
2
external/toxcore/c-toxcore/other/docker/modules/dockerignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
!other/docker/modules/check
|
||||
!**/BUILD.bazel
|
@ -1,5 +1,4 @@
|
||||
FROM toxchat/c-toxcore:sources AS sources
|
||||
FROM alpine:3.19.0
|
||||
FROM alpine:3.21.0
|
||||
|
||||
RUN ["apk", "add", "--no-cache", \
|
||||
"bash", \
|
||||
@ -15,7 +14,7 @@ RUN ["apk", "add", "--no-cache", \
|
||||
"python3"]
|
||||
|
||||
WORKDIR /work
|
||||
COPY --from=sources /src/ /work/
|
||||
COPY . /work/
|
||||
|
||||
COPY toxcore/BUILD.bazel /work/toxcore/
|
||||
COPY other/docker/modules/check /work/other/docker/modules/
|
||||
|
25
external/toxcore/c-toxcore/other/docker/modules/modules.Dockerfile.dockerignore
vendored
Normal file
25
external/toxcore/c-toxcore/other/docker/modules/modules.Dockerfile.dockerignore
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# ===== common =====
|
||||
# Ignore everything ...
|
||||
**/*
|
||||
# ... except sources
|
||||
!**/*.[ch]
|
||||
!**/*.cc
|
||||
!**/*.hh
|
||||
!CHANGELOG.md
|
||||
!LICENSE
|
||||
!README.md
|
||||
!auto_tests/data/*
|
||||
!other/bootstrap_daemon/bash-completion/**
|
||||
!other/bootstrap_daemon/tox-bootstrapd.*
|
||||
!other/proxy/*.mod
|
||||
!other/proxy/*.sum
|
||||
!other/proxy/*.go
|
||||
# ... and CMake build files (used by most builds).
|
||||
!**/CMakeLists.txt
|
||||
!.github/scripts/flags*.sh
|
||||
!cmake/*.cmake
|
||||
!other/pkgconfig/*
|
||||
!other/rpm/*
|
||||
!so.version
|
||||
!other/docker/modules/check
|
||||
!**/BUILD.bazel
|
@ -1,6 +1,3 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
BUILD=modules
|
||||
other/docker/sources/build
|
||||
docker build -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/$BUILD.Dockerfile" .
|
||||
. "$(cd "$(dirname "${BASH_SOURCE[0]}")/../sources" && pwd)/run.sh"
|
||||
|
1
external/toxcore/c-toxcore/other/docker/pkgsrc/dockerignore
vendored
Normal file
1
external/toxcore/c-toxcore/other/docker/pkgsrc/dockerignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
!other/docker/pkgsrc/pkgsrc.patch
|
@ -1,11 +1,14 @@
|
||||
FROM toxchat/pkgsrc:latest
|
||||
|
||||
WORKDIR /work
|
||||
COPY . /work/c-toxcore-0.2.18
|
||||
RUN ["tar", "zcf", "c-toxcore.tar.gz", "c-toxcore-0.2.18"]
|
||||
COPY . /work/c-toxcore-0.2.21
|
||||
RUN ["tar", "zcf", "c-toxcore.tar.gz", "c-toxcore-0.2.21"]
|
||||
|
||||
WORKDIR /work/pkgsrc
|
||||
COPY other/docker/pkgsrc/pkgsrc.patch /tmp/pkgsrc.patch
|
||||
RUN ["patch", "-p1", "-i", "/tmp/pkgsrc.patch"]
|
||||
|
||||
WORKDIR /work/pkgsrc/chat/toxcore
|
||||
RUN ["sed", "-i", "-e", "s/libtoxcore.so.2.18.0/libtoxcore.so.2.20.0/g", "PLIST"]
|
||||
RUN ["bmake", "clean"]
|
||||
RUN ["bmake", "DISTFILES=c-toxcore.tar.gz", "DISTDIR=/work", "NO_CHECKSUM=yes"]
|
||||
RUN ["bmake", "install"]
|
||||
RUN ["bmake", "DISTFILES=c-toxcore.tar.gz", "DISTDIR=/work", "NO_CHECKSUM=yes", "install"]
|
||||
|
@ -21,3 +21,4 @@
|
||||
!other/pkgconfig/*
|
||||
!other/rpm/*
|
||||
!so.version
|
||||
!other/docker/pkgsrc/pkgsrc.patch
|
||||
|
31
external/toxcore/c-toxcore/other/docker/pkgsrc/pkgsrc.patch
vendored
Normal file
31
external/toxcore/c-toxcore/other/docker/pkgsrc/pkgsrc.patch
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
diff --git a/chat/toxcore/Makefile b/chat/toxcore/Makefile
|
||||
index 70466704d..53a08ad08 100644
|
||||
--- a/chat/toxcore/Makefile
|
||||
+++ b/chat/toxcore/Makefile
|
||||
@@ -1,6 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.6 2024/01/22 13:16:56 ryoon Exp $
|
||||
|
||||
-DISTNAME= toxcore-0.2.18
|
||||
+DISTNAME= toxcore-0.2.21
|
||||
PKGREVISION= 2
|
||||
CATEGORIES= chat
|
||||
MASTER_SITES= ${MASTER_SITE_GITHUB:=TokTok/}
|
||||
diff --git a/chat/toxcore/PLIST b/chat/toxcore/PLIST
|
||||
index f0a5e4f04..4122b0867 100644
|
||||
--- a/chat/toxcore/PLIST
|
||||
+++ b/chat/toxcore/PLIST
|
||||
@@ -4,11 +4,11 @@ bin/tox-bootstrapd
|
||||
include/tox/tox.h
|
||||
-include/tox/tox_dispatch.h
|
||||
-include/tox/tox_events.h
|
||||
+include/tox/tox_log_level.h
|
||||
+include/tox/tox_options.h
|
||||
include/tox/toxav.h
|
||||
include/tox/toxencryptsave.h
|
||||
lib/libtoxcore.a
|
||||
lib/libtoxcore.so
|
||||
lib/libtoxcore.so.2
|
||||
-lib/libtoxcore.so.2.18.0
|
||||
+lib/libtoxcore.so.2.21.0
|
||||
lib/pkgconfig/toxcore.pc
|
||||
share/bash-completion/completions/tox-bootstrapd
|
@ -27,8 +27,8 @@ RUN make install -j4 PREFIX=/usr/local
|
||||
|
||||
WORKDIR /work/c-toxcore
|
||||
COPY --from=sources /src/ /work/c-toxcore
|
||||
#COPY other/make_single_file /work/c-toxcore/other/
|
||||
#RUN other/make_single_file auto_tests/tox_new_test.c > crash.c
|
||||
#COPY other/deploy/single-file/make_single_file /work/c-toxcore/
|
||||
#RUN ./make_single_file auto_tests/tox_new_test.c > crash.c
|
||||
#RUN sparsec $(pkg-config --cflags --libs libsodium opus vpx) crash.c
|
||||
|
||||
COPY other/docker/sparse/Makefile /work/c-toxcore/
|
||||
|
@ -33,9 +33,9 @@ RUN tcc \
|
||||
$(pkg-config --cflags --libs libsodium opus vpx) \
|
||||
&& ./send_message_test | grep 'tox clients connected'
|
||||
|
||||
COPY other/make_single_file /work/other/
|
||||
COPY other/deploy/single-file/make_single_file /work/
|
||||
RUN \
|
||||
other/make_single_file -core \
|
||||
./make_single_file -core \
|
||||
auto_tests/auto_test_support.c \
|
||||
auto_tests/send_message_test.c \
|
||||
testing/misc_tools.c | \
|
||||
@ -47,7 +47,7 @@ RUN \
|
||||
&& ./send_message_test | grep 'tox clients connected'
|
||||
|
||||
RUN \
|
||||
other/make_single_file \
|
||||
./make_single_file \
|
||||
auto_tests/auto_test_support.c \
|
||||
auto_tests/toxav_basic_test.c \
|
||||
testing/misc_tools.c | \
|
||||
|
3
external/toxcore/c-toxcore/other/docker/wasm/run
vendored
Executable file
3
external/toxcore/c-toxcore/other/docker/wasm/run
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. "$(cd "$(dirname "${BASH_SOURCE[0]}")/../sources" && pwd)/run.sh"
|
136
external/toxcore/c-toxcore/other/docker/wasm/wasm.Dockerfile
vendored
Normal file
136
external/toxcore/c-toxcore/other/docker/wasm/wasm.Dockerfile
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ENV DEBIAN_FRONTEND="noninteractive"
|
||||
|
||||
# Install dependencies.
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||
autoconf \
|
||||
automake \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
libtool \
|
||||
make \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
python3 \
|
||||
unzip \
|
||||
wget \
|
||||
xz-utils \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /work/emsdk
|
||||
RUN git clone --depth=1 https://github.com/emscripten-core/emsdk /work/emsdk \
|
||||
&& ./emsdk install 4.0.3 \
|
||||
&& ./emsdk activate 4.0.3
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
WORKDIR /work
|
||||
|
||||
# Build libsodium.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& tar zxf <(curl -L https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20.tar.gz) \
|
||||
&& cd /work/libsodium-* \
|
||||
&& emconfigure ./configure \
|
||||
--prefix=/wasm \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--without-pthreads \
|
||||
--disable-ssp \
|
||||
--disable-asm \
|
||||
--disable-pie \
|
||||
&& emmake make -j"$(nproc)" \
|
||||
&& emmake make install \
|
||||
&& rm -rf /work/libsodium-*
|
||||
|
||||
# Build libvpx.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& tar zxf <(curl -L https://github.com/webmproject/libvpx/archive/v1.15.0.tar.gz) \
|
||||
&& cd /work/libvpx-* \
|
||||
&& emconfigure ./configure \
|
||||
--prefix=/wasm \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--target=generic-gnu \
|
||||
--disable-examples \
|
||||
--disable-tools \
|
||||
--disable-docs \
|
||||
--disable-unit-tests \
|
||||
--enable-pic \
|
||||
&& emmake make -j"$(nproc)" \
|
||||
&& emmake make install \
|
||||
&& rm -rf /work/libvpx-*
|
||||
|
||||
# Build opus.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& tar zxf <(curl -L https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz) \
|
||||
&& cd /work/opus-* \
|
||||
&& emconfigure ./configure \
|
||||
--prefix=/wasm \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--host wasm32-unknown-emscripten \
|
||||
--disable-extra-programs \
|
||||
--disable-doc \
|
||||
CFLAGS="-O3 -flto -fPIC" \
|
||||
&& emmake make -j"$(nproc)" \
|
||||
&& emmake make install \
|
||||
&& rm -rf /work/opus-*
|
||||
|
||||
# Build an unused binding without toxcore first so emcc caches all the system
|
||||
# libraries. This makes rebuilds of toxcore below much faster.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& mkdir -p /wasm/bin \
|
||||
&& emcc -O3 -flto \
|
||||
-s EXPORT_NAME=libtoxcore \
|
||||
-s MAIN_MODULE=1 \
|
||||
-s MALLOC=emmalloc \
|
||||
-s MODULARIZE=1 \
|
||||
-s STRICT=1 \
|
||||
-s WEBSOCKET_URL=ws:// \
|
||||
--no-entry \
|
||||
/wasm/lib/libopus.a \
|
||||
/wasm/lib/libsodium.a \
|
||||
/wasm/lib/libvpx.a \
|
||||
-o /wasm/bin/libtoxcore.js
|
||||
|
||||
ENV PKG_CONFIG_PATH="/wasm/lib/pkgconfig"
|
||||
|
||||
# Build c-toxcore.
|
||||
COPY . /work/c-toxcore
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& cd /work/c-toxcore \
|
||||
&& emcmake cmake \
|
||||
-B_build \
|
||||
-GNinja \
|
||||
-DCMAKE_INSTALL_PREFIX="/wasm" \
|
||||
-DCMAKE_C_FLAGS="-O3 -flto -fPIC" \
|
||||
-DCMAKE_UNITY_BUILD=ON \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DENABLE_SHARED=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
. \
|
||||
&& emmake cmake --build _build \
|
||||
&& emmake cmake --install _build
|
||||
|
||||
# Link together all the libraries.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& mkdir -p /wasm/bin \
|
||||
&& emcc -O3 -flto \
|
||||
-s EXPORT_NAME=libtoxcore \
|
||||
-s EXPORTED_RUNTIME_METHODS='["HEAPU8", "wasmExports"]' \
|
||||
-s MAIN_MODULE=1 \
|
||||
-s MALLOC=emmalloc \
|
||||
-s MODULARIZE=1 \
|
||||
-s STRICT=1 \
|
||||
-s WEBSOCKET_URL=ws:// \
|
||||
--no-entry \
|
||||
/wasm/lib/libopus.a \
|
||||
/wasm/lib/libsodium.a \
|
||||
/wasm/lib/libvpx.a \
|
||||
/wasm/lib/libtoxcore.a \
|
||||
-o /wasm/bin/libtoxcore.js
|
||||
RUN ls -lh /wasm/bin/libtoxcore.js /wasm/bin/libtoxcore.wasm
|
23
external/toxcore/c-toxcore/other/docker/wasm/wasm.Dockerfile.dockerignore
vendored
Normal file
23
external/toxcore/c-toxcore/other/docker/wasm/wasm.Dockerfile.dockerignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# ===== common =====
|
||||
# Ignore everything ...
|
||||
**/*
|
||||
# ... except sources
|
||||
!**/*.[ch]
|
||||
!**/*.cc
|
||||
!**/*.hh
|
||||
!CHANGELOG.md
|
||||
!LICENSE
|
||||
!README.md
|
||||
!auto_tests/data/*
|
||||
!other/bootstrap_daemon/bash-completion/**
|
||||
!other/bootstrap_daemon/tox-bootstrapd.*
|
||||
!other/proxy/*.mod
|
||||
!other/proxy/*.sum
|
||||
!other/proxy/*.go
|
||||
# ... and CMake build files (used by most builds).
|
||||
!**/CMakeLists.txt
|
||||
!.github/scripts/flags*.sh
|
||||
!cmake/*.cmake
|
||||
!other/pkgconfig/*
|
||||
!other/rpm/*
|
||||
!so.version
|
@ -1,85 +0,0 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ENV DEBIAN_FRONTEND="noninteractive"
|
||||
|
||||
# Install dependencies.
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||
autoconf \
|
||||
automake \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
libtool \
|
||||
make \
|
||||
ninja-build \
|
||||
pkg-config \
|
||||
python3 \
|
||||
unzip \
|
||||
wget \
|
||||
xz-utils \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /work/emsdk
|
||||
RUN git clone --depth=1 https://github.com/emscripten-core/emsdk /work/emsdk \
|
||||
&& ./emsdk install 3.1.3 \
|
||||
&& ./emsdk activate 3.1.3
|
||||
|
||||
# Build libsodium.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& git clone --depth=1 --branch=1.0.18 https://github.com/jedisct1/libsodium /work/libsodium \
|
||||
&& cd /work/libsodium \
|
||||
&& autoreconf -fi \
|
||||
&& emconfigure ./configure --disable-shared \
|
||||
--without-pthreads \
|
||||
--disable-ssp --disable-asm --disable-pie \
|
||||
--host x86_64-linux-gnu \
|
||||
&& emmake make install -j8
|
||||
|
||||
# Build an unused libsodium binding first so emcc caches all the system
|
||||
# libraries. This makes rebuilds of toxcore below much faster.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& mkdir -p /work/wasm \
|
||||
&& emcc -O3 -flto \
|
||||
--closure=1 \
|
||||
-s ALLOW_UNIMPLEMENTED_SYSCALLS=1 \
|
||||
-s EXPORT_NAME=libtoxcore \
|
||||
-s IGNORE_MISSING_MAIN=1 \
|
||||
-s MAIN_MODULE=1 \
|
||||
-s MALLOC=emmalloc \
|
||||
-s MODULARIZE=1 \
|
||||
-s STRICT=1 \
|
||||
-s WEBSOCKET_URL=wss:// \
|
||||
/usr/local/lib/libsodium.a \
|
||||
-o /work/wasm/libsodium.js
|
||||
|
||||
# Build c-toxcore.
|
||||
COPY . /work/c-toxcore
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& cd /work/c-toxcore \
|
||||
&& emcmake cmake -B_build -H. -GNinja \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="/usr/local" \
|
||||
-DCMAKE_C_FLAGS="-O3 -flto -fPIC" \
|
||||
-DBUILD_TOXAV=OFF \
|
||||
-DENABLE_SHARED=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DMIN_LOGGER_LEVEL=DEBUG \
|
||||
&& emmake cmake --build _build --parallel 8 --target install
|
||||
|
||||
# Build wasm bindings.
|
||||
RUN . "/work/emsdk/emsdk_env.sh" \
|
||||
&& mkdir -p /work/wasm \
|
||||
&& emcc -O3 -flto \
|
||||
--closure=1 \
|
||||
-s ALLOW_UNIMPLEMENTED_SYSCALLS=1 \
|
||||
-s EXPORT_NAME=libtoxcore \
|
||||
-s IGNORE_MISSING_MAIN=1 \
|
||||
-s MAIN_MODULE=1 \
|
||||
-s MALLOC=emmalloc \
|
||||
-s MODULARIZE=1 \
|
||||
-s STRICT=1 \
|
||||
-s WEBSOCKET_URL=wss:// \
|
||||
/usr/local/lib/libsodium.a \
|
||||
/usr/local/lib/libtoxcore.a \
|
||||
-o /work/wasm/libtoxcore.js
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
docker build -t toxchat/toxcore-js -f other/emscripten/Dockerfile .
|
@ -15,8 +15,8 @@ import (
|
||||
|
||||
const (
|
||||
debug = false
|
||||
httpAddr = ":8080"
|
||||
socks5Addr = ":8081"
|
||||
httpAddr = ":7080"
|
||||
socks5Addr = ":7081"
|
||||
)
|
||||
|
||||
func handleTunneling(w http.ResponseWriter, r *http.Request) {
|
||||
|
44
external/toxcore/c-toxcore/other/version-sync
vendored
44
external/toxcore/c-toxcore/other/version-sync
vendored
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
@ -13,25 +13,31 @@ update() {
|
||||
file="$SOURCE_DIR/$1"
|
||||
expr="$2"
|
||||
|
||||
sed -e "$expr" "$file" > "$file.updated-version"
|
||||
sed -e "$expr" "$file" >"$file.updated-version"
|
||||
if diff "$file" "$file.updated-version"; then
|
||||
rm "$file.updated-version"
|
||||
else
|
||||
# use cat > and rm instead of move to keep file permissions
|
||||
cat "$file.updated-version" > "$file"
|
||||
cat "$file.updated-version" >"$file"
|
||||
rm "$file.updated-version"
|
||||
fi
|
||||
}
|
||||
|
||||
update 'configure.ac' 's/AC_INIT(\[tox\], \[.*\])/AC_INIT([tox], ['$VER'])/'
|
||||
update 'configure.ac' 's/AC_INIT(\[tox\], \[.*\])/AC_INIT([tox], ['"$VER"'])/'
|
||||
|
||||
update 'toxcore/tox.api.h' 's/\(const VERSION_MAJOR *= \).*;/\1'$MAJOR';/'
|
||||
update 'toxcore/tox.api.h' 's/\(const VERSION_MINOR *= \).*;/\1'$MINOR';/'
|
||||
update 'toxcore/tox.api.h' 's/\(const VERSION_PATCH *= \).*;/\1'$PATCH';/'
|
||||
update 'toxcore/tox.h' 's/\(#define TOX_VERSION_MAJOR *\).*/\1'"$MAJOR"'/'
|
||||
update 'toxcore/tox.h' 's/\(#define TOX_VERSION_MINOR *\).*/\1'"$MINOR"'/'
|
||||
update 'toxcore/tox.h' 's/\(#define TOX_VERSION_PATCH *\).*/\1'"$PATCH"'/'
|
||||
|
||||
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MAJOR "\).*"/\1'$MAJOR'"/'
|
||||
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MINOR "\).*"/\1'$MINOR'"/'
|
||||
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_PATCH "\).*"/\1'$PATCH'"/'
|
||||
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MAJOR "\).*"/\1'"$MAJOR"'"/'
|
||||
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_MINOR "\).*"/\1'"$MINOR"'"/'
|
||||
update 'CMakeLists.txt' 's/\(PROJECT_VERSION_PATCH "\).*"/\1'"$PATCH"'"/'
|
||||
|
||||
update 'other/docker/pkgsrc/pkgsrc.Dockerfile' 's/\(COPY . \/work\/c-toxcore-\).*/\1'"$VER"'/'
|
||||
update 'other/docker/pkgsrc/pkgsrc.Dockerfile' 's/\(tar", "zcf", "c-toxcore.tar.gz", "c-toxcore-\).*/\1'"$VER"'"]/'
|
||||
|
||||
update 'other/docker/pkgsrc/pkgsrc.patch' 's/\(+DISTNAME=\ttoxcore-\).*/\1'"$VER"'/'
|
||||
update 'other/docker/pkgsrc/pkgsrc.patch' 's/\(+lib\/libtoxcore.so.\).*/\1'"$MINOR.$PATCH.0"'/'
|
||||
|
||||
#
|
||||
# calculating the SO version
|
||||
@ -64,14 +70,14 @@ update 'CMakeLists.txt' 's/\(PROJECT_VERSION_PATCH "\).*"/\1'$PATCH'"/'
|
||||
# this must be constant starting from the 1.0 release
|
||||
LAST_SOMAJOR=2
|
||||
|
||||
if [ $MAJOR -eq 0 ]; then
|
||||
if [ "$MAJOR" -eq 0 ]; then
|
||||
SOMAJOR=$MINOR
|
||||
SOMINOR=$PATCH
|
||||
|
||||
# update lastmajor above
|
||||
update 'other/version-sync' 's/^\(LAST_SOMAJOR=\).*/\1'$SOMAJOR'/'
|
||||
update 'other/version-sync' 's/^\(LAST_SOMAJOR=\).*/\1'"$SOMAJOR"'/'
|
||||
else
|
||||
SOMAJOR=$(expr $MAJOR + $LAST_SOMAJOR)
|
||||
SOMAJOR=$(("$MAJOR" + "$LAST_SOMAJOR"))
|
||||
SOMINOR=$MINOR
|
||||
fi
|
||||
|
||||
@ -115,16 +121,16 @@ fi
|
||||
# <=> major.minor.patch
|
||||
#
|
||||
|
||||
if [ $MAJOR -eq 0 ]; then
|
||||
LIBTOOL_CURRENT=$(expr $SOMAJOR + $SOMINOR)
|
||||
if [ "$MAJOR" -eq 0 ]; then
|
||||
LIBTOOL_CURRENT=$(("$SOMAJOR" + "$SOMINOR"))
|
||||
LIBTOOL_AGE=$SOMINOR
|
||||
LIBTOOL_REVISION=0
|
||||
else
|
||||
LIBTOOL_CURRENT=$(expr $SOMAJOR + $SOMINOR)
|
||||
LIBTOOL_CURRENT=$(("$SOMAJOR" + "$SOMINOR"))
|
||||
LIBTOOL_AGE=$SOMINOR
|
||||
LIBTOOL_REVISION=$PATCH
|
||||
fi
|
||||
|
||||
update 'so.version' 's/^\(CURRENT=\).*/\1'$LIBTOOL_CURRENT'/'
|
||||
update 'so.version' 's/^\(AGE=\).*/\1'$LIBTOOL_AGE'/'
|
||||
update 'so.version' 's/^\(REVISION=\).*/\1'$LIBTOOL_REVISION'/'
|
||||
update 'so.version' 's/^\(CURRENT=\).*/\1'"$LIBTOOL_CURRENT"'/'
|
||||
update 'so.version' 's/^\(AGE=\).*/\1'"$LIBTOOL_AGE"'/'
|
||||
update 'so.version' 's/^\(REVISION=\).*/\1'"$LIBTOOL_REVISION"'/'
|
||||
|
Reference in New Issue
Block a user