diff --git a/.github/workflows/Mona.yml b/.github/workflows/Mona.yml index d482e99..5505f94 100644 --- a/.github/workflows/Mona.yml +++ b/.github/workflows/Mona.yml @@ -9,8 +9,8 @@ on: workflow_dispatch: jobs: - build-macOS-x64: - runs-on: macos-12 + build-macOS-arm: + runs-on: macos-15 steps: - uses: actions/checkout@master @@ -20,7 +20,7 @@ jobs: - name: Build run: | - make -j${nproc} + make -j$(sysctl -n hw.physicalcpu) mkdir -p MonaBin/MonaServer mkdir -p MonaBin/MonaBase/lib mkdir -p MonaBin/MonaCore/lib @@ -31,11 +31,11 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: MonaServer-macOS-x64 + name: MonaServer-macOS-arm path: MonaBin # TODO: Unit Tests don't work on mac for some reason - # - name: Unit Tests + #- name: Unit Tests # run: | # ./UnitTests -m=all # cat UnitTests.log/0.log @@ -88,11 +88,11 @@ jobs: run: | git clone https://github.com/LuaJIT/LuaJIT.git cd LuaJIT - make -j${nproc} && sudo make install + make -j$(nproc) && sudo make install - name: Build run: | - make -j${nproc} + make -j$(nproc) mkdir -p MonaBin/MonaServer mkdir -p MonaBin/MonaBase/lib mkdir -p MonaBin/MonaCore/lib diff --git a/MonaBase/Makefile b/MonaBase/Makefile index dcc498a..dec99b1 100644 --- a/MonaBase/Makefile +++ b/MonaBase/Makefile @@ -10,11 +10,18 @@ endif CXX?=g++ # Variables extendable -override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-exceptions -override INCLUDES+=-I./include/ -I/usr/local/opt/openssl/include/ +override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-deprecated-declarations -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-exceptions +override INCLUDES+=-I./include/ override LIBS+=-lcrypto -lssl -ifneq ("$(wildcard /usr/local/opt/openssl/lib/)","") - override LIBDIRS+=-L/usr/local/opt/openssl/lib/ +ifeq ($(OS),Darwin) + ifneq ("$(wildcard $(shell brew --prefix openssl)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix openssl)/lib/ + override CFLAGS+=-I$(shell brew --prefix openssl)/include/ + endif + ifneq ("$(wildcard $(shell brew --prefix luajit)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix luajit)/lib/ + override CFLAGS+=-I$(shell brew --prefix luajit)/include/ + endif endif ifdef ENABLE_SRT override CFLAGS += -DENABLE_SRT diff --git a/MonaBase/include/Mona/Exceptions.h b/MonaBase/include/Mona/Exceptions.h index 1140089..7fb3a8c 100644 --- a/MonaBase/include/Mona/Exceptions.h +++ b/MonaBase/include/Mona/Exceptions.h @@ -19,6 +19,7 @@ details (or else see http://mozilla.org/MPL/2.0/). #include "Mona/Mona.h" #include "Mona/String.h" #include "assert.h" +#include namespace Mona { diff --git a/MonaBase/include/Mona/UnitTest.h b/MonaBase/include/Mona/UnitTest.h index 86eb74b..faa943f 100644 --- a/MonaBase/include/Mona/UnitTest.h +++ b/MonaBase/include/Mona/UnitTest.h @@ -18,6 +18,7 @@ details (or else see http://mozilla.org/MPL/2.0/). #include "Mona/Application.h" #include "Mona/Stopwatch.h" +#include namespace Mona { diff --git a/MonaCore/Makefile b/MonaCore/Makefile index 83e5561..25f454d 100644 --- a/MonaCore/Makefile +++ b/MonaCore/Makefile @@ -10,12 +10,19 @@ endif CXX?=g++ # Variables extendable -override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-overloaded-virtual -Wno-potentially-evaluated-expression -Wno-switch-bool -Wno-exceptions -override INCLUDES+=-I./../MonaBase/include/ -I./include/ -I/usr/local/opt/openssl/include/ +override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-deprecated-declarations -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-overloaded-virtual -Wno-potentially-evaluated-expression -Wno-switch-bool -Wno-exceptions +override INCLUDES+=-I./../MonaBase/include/ -I./include/ override LIBDIRS+=-L./../MonaBase/lib/ override LIBS+=-lMonaBase -lcrypto -lssl -ifneq ("$(wildcard /usr/local/opt/openssl/lib/)","") - override LIBDIRS+=-L/usr/local/opt/openssl/lib/ +ifeq ($(OS),Darwin) + ifneq ("$(wildcard $(shell brew --prefix openssl)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix openssl)/lib/ + override CFLAGS+=-I$(shell brew --prefix openssl)/include/ + endif + ifneq ("$(wildcard $(shell brew --prefix luajit)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix luajit)/lib/ + override CFLAGS+=-I$(shell brew --prefix luajit)/include/ + endif endif ifdef ENABLE_SRT override CFLAGS += -DENABLE_SRT diff --git a/MonaCore/sources/RTMFP/RTMFP.cpp b/MonaCore/sources/RTMFP/RTMFP.cpp index 2129cec..b0c0711 100644 --- a/MonaCore/sources/RTMFP/RTMFP.cpp +++ b/MonaCore/sources/RTMFP/RTMFP.cpp @@ -119,9 +119,11 @@ bool RTMFP::Send(Socket& socket, const Packet& packet, const SocketAddress& addr } bool RTMFP::Engine::decode(Exception& ex, Buffer& buffer, const SocketAddress& address) { - static UInt8 IV[KEY_SIZE]; + static UInt8 IV[KEY_SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + EVP_CIPHER_CTX_reset(_context); EVP_CipherInit_ex(_context, EVP_aes_128_cbc(), NULL, _key, IV, 0); - int temp; + EVP_CIPHER_CTX_set_padding(_context, 0); + int temp = buffer.size(); EVP_CipherUpdate(_context, buffer.data(), &temp, buffer.data(), buffer.size()); // Check CRC BinaryReader reader(buffer.data(), buffer.size()); diff --git a/MonaServer/Makefile b/MonaServer/Makefile index 08af517..447e63e 100644 --- a/MonaServer/Makefile +++ b/MonaServer/Makefile @@ -17,8 +17,8 @@ else endif # Variables extendable -override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-unused-value -Wno-exceptions -override INCLUDES+=-I../MonaBase/include/ -I../MonaCore/include/ -I../ -I/usr/local/opt/openssl/include/ +override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-deprecated-declarations -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-unused-value -Wno-exceptions +override INCLUDES+=-I../MonaBase/include/ -I../MonaCore/include/ -I../ override LIBDIRS+=-L../MonaBase/lib/ -L../MonaCore/lib/ override LDFLAGS+="$(EXE_LINKER_FLAGS),-rpath,../MonaBase/lib/,-rpath,../MonaCore/lib/,-rpath,/usr/local/lib/,-rpath,/usr/local/lib64/" override LIBS+=-pthread -lMonaBase -lMonaCore -lcrypto -lssl -lluajit-5.1 @@ -29,8 +29,15 @@ endif ifneq ($(shell ldconfig -p | grep libatomic),) override LIBS += -latomic endif -ifneq ("$(wildcard /usr/local/opt/openssl/lib/)","") - override LIBDIRS+=-L/usr/local/opt/openssl/lib/ +ifeq ($(OS),Darwin) + ifneq ("$(wildcard $(shell brew --prefix openssl)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix openssl)/lib/ + override CFLAGS+=-I$(shell brew --prefix openssl)/include/ + endif + ifneq ("$(wildcard $(shell brew --prefix luajit)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix luajit)/lib/ + override CFLAGS+=-I$(shell brew --prefix luajit)/include/ + endif endif ifneq ($(OS),FreeBSD) override LIBS+= -ldl diff --git a/MonaTiny/Makefile b/MonaTiny/Makefile index ad9bf95..d48d38b 100644 --- a/MonaTiny/Makefile +++ b/MonaTiny/Makefile @@ -17,8 +17,8 @@ else endif # Variables extendable -override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-exceptions -override INCLUDES+=-I../MonaBase/include/ -I../MonaCore/include/ -I../ -I/usr/local/opt/openssl/include/ +override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-deprecated-declarations -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-exceptions +override INCLUDES+=-I../MonaBase/include/ -I../MonaCore/include/ -I../ override LIBDIRS+=-L../MonaBase/lib/ -L../MonaCore/lib/ override LDFLAGS+="$(EXE_LINKER_FLAGS),-rpath,../MonaBase/lib/,-rpath,../MonaCore/lib/,-rpath,/usr/local/lib/,-rpath,/usr/local/lib64/" override LIBS+=-pthread -lMonaBase -lMonaCore -lcrypto -lssl @@ -29,8 +29,15 @@ endif ifneq ($(shell ldconfig -p | grep libatomic),) override LIBS += -latomic endif -ifneq ("$(wildcard /usr/local/opt/openssl/lib/)","") - override LIBDIRS+=-L/usr/local/opt/openssl/lib/ +ifeq ($(OS),Darwin) + ifneq ("$(wildcard $(shell brew --prefix openssl)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix openssl)/lib/ + override CFLAGS+=-I$(shell brew --prefix openssl)/include/ + endif + ifneq ("$(wildcard $(shell brew --prefix luajit)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix luajit)/lib/ + override CFLAGS+=-I$(shell brew --prefix luajit)/include/ + endif endif ifneq ($(OS),FreeBSD) override LIBS+= -ldl diff --git a/UnitTests/Makefile b/UnitTests/Makefile index 1510a7b..a1bd3e0 100644 --- a/UnitTests/Makefile +++ b/UnitTests/Makefile @@ -11,8 +11,8 @@ CXX?=g++ EXEC?=UnitTests # Variables extendable -override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-exceptions -override INCLUDES+=-I../MonaBase/include/ -I../ -I/usr/local/opt/openssl/include/ +override CFLAGS+=-D_GLIBCXX_USE_C99 -std=c++14 -D__BIG_ENDIAN__=$(BIG_ENDIAN) -D_FILE_OFFSET_BITS=64 -Wall -Wno-deprecated-declarations -Wno-reorder -Wno-terminate -Wunknown-pragmas -Wno-unknown-warning-option -Wno-exceptions +override INCLUDES+=-I../MonaBase/include/ -I../ override LIBDIRS+=-L../MonaBase/lib/ override LDFLAGS+="-Wl,-rpath,$(CURDIR)/../MonaBase/lib/,-rpath,/usr/local/lib/,-rpath,/usr/local/lib64/" override LIBS+=-pthread -lMonaBase -lcrypto -lssl @@ -23,8 +23,15 @@ endif ifneq ($(shell ldconfig -p | grep libatomic),) override LIBS += -latomic endif -ifneq ("$(wildcard /usr/local/opt/openssl/lib/)","") - override LIBDIRS+=-L/usr/local/opt/openssl/lib/ +ifeq ($(OS),Darwin) + ifneq ("$(wildcard $(shell brew --prefix openssl)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix openssl)/lib/ + override CFLAGS+=-I$(shell brew --prefix openssl)/include/ + endif + ifneq ("$(wildcard $(shell brew --prefix luajit)/lib/)","") + override LIBDIRS+=-L$(shell brew --prefix luajit)/lib/ + override CFLAGS+=-I$(shell brew --prefix luajit)/include/ + endif endif ifneq ($(OS),FreeBSD) override LIBS+= -ldl