revenge-tweak/Makefile
Ally Founder a48920b451 fix: linker errors from mixing C (Utils.m) and C++ (Tweak.xm/JSI.mm) TUs
- Wrap Utils.h's declarations in extern "C" so Tweak.xm/JSI.mm link against
  the plain-C symbols Utils.m actually exports, instead of expecting
  C++-mangled names that don't exist (confirmed via CI: "Undefined symbols
  ... showErrorAlert(NSString*, NSString*)").
- Add -undefined dynamic_lookup (matching RainTweak's Makefile): JSI/Hermes
  symbols like jsi::JSError's typeinfo only exist in the host process's own
  compiled-in runtime once the tweak is actually loaded into Discord, not
  anywhere available to link against at build time.
2026-08-03 10:34:27 -04:00

34 lines
1.4 KiB
Makefile

TARGET := iphone:clang:latest:14.0
ARCHS = arm64
INSTALL_TARGET_PROCESSES = Discord
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = Revenge
BUNDLE_NAME = RevengeResources
Revenge_FILES = $(wildcard Sources/*.x Sources/*.xm Sources/*.m Sources/*.mm Sources/**/*.x Sources/**/*.xm Sources/**/*.m Sources/**/*.mm)
Revenge_CFLAGS = -fobjc-arc -DPACKAGE_VERSION='@"$(THEOS_PACKAGE_BASE_VERSION)"' -I$(THEOS_PROJECT_DIR)/Headers
Revenge_CCFLAGS = -std=c++17 -Wno-c++11-narrowing -I$(THEOS_PROJECT_DIR)/Headers
Revenge_FRAMEWORKS = Foundation UIKit CoreGraphics CoreText CoreFoundation
# JSI types (e.g. jsi::JSError's typeinfo) only exist in the host process's own compiled-in
# Hermes/JSI runtime, not anywhere we can statically link against - resolve at load time instead.
Revenge_LDFLAGS = -undefined dynamic_lookup
RevengeResources_INSTALL_PATH = "/Library/Application\ Support/"
RevengeResources_RESOURCE_DIRS = Resources
include $(THEOS_MAKE_PATH)/tweak.mk
include $(THEOS_MAKE_PATH)/bundle.mk
before-all::
$(ECHO_NOTHING)mkdir -p Resources$(ECHO_END)
$(ECHO_NOTHING)sed -e 's/@PACKAGE_VERSION@/$(THEOS_PACKAGE_BASE_VERSION)/g' \
-e 's/@TWEAK_NAME@/$(TWEAK_NAME)/g' \
Sources/payload-base.template.js > Resources/payload-base.js$(ECHO_END)
after-stage::
$(ECHO_NOTHING)find $(THEOS_STAGING_DIR) -name ".DS_Store" -delete$(ECHO_END)
after-package::
$(ECHO_NOTHING)rm -rf Resources$(ECHO_END)