From fe74a79222ca5a34976e213f56ce6ef2ba15afff Mon Sep 17 00:00:00 2001 From: hbeni Date: Tue, 18 May 2021 15:23:04 +0200 Subject: [PATCH] Split off Win32 build into separate package Currently there is a mumble issue with the updater: https://github.com/mumble-voip/mumble/issues/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. --- client/mumble-plugin/fgcom-mumble.cpp | 2 +- client/mumble-plugin/lib/io_UDPClient.cpp | 4 ++-- client/mumble-plugin/lib/io_UDPServer.cpp | 12 ++++++------ client/mumble-plugin/lib/io_plugin.cpp | 2 +- client/mumble-plugin/lib/updater.cpp | 12 +++++++++++- client/mumble-plugin/makefile | 19 +++++++++++++++---- makefile | 4 ++-- 7 files changed, 38 insertions(+), 17 deletions(-) diff --git a/client/mumble-plugin/fgcom-mumble.cpp b/client/mumble-plugin/fgcom-mumble.cpp index db5c752d..d8344705 100644 --- a/client/mumble-plugin/fgcom-mumble.cpp +++ b/client/mumble-plugin/fgcom-mumble.cpp @@ -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) { diff --git a/client/mumble-plugin/lib/io_UDPClient.cpp b/client/mumble-plugin/lib/io_UDPClient.cpp index cc57eee6..ca085129 100644 --- a/client/mumble-plugin/lib/io_UDPClient.cpp +++ b/client/mumble-plugin/lib/io_UDPClient.cpp @@ -30,7 +30,7 @@ #include #include -#ifdef MINGW_WIN64 +#if defined(MINGW_WIN64) || defined(MINGW_WIN32) #include //#include //#include @@ -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); diff --git a/client/mumble-plugin/lib/io_UDPServer.cpp b/client/mumble-plugin/lib/io_UDPServer.cpp index 8b1a70c0..34e6a518 100644 --- a/client/mumble-plugin/lib/io_UDPServer.cpp +++ b/client/mumble-plugin/lib/io_UDPServer.cpp @@ -36,7 +36,7 @@ #include #include -#ifdef MINGW_WIN64 +#if defined(MINGW_WIN64) || defined(MINGW_WIN32) #include //#include //#include @@ -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); @@ -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; @@ -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())); @@ -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); diff --git a/client/mumble-plugin/lib/io_plugin.cpp b/client/mumble-plugin/lib/io_plugin.cpp index 57367b2a..6ed6cb26 100644 --- a/client/mumble-plugin/lib/io_plugin.cpp +++ b/client/mumble-plugin/lib/io_plugin.cpp @@ -40,7 +40,7 @@ #include #include -#ifdef MINGW_WIN64 +#if defined(MINGW_WIN64) || defined(MINGW_WIN32) #include //#include //#include diff --git a/client/mumble-plugin/lib/updater.cpp b/client/mumble-plugin/lib/updater.cpp index 864ac6ce..93959c7c 100644 --- a/client/mumble-plugin/lib/updater.cpp +++ b/client/mumble-plugin/lib/updater.cpp @@ -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 */ @@ -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. diff --git a/client/mumble-plugin/makefile b/client/mumble-plugin/makefile index f3ed4aa0..7179dea1 100644 --- a/client/mumble-plugin/makefile +++ b/client/mumble-plugin/makefile @@ -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) @@ -135,7 +135,7 @@ 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 @@ -143,15 +143,26 @@ release: clean-all test plugin plugin-win64 plugin-win32 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)* diff --git a/makefile b/makefile index d30324e9..20b2b2f6 100644 --- a/makefile +++ b/makefile @@ -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