Skip to content

Commit

Permalink
Split off Win32 build into separate package
Browse files Browse the repository at this point in the history
Currently there is a mumble issue with the updater: mumble-voip/mumble#4946
It will break updates on windows when there is more than one *.dll in the ZIP-package.
Therefore the (rarely needed) WIN32 package is split off, the updater is now also aware of this
and try to download a '-win32.zip' with the 32 bit windows build.

Once the mumble bug was fixed, we can revert back to include the win32 binary into the normal package.
(see details in the plugin makefile comment)
For now we need to publish the 32bit zip separately.
  • Loading branch information
hbeni committed May 18, 2021
1 parent 6f5e5a9 commit fe74a79
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/mumble-plugin/fgcom-mumble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ mumble_error_t fgcom_loadConfig() {

// Try to get config file from home dir
char* pHomeDir;
#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
std::string dirSep = "\\";
pHomeDir = getenv("USERPROFILE");
if (pHomeDir) {
Expand Down
4 changes: 2 additions & 2 deletions client/mumble-plugin/lib/io_UDPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <regex>
#include <sys/types.h>

#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
#include <winsock2.h>
//#include <windows.h>
//#include <ws2tcpip.h>
Expand Down Expand Up @@ -181,7 +181,7 @@ void fgcom_spawnUDPClient() {

//bzero(&(remoteServAddr.sin_zero), 8); /* zero the rest of the struct */
remoteServAddr.sin_port = htons(lcl.clientTgtPort);
#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
remoteServAddr.sin_addr.s_addr = inet_addr(lcl.clientHost.c_str());
#else
int pton_rc = inet_pton(AF_INET, lcl.clientHost.c_str(), &remoteServAddr.sin_addr);
Expand Down
12 changes: 6 additions & 6 deletions client/mumble-plugin/lib/io_UDPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <sys/types.h>
#include <math.h>

#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
#include <winsock2.h>
//#include <windows.h>
//#include <ws2tcpip.h>
Expand Down Expand Up @@ -543,7 +543,7 @@ void fgcom_spawnUDPServer() {
char buffer[MAXLINE];
struct sockaddr_in servaddr, cliaddr;

#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
// init WinSock
WSADATA wsa;
int winsockInitRC = WSAStartup(MAKEWORD(2,0),&wsa);
Expand Down Expand Up @@ -607,7 +607,7 @@ void fgcom_spawnUDPServer() {
udpServerRunning = true;
while (!fgcom_udp_shutdowncmd) {
len = sizeof(cliaddr); //len is value/result
#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
int recvfrom_flags = 0; //MSG_WAITALL not supported with UDP on windows (gives error 10045 WSAEOPNOTSUPP)
#else
int recvfrom_flags = MSG_WAITALL;
Expand All @@ -618,7 +618,7 @@ void fgcom_spawnUDPServer() {
recvfrom_flags, ( struct sockaddr *) &cliaddr, &len);
if (n < 0) {
// SOCKET_ERROR returned
#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
//details for windows error codes: https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom
wprintf(L"recvfrom failed with error %d\n", WSAGetLastError());
pluginLog("[UDP-server] SOCKET_ERROR="+std::to_string(n)+" in nf-winsock-recvfrom()="+std::to_string(WSAGetLastError()));
Expand Down Expand Up @@ -713,13 +713,13 @@ void fgcom_shutdownUDPServer() {
// and stores it as sin_addr
// see: https://beej.us/guide/bgnet/html/
if (fgcom_cfg.udpServerHost == "*") {
#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
server_address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
#else
inet_pton(AF_INET, "127.0.0.1", &server_address.sin_addr);
#endif
} else {
#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
server_address.sin_addr.s_addr = inet_addr(fgcom_cfg.udpServerHost.c_str());
#else
inet_pton(AF_INET, fgcom_cfg.udpServerHost.c_str(), &server_address.sin_addr);
Expand Down
2 changes: 1 addition & 1 deletion client/mumble-plugin/lib/io_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <chrono>
#include <iomanip>

#ifdef MINGW_WIN64
#if defined(MINGW_WIN64) || defined(MINGW_WIN32)
#include <winsock2.h>
//#include <windows.h>
//#include <ws2tcpip.h>
Expand Down
12 changes: 11 additions & 1 deletion client/mumble-plugin/lib/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ using namespace httplib;
//using json = nlohmann::json;


// Naming components of the download asset:
// name + version + postfix + extension
// fgcom-mumble-0.14.0-win32.zip
std::string fgcom_asset_name("fgcom-mumble-");
std::string fgcom_bin_extension(".zip");
#ifdef MINGW_WIN32
std::string fgcom_bin_postfix("-win32");
#else
std::string fgcom_bin_postfix("");
#endif


/* Version struct */
Expand Down Expand Up @@ -184,7 +194,7 @@ void fgcom_getLatestReleaseFromGithub_Web() {
+ "." + std::to_string(fgcom_release_latest.version.minor)
+ "." + std::to_string(fgcom_release_latest.version.patch);
//fgcom_release_latest.downUrl = dlurlbase+"/fgcom-mumble-client-binOnly-"+verStr+".zip";
fgcom_release_latest.downUrl = dlurlbase+"/fgcom-mumble-"+verStr+".zip";
fgcom_release_latest.downUrl = dlurlbase+"/"+fgcom_asset_name+verStr+fgcom_bin_postfix+fgcom_bin_extension;
// ^^ NOTICE: In the future the mumble plugin updater may need a specially prepared binary zip release file.
// Currently this is not the case, and the updater traverses the ZIP he's given to find a matching
// Shared library object for the operating system.
Expand Down
19 changes: 15 additions & 4 deletions client/mumble-plugin/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ plugin-win64-only:
$(CC_WIN) -fPIC --shared -DMINGW_WIN64 -o fgcom-mumble.dll lib/io_plugin.cpp lib/radio_model.cpp lib/audio.cpp lib/io_UDPServer.cpp lib/io_UDPClient.cpp lib/garbage_collector.cpp fgcom-mumble.cpp $(SSLFLAGS_WIN) $(CFLAGS_WIN) $(THREADS_WIN)

plugin-win32-only:
$(CC_WIN32) -m32 -fPIC --shared -DMINGW_WIN64 -o fgcom-mumble-x86_32.dll lib/io_plugin.cpp lib/radio_model.cpp lib/audio.cpp lib/io_UDPServer.cpp lib/io_UDPClient.cpp lib/garbage_collector.cpp fgcom-mumble.cpp $(SSLFLAGS_WIN) $(CFLAGS_WIN) $(THREADS_WIN)
$(CC_WIN32) -m32 -fPIC --shared -DMINGW_WIN32 -o fgcom-mumble-x86_32.dll lib/io_plugin.cpp lib/radio_model.cpp lib/audio.cpp lib/io_UDPServer.cpp lib/io_UDPClient.cpp lib/garbage_collector.cpp fgcom-mumble.cpp $(SSLFLAGS_WIN) $(CFLAGS_WIN) $(THREADS_WIN)


# OpenSSL (static build)
Expand Down Expand Up @@ -135,23 +135,34 @@ release: clean-all test plugin plugin-win64 plugin-win32
@echo Version: $(VERSION) \($(GITCOMMIT) $(GITDATE)\) >> releaseReadme.md
tail +2 ../../README.md >> releaseReadme.md

# Linux + Windows combined
# Linux + Windows64 combined
mkdir fgcom-mumble-client-$(VERSION)
mkdir fgcom-mumble-client-$(VERSION)/mumble-plugin
rm -f fgcom-mumble-*.zip
cp releaseReadme.md fgcom-mumble-client-$(VERSION)/README.md
cp ../../LICENSE ../../README-de_DE.md ../../Readme.architecture.md ../plugin.spec.md fgcom-mumble-client-$(VERSION)/
cp fgcom-mumble*.so fgcom-mumble-client-$(VERSION)/mumble-plugin
cp fgcom-mumble.dll fgcom-mumble-client-$(VERSION)/mumble-plugin
cp fgcom-mumble-x86_32.dll fgcom-mumble-client-$(VERSION)/mumble-plugin
cp fgcom-mumble.ini fgcom-mumble-client-$(VERSION)/mumble-plugin
zip -r fgcom-mumble-client-$(VERSION).zip fgcom-mumble-client-$(VERSION)
rm -rf fgcom-mumble-client-$(VERSION)

# Make a package containing the win32 binary
# INFO: needed because the current mumble updater can't handle more than one DLL in the ZIP.
# See https://github.com/mumble-voip/mumble/issues/4946 for details.
# Once this is fixed, we can include the dll into the normal zip again, for making this happen,
# adjust the lines here and revise the updater to always fetch the normal zip (see naming components there).
cp -r fgcom-mumble-client-$(VERSION) fgcom-mumble-$(VERSION)-win32
rm fgcom-mumble-$(VERSION)-win32/mumble-plugin/*
cp fgcom-mumble-x86_32.dll fgcom-mumble-$(VERSION)-win32/mumble-plugin
zip -r fgcom-mumble-$(VERSION)-win32.zip fgcom-mumble-$(VERSION)-win32
rm -rf fgcom-mumble-$(VERSION)-win32

# Just a binary package for the mumble updater
# Note: this ZIP may has a special format
zip fgcom-mumble-client-binOnly-$(VERSION).zip fgcom-mumble.so fgcom-mumble.dll fgcom-mumble-x86_32.dll

# cleanup
rm -rf fgcom-mumble-client-$(VERSION)
rm releaseReadme.md
@echo "\nPluginrelease $(VERSION) built successfully:"
@ls -alh *$(VERSION)*
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ package:
@echo "PLUGINVER: $(PLUGINVER)"
@echo "RADIOGUIVER: $(RADIOGUIVER)"
@echo "FGFSADDONVER: $(FGFSADDONVER)"
@ls -alh fgcom-mumble-$(PLUGINVER).zip fgcom-mumble-client-*$(PLUGINVER)*.zip fgcom-mumble-server-*$(PLUGINVER)*.zip fgcom-mumble-radioGUI-*$(RADIOGUIVER)*.zip fgcom-mumble-fgfs-addon-*$(FGFSADDONVER)*.zip
@md5sum fgcom-mumble-$(PLUGINVER).zip fgcom-mumble-client-*$(PLUGINVER)*.zip fgcom-mumble-server-*$(PLUGINVER)*.zip fgcom-mumble-radioGUI-*$(RADIOGUIVER)*.zip fgcom-mumble-fgfs-addon-*$(FGFSADDONVER)*.zip
@ls -alh fgcom-mumble-$(PLUGINVER)*.zip fgcom-mumble-server-*$(PLUGINVER)*.zip fgcom-mumble-radioGUI-*$(RADIOGUIVER)*.zip fgcom-mumble-fgfs-addon-*$(FGFSADDONVER)*.zip
@md5sum fgcom-mumble-$(PLUGINVER)*.zip fgcom-mumble-server-*$(PLUGINVER)*.zip fgcom-mumble-radioGUI-*$(RADIOGUIVER)*.zip fgcom-mumble-fgfs-addon-*$(FGFSADDONVER)*.zip

release-plugin:
# Delegate build plugin release
Expand Down

0 comments on commit fe74a79

Please sign in to comment.