-
Notifications
You must be signed in to change notification settings - Fork 7
feat(windows): add support for winsparkle updates
#911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6513543
feat(windows): add support for `winsparkle` updates
aanorbel 19ca2dd
chore: update feed url
aanorbel f9f9754
chore: update ci workflow
aanorbel 1e00199
chore: use actual app version
aanorbel bbaea94
chore: fix loading for `WinSparkle.dll`
aanorbel ae4059a
Merge branch 'feat/win-sparkle-updates' of https://github.com/ooni/pr…
aanorbel 5807a20
chore: add method separations based on review
aanorbel 8cce783
chore: update url scheme
aanorbel f8d334d
chore: update formatting
aanorbel 0bd08fd
chore: update code and reduce translatable strings
aanorbel a865d07
chore: remove conveyor conf
aanorbel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,81 +1,110 @@ | ||
| # Makefile for NetworkTypeFinder JNI Bridge | ||
| # Makefile for NetworkTypeFinder and UpdateBridge JNI Bridges | ||
|
|
||
| # Variables | ||
| COMPILER = clang | ||
| FILES = c/NetworkTypeFinder.m | ||
| LIBRARY_NAME = networktypefinder | ||
| LIBRARY_FILE_MAC = lib$(LIBRARY_NAME).dylib | ||
| LIBRARY_FILE_LINUX = lib$(LIBRARY_NAME).so | ||
| NETWORK_FILES = c/NetworkTypeFinder.m | ||
| UPDATE_FILES_MAC = c/UpdateBridge.c | ||
| UPDATE_FILES_WIN = c/UpdateBridge.c c/WinSparkleBridge.c | ||
| NETWORK_LIBRARY_NAME = networktypefinder | ||
| UPDATE_LIBRARY_NAME = updatebridge | ||
| NETWORK_LIBRARY_FILE_MAC = lib$(NETWORK_LIBRARY_NAME).dylib | ||
| NETWORK_LIBRARY_FILE_LINUX = lib$(NETWORK_LIBRARY_NAME).so | ||
| UPDATE_LIBRARY_FILE_MAC = lib$(UPDATE_LIBRARY_NAME).dylib | ||
| UPDATE_LIBRARY_FILE_WIN = $(UPDATE_LIBRARY_NAME).dll | ||
| JAVA_HOME ?= $(shell java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' | awk '{print $$3}') | ||
| RESOURCES_BASE_DIR = resources | ||
|
|
||
| # Detect platform | ||
| UNAME_S := $(shell uname -s) | ||
|
|
||
| ifeq ($(UNAME_S),Darwin) | ||
| PLATFORM_TARGET := macos | ||
| LIBRARY_FILE := $(LIBRARY_FILE_MAC) | ||
| NETWORK_LIBRARY_FILE := $(NETWORK_LIBRARY_FILE_MAC) | ||
| UPDATE_LIBRARY_FILE := $(UPDATE_LIBRARY_FILE_MAC) | ||
| else ifeq ($(UNAME_S),Linux) | ||
| PLATFORM_TARGET := linux | ||
| LIBRARY_FILE := $(LIBRARY_FILE_LINUX) | ||
| NETWORK_LIBRARY_FILE := $(NETWORK_LIBRARY_FILE_LINUX) | ||
| UPDATE_LIBRARY_FILE := | ||
| else ifeq ($(OS),Windows_NT) | ||
| PLATFORM_TARGET := windows | ||
| LIBRARY_FILE := $(LIBRARY_NAME).dll | ||
| NETWORK_LIBRARY_FILE := $(NETWORK_LIBRARY_NAME).dll | ||
| UPDATE_LIBRARY_FILE := $(UPDATE_LIBRARY_FILE_WIN) | ||
| else | ||
| PLATFORM_TARGET := unknown | ||
| LIBRARY_FILE := | ||
| NETWORK_LIBRARY_FILE := | ||
| UPDATE_LIBRARY_FILE := | ||
| endif | ||
|
|
||
| # Default target: build only for detected platform | ||
| all: $(PLATFORM_TARGET) | ||
|
|
||
| macos: | ||
| @echo "Compiling Objective-C code to a dynamic library for macOS..." | ||
| @mkdir -p build | ||
| $(COMPILER) -dynamiclib -o build/$(LIBRARY_FILE_MAC) $(FILES) -framework Foundation -framework SystemConfiguration -framework CoreFoundation -framework Network -framework CFNetwork -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin | ||
| @echo "Library created at build/$(LIBRARY_FILE_MAC)" | ||
| @echo "Compiling NetworkTypeFinder for macOS..." | ||
| @mkdir -p $(RESOURCES_BASE_DIR)/macos | ||
| $(COMPILER) -dynamiclib -o $(RESOURCES_BASE_DIR)/macos/$(NETWORK_LIBRARY_FILE_MAC) $(NETWORK_FILES) -framework Foundation -framework SystemConfiguration -framework CoreFoundation -framework Network -framework CFNetwork -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin | ||
| @echo "NetworkTypeFinder library created at $(RESOURCES_BASE_DIR)/macos/$(NETWORK_LIBRARY_FILE_MAC)" | ||
| @echo "Compiling UpdateBridge for macOS..." | ||
| @mkdir -p $(RESOURCES_BASE_DIR)/macos | ||
| $(COMPILER) -dynamiclib -o $(RESOURCES_BASE_DIR)/macos/$(UPDATE_LIBRARY_FILE_MAC) $(UPDATE_FILES_MAC) \ | ||
| -framework Foundation \ | ||
| -I$(JAVA_HOME)/include \ | ||
| -I$(JAVA_HOME)/include/darwin \ | ||
| -install_name @loader_path/lib$(UPDATE_LIBRARY_NAME).dylib \ | ||
| -Wl,-rpath,@loader_path | ||
| @echo "UpdateBridge library created at $(RESOURCES_BASE_DIR)/macos/$(UPDATE_LIBRARY_FILE_MAC)" | ||
|
|
||
| linux: | ||
| @echo "Compiling Objective-C code to a dynamic library for Linux..." | ||
| @mkdir -p build | ||
| $(COMPILER) -shared -fPIC -o build/$(LIBRARY_FILE_LINUX) $(FILES) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux | ||
| @echo "Library created at build/$(LIBRARY_FILE_LINUX)" | ||
| @echo "Compiling NetworkTypeFinder for Linux..." | ||
| @mkdir -p $(RESOURCES_BASE_DIR)/linux | ||
| $(COMPILER) -shared -fPIC -o $(RESOURCES_BASE_DIR)/linux/$(NETWORK_LIBRARY_FILE_LINUX) $(NETWORK_FILES) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux | ||
| @echo "NetworkTypeFinder library created at $(RESOURCES_BASE_DIR)/linux/$(NETWORK_LIBRARY_FILE_LINUX)" | ||
| @echo "UpdateBridge not supported on Linux" | ||
|
|
||
| windows: | ||
| @echo "Compiling Objective-C code to a dynamic library for Windows..." | ||
| @mkdir -p build | ||
| $(COMPILER) -shared -m64 -o build\\$(LIBRARY_NAME).dll $(FILES) '-I$(JAVA_HOME)\\include' '-I$(JAVA_HOME)\\include\\win32' -lws2_32 -liphlpapi | ||
| @echo "Library created at build/$(LIBRARY_NAME).dll" | ||
| @echo "Compiling NetworkTypeFinder for Windows..." | ||
| @mkdir -p $(RESOURCES_BASE_DIR)/windows | ||
| $(COMPILER) -shared -m64 -o $(RESOURCES_BASE_DIR)/windows/$(NETWORK_LIBRARY_NAME).dll $(NETWORK_FILES) '-I$(JAVA_HOME)\\include' '-I$(JAVA_HOME)\\include\\win32' -lws2_32 -liphlpapi | ||
| @echo "NetworkTypeFinder library created at $(RESOURCES_BASE_DIR)/windows/$(NETWORK_LIBRARY_NAME).dll" | ||
| @echo "Compiling UpdateBridge for Windows..." | ||
| $(COMPILER) -shared -m64 -o $(RESOURCES_BASE_DIR)/windows/$(UPDATE_LIBRARY_FILE_WIN) $(UPDATE_FILES_WIN) '-I$(JAVA_HOME)\\include' '-I$(JAVA_HOME)\\include\\win32' | ||
| @echo "UpdateBridge library created at $(RESOURCES_BASE_DIR)/windows/$(UPDATE_LIBRARY_FILE_WIN)" | ||
|
|
||
| # Install the library to system path | ||
| install: all | ||
| @echo "Installing library to system path..." | ||
| @echo "Installing libraries to system path..." | ||
| ifeq ($(PLATFORM_TARGET),macos) | ||
| cp build/$(LIBRARY_FILE_MAC) $(HOME)/Library/Java/Extensions | ||
| cp $(RESOURCES_BASE_DIR)/macos/$(NETWORK_LIBRARY_FILE_MAC) $(HOME)/Library/Java/Extensions | ||
| cp $(RESOURCES_BASE_DIR)/macos/$(UPDATE_LIBRARY_FILE_MAC) $(HOME)/Library/Java/Extensions | ||
| else ifeq ($(PLATFORM_TARGET),linux) | ||
| sudo cp build/$(LIBRARY_FILE_LINUX) /usr/lib/ | ||
| sudo cp $(RESOURCES_BASE_DIR)/linux/$(NETWORK_LIBRARY_FILE_LINUX) /usr/lib/ | ||
| else ifeq ($(PLATFORM_TARGET),windows) | ||
| copy build\\$(LIBRARY_NAME).dll %JAVA_HOME%\\bin | ||
| copy $(RESOURCES_BASE_DIR)\\windows\\$(NETWORK_LIBRARY_NAME).dll %JAVA_HOME%\\bin | ||
| copy $(RESOURCES_BASE_DIR)\\windows\\$(UPDATE_LIBRARY_FILE_WIN) %JAVA_HOME%\\bin | ||
| else | ||
| @echo "Unknown platform, not installing." | ||
| endif | ||
| @echo "Library installed" | ||
| @echo "Libraries installed" | ||
|
|
||
| clean: | ||
| @echo "Cleaning build artifacts..." | ||
| rm -rf build | ||
| rm -rf $(RESOURCES_BASE_DIR) | ||
| @echo "Clean complete" | ||
|
|
||
| help: | ||
| @echo "NetworkTypeFinder JNI Bridge Makefile" | ||
| @echo "NetworkTypeFinder and UpdateBridge JNI Bridges Makefile" | ||
| @echo "" | ||
| @echo "Targets:" | ||
| @echo " all (default): Compile Objective-C code to a dynamic library for the current platform" | ||
| @echo " install: Install the library to system path for the current platform" | ||
| @echo " all (default): Compile both libraries for the current platform" | ||
| @echo " install: Install the libraries to system path for the current platform" | ||
| @echo " clean: Clean build artifacts" | ||
| @echo " help: Show this help message" | ||
| @echo "" | ||
| @echo "Libraries built:" | ||
| @echo " NetworkTypeFinder: Network type detection" | ||
| @echo " UpdateBridge: Sparkle (macOS) / WinSparkle (Windows) integration" | ||
| @echo "" | ||
| @echo "Example usage:" | ||
| @echo " make all # Compile the library for your platform" | ||
| @echo " make install # Install the library for your platform" | ||
| @echo " make all # Compile the libraries for your platform" | ||
| @echo " make install # Install the libraries for your platform" | ||
|
|
||
| .PHONY: all macos linux windows install clean help |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't want to merge this, just use if for tests.