From f39c160db9904830dff0b88ff25a4999c1febbf8 Mon Sep 17 00:00:00 2001 From: lyubod Date: Tue, 7 Oct 2014 05:45:51 +0300 Subject: [PATCH 1/8] Create osx_build_script_toxcore.txt OS X shell script to do everything from git pull to sudo make install for toxcore, after dependencies have already been installed, by MacPorts, from source, etc. --- osx_build_script_toxcore.txt | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 osx_build_script_toxcore.txt diff --git a/osx_build_script_toxcore.txt b/osx_build_script_toxcore.txt new file mode 100644 index 00000000..8aea0d1c --- /dev/null +++ b/osx_build_script_toxcore.txt @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# written by Lubo Diakov +# hard coded toxcore directory, replace with other path or variable as needed +cd ~/Downloads/toxcore +echo "Now working in:"`pwd` + +# must have working git binary, and have done git clone at least once before +git pull +echo "If git pull responds: Already up-to-date. you can cancel the build" +echo "by typing anything except y or Y below" +read -p "Continue with build? (enter y to continue): " Last_Chance + +# blah blah +if [[ $Last_Chance = [Yy] ]]; then echo "Continuing!"; +else echo "Aborted!"; exit +fi +sleep 3 + +# if libsodium is built with macports, link it from /opt/local/ to /usr/local +if [ ! -L "/usr/local/lib/libsodium.dylib" ]; then + # Control will enter here if $DIRECTORY doesn't exist. + ln -s /opt/local/lib/libsodium.dylib /usr/local/lib/libsodium.dylib +fi +echo "The symlink /usr/local/lib/libsodium.dylib exists." +sleep 3 + +# replace ppc, i386 as needed. +./configure CC="gcc -arch ppc -arch i386" CXX="g++ -arch ppc -arch i386" CPP="gcc -E" CXXCPP="g++ -E" + +# get rid of prior builds, start clean +make clean +make +echo "" +echo "Sudo is required for make install only, all other steps run without it." +echo "Please type your sudo password below for make install:" +sudo make install + +exit From 660843c873725ba1bd90e6af2c61ba18135eee3d Mon Sep 17 00:00:00 2001 From: lyubod Date: Tue, 7 Oct 2014 05:52:09 +0300 Subject: [PATCH 2/8] Update INSTALL.md Added MacPorts related info. to Section heading "OS X Non-homebrew" --- INSTALL.md | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 824cfb5f..17e23f29 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -152,12 +152,31 @@ Grab the following packages: * https://gnu.org/software/automake/ * https://github.com/jedisct1/libsodium * http://check.sourceforge.net/ - * http://yasm.tortall.net/Download.html + * http://yasm.tortall.net/Download.html (install before libvpx) * https://code.google.com/p/webm/downloads/list * http://www.opus-codec.org/downloads/ * http://www.freedesktop.org/wiki/Software/pkg-config/ -You must install yasm before installing libvpx, otherwise libvpx will fail to make correctly. +Macports: (https://www.macports.org/) +All toxcore dependencies can be installed from MacPorts. This is often easier on PowerPC Macs, and any version of OS X prior to 10.6, since Homebrew is supported on 10.6 and up, but not much (or at all) on older systems. A few have slightly different package names from the corresponding package in Debian. + +Same: libtool autoconf automake libsodium check yasm +Different: libvpx (webm) libopus pkgconfig gettext + +(the libintl, from gettext, built into OS X 10.5 is missing libintl_setlocale, but the Macports build has it) + +Verify where libintl is on your system: (MacPorts puts it in /opt/local) +$ for d in /usr/local/lib /opt/local/lib /usr/lib /lib; do ls -l $d/libintl.*; done + +Check if that copy has libintl_setlocale: +nm /opt/local/lib/libintl.8.dylib | grep _libintl_setlocale + +Certain other tools may not be installed, or outdated, and should also be installed from MacPorts for simplicity: git cmake + +If libsodium was installed with MacPorts, you may want to symlink the copy in /opt/local/lib to /usr/local/lib. That way you don't need special configure switches for toxcore to find libsodium, and every time MacPorts updates libsodium, the new version will be linked to toxcore every time you build: +ln -s /opt/local/lib/libsodium.dylib /usr/local/lib/libsodium.dylib + +Much of the build can then be done as for other platforms: git clone, and so on. Differences will be noted with (OS X 10.5 specific) pkg-config is important for enabling a/v support in tox core, failure to install pkg-config will prevent tox core form finding the required libopus/libvpx libraries. (pkg-config may not configure properly, if you get an error about GLIB, run configure with the following parameter, --with-internal-glib). @@ -174,9 +193,21 @@ Compiling and installing Tox Core ```bash cd toxcore autoreconf -i -./configure +./configure (OS X 10.5 specific) +./configure CC="gcc -arch ppc -arch i386" CXX="g++ -arch ppc -arch i386" CPP="gcc -E" CXXCPP="g++ -E" make -make install +make install (OS X 10.5 specific) +should be: sudo make install +If it worked, you should have all the toxcore dylibs in /usr/local/lib: (besides the four below, the rest are symlinks to these) +$ ls -la /usr/local/lib/libtox*.dylib +libtoxav.0.dylib +libtoxcore.0.dylib +libtoxdns.0.dylib +libtoxencryptsave.0.dylib +to check what CPU architecture they're compiled for: +$ lipo -i /usr/local/lib/libtoxencryptsave.0.dylib +You should now be able to move on to compiling Toxic/Venom or some other client application +There is also a shell script called "osx_build_script_toxcore.txt" which automates everything from "git pull" to "sudo make install", once the dependencies are already taken care of by MacPorts. ``` If after running ./configure you get an error about core being unable to find libsodium (and you have installed it) run the following in place of ./configure; From eaf15bfb8901dbc0771cfe6228c17efe7b1405a8 Mon Sep 17 00:00:00 2001 From: lyubod Date: Tue, 7 Oct 2014 06:41:22 +0300 Subject: [PATCH 3/8] Update INSTALL.md --- INSTALL.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 17e23f29..14d2ef67 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -158,9 +158,12 @@ Grab the following packages: * http://www.freedesktop.org/wiki/Software/pkg-config/ Macports: (https://www.macports.org/) -All toxcore dependencies can be installed from MacPorts. This is often easier on PowerPC Macs, and any version of OS X prior to 10.6, since Homebrew is supported on 10.6 and up, but not much (or at all) on older systems. A few have slightly different package names from the corresponding package in Debian. +All toxcore dependencies can be installed from MacPorts. This is often easier on PowerPC Macs, +and any version of OS X prior to 10.6, since Homebrew is supported on 10.6 and up, but not much +(or at all) on older systems. A few packages have slightly different names from the corresponding +package in Debian. -Same: libtool autoconf automake libsodium check yasm +Same: libtool autoconf automake libsodium check yasm Different: libvpx (webm) libopus pkgconfig gettext (the libintl, from gettext, built into OS X 10.5 is missing libintl_setlocale, but the Macports build has it) From 429024116308e0d85ac543ebca8d5cc1a6382408 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Tue, 7 Oct 2014 00:49:28 -0400 Subject: [PATCH 4/8] Made toxdns header cpp-friendly --- toxdns/toxdns.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/toxdns/toxdns.h b/toxdns/toxdns.h index 90b74281..06071b82 100644 --- a/toxdns/toxdns.h +++ b/toxdns/toxdns.h @@ -24,6 +24,10 @@ #ifndef TOXDNS_H #define TOXDNS_H +#ifdef __cplusplus +extern "C" { +#endif + #include /* Clients are encouraged to set this as the maximum length names can have. */ @@ -85,4 +89,8 @@ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len, uint32_t request_id); +#ifdef __cplusplus +} +#endif + #endif From 366e737c360e5e3a2b0dbfd0cdbe4f444bce067e Mon Sep 17 00:00:00 2001 From: "A. L'mao" Date: Tue, 7 Oct 2014 16:14:31 -0700 Subject: [PATCH 5/8] readme.md: "goals of tox" -> "goals with tox" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fab45653..9945028c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Every peer is represented as a [byte string][String] (the public key [Tox ID] of ## Q&A: -### What are your goals of Tox? +### What are your goals with Tox? We want Tox to be as simple as possible while remaining as secure as possible. From d80ee91ae77d0b852c685604b71774b6ee88cc2d Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 9 Oct 2014 15:49:56 -0400 Subject: [PATCH 6/8] Relay peer kill messages too. --- toxcore/group.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/toxcore/group.c b/toxcore/group.c index a71bd5cf..84d7d2bb 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -1437,12 +1437,9 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const if (peer_number == kill_peer_number) { delpeer(g_c, groupnumber, index); - return; } else { //TODO } - - return; } break; From 532ace635a095d4613e37f880b573ad126671aef Mon Sep 17 00:00:00 2001 From: Sean Qureshi Date: Fri, 10 Oct 2014 18:09:52 -0700 Subject: [PATCH 7/8] Enable IPv6, fix systemd PID bug --- other/bootstrap_daemon/tox-bootstrapd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c index e4cadb35..0848cd17 100644 --- a/other/bootstrap_daemon/tox-bootstrapd.c +++ b/other/bootstrap_daemon/tox-bootstrapd.c @@ -53,7 +53,7 @@ #define DAEMON_NAME "tox-bootstrapd" -#define DAEMON_VERSION_NUMBER 2014081600UL // yyyymmmddvv format: yyyy year, mm month, dd day, vv version change count for that day +#define DAEMON_VERSION_NUMBER 2014101000UL // yyyymmmddvv format: yyyy year, mm month, dd day, vv version change count for that day #define SLEEP_TIME_MILLISECONDS 30 #define sleep usleep(1000*SLEEP_TIME_MILLISECONDS) @@ -61,7 +61,7 @@ #define DEFAULT_PID_FILE_PATH "tox-bootstrapd.pid" #define DEFAULT_KEYS_FILE_PATH "tox-bootstrapd.keys" #define DEFAULT_PORT 33445 -#define DEFAULT_ENABLE_IPV6 0 // 1 - true, 0 - false +#define DEFAULT_ENABLE_IPV6 1 // 1 - true, 0 - false #define DEFAULT_ENABLE_LAN_DISCOVERY 1 // 1 - true, 0 - false #define DEFAULT_ENABLE_TCP_RELAY 1 // 1 - true, 0 - false #define DEFAULT_TCP_RELAY_PORTS 443, 3389, 33445 // comma-separated list of ports. make sure to adjust DEFAULT_TCP_RELAY_PORTS_COUNT accordingly @@ -616,7 +616,7 @@ int main(int argc, char *argv[]) pid_t pid = fork(); if (pid > 0) { - fprintf(pidf, "%d ", pid); + fprintf(pidf,"%d", pid); fclose(pidf); syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid); return 0; From 2df986f6b951aee49f403ff076f213213ce873eb Mon Sep 17 00:00:00 2001 From: Sean Qureshi Date: Fri, 10 Oct 2014 18:23:23 -0700 Subject: [PATCH 8/8] Does a realloc with a size of 0 if every port is invalid --- other/bootstrap_daemon/tox-bootstrapd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c index 0848cd17..a0f93bb3 100644 --- a/other/bootstrap_daemon/tox-bootstrapd.c +++ b/other/bootstrap_daemon/tox-bootstrapd.c @@ -210,7 +210,9 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int } // the loop above skips invalid ports, so we adjust the allocated memory size - *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); + if ((*tcp_relay_port_count) * sizeof(uint16_t) > 0) { + *tcp_relay_ports = realloc(*tcp_relay_ports, (*tcp_relay_port_count) * sizeof(uint16_t)); + } } // Gets general config options