From f1279e7bd391eee07981b92b16d22ee9e315884a Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Fri, 30 Aug 2024 18:58:04 +0100 Subject: [PATCH] Compile haxelib binary with hxcpp This avoids the dependency on neko, which means that haxe no longer has to be packaged with neko as a mandatory dependency. Haxelib has to be run through interp first in order to install hxcpp. --- Makefile | 35 +++++++++++++++++++---------------- Makefile.win | 7 ------- extra/haxelib_src | 2 +- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index e5909114cd7..a0553563cd5 100644 --- a/Makefile +++ b/Makefile @@ -104,24 +104,27 @@ copy_haxetoolkit: /cygdrive/c/HaxeToolkit/haxe/haxe.exe cp $< $@ endif -ifeq ($(SYSTEM_NAME),Mac) -# This assumes that haxelib and neko will both be installed into INSTALL_DIR, -# which is the case when installing using the mac installer package -HAXELIB_LFLAGS= -Wl,-rpath,$(INSTALL_DIR)/lib -endif +HAXELIB_SRC_PATH=$(CURDIR)/extra/haxelib_src + +HAXELIB_INTERP=HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) \ + --cwd $(HAXELIB_SRC_PATH) each.hxml --run haxelib.client.Main --system -haxelib_unix: - cd $(CURDIR)/extra/haxelib_src && \ - HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) client.hxml && \ - nekotools boot -c run.n - $(CC) $(CURDIR)/extra/haxelib_src/run.c -o $(HAXELIB_OUTPUT) -lneko $(HAXELIB_LFLAGS) +$(HAXELIB_SRC_PATH)/haxelib_hxb.zip: + HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) --cwd $(HAXELIB_SRC_PATH) \ + each.hxml --interp haxelib.client.Main --hxb haxelib_hxb.zip + +HAXELIB_INTERP=HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) \ + --hxb-lib $(HAXELIB_SRC_PATH)/haxelib_hxb.zip \ + --run haxelib.client.Main # haxelib should depends on haxe, but we don't want to do that... -ifeq ($(SYSTEM_NAME),Windows) -haxelib: haxelib_$(PLATFORM) -else -haxelib: haxelib_unix -endif +# since haxelib isn't available in PATH yet, we have to pass -D no-compilation and build manually +haxelib: $(HAXELIB_SRC_PATH)/haxelib_hxb.zip + $(HAXELIB_INTERP) config > /dev/null || $(HAXELIB_INTERP) setup ~/.local/share/haxe/lib + $(HAXELIB_INTERP) path hxcpp > /dev/null || $(HAXELIB_INTERP) install hxcpp + HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) --cwd $(HAXELIB_SRC_PATH) \ + client_cpp.hxml -D destination=$(CURDIR)/$(HAXELIB_OUTPUT) -D no-compilation + cd $(HAXELIB_SRC_PATH)/bin/cpp && $(HAXELIB_INTERP) run hxcpp Build.xml haxe tools: haxelib @@ -249,7 +252,7 @@ clean_haxe: rm -f -r _build $(HAXE_OUTPUT) $(PREBUILD_OUTPUT) clean_tools: - rm -f $(HAXE_OUTPUT) $(PREBUILD_OUTPUT) $(HAXELIB_OUTPUT) + rm -rf $(HAXE_OUTPUT) $(PREBUILD_OUTPUT) $(HAXELIB_OUTPUT) $(HAXELIB_SRC_PATH)/haxelib_hxb.zip $(HAXELIB_SRC_PATH)/bin/cpp clean_package: rm -rf $(PACKAGE_OUT_DIR) diff --git a/Makefile.win b/Makefile.win index fdb34b4342b..95500b63536 100644 --- a/Makefile.win +++ b/Makefile.win @@ -53,13 +53,6 @@ PACKAGE_FILES=$(HAXE_OUTPUT) $(HAXELIB_OUTPUT) std \ "$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libmbedtls.dll | sed -e 's/^\s*//')" \ "$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libmbedx509.dll | sed -e 's/^\s*//')" -# haxelib should depends on haxe, but we don't want to do that... -haxelib_win: - cd $(CURDIR)/extra/haxelib_src && \ - HAXE_STD_PATH=$$(cygpath -m $(CURDIR)/std) $(CURDIR)/$(HAXE_OUTPUT) client.hxml && \ - nekotools boot run.n - mv extra/haxelib_src/run$(EXTENSION) $(HAXELIB_OUTPUT) - echo_package_files: echo $(PACKAGE_FILES) diff --git a/extra/haxelib_src b/extra/haxelib_src index 98637027327..8d07d4a0582 160000 --- a/extra/haxelib_src +++ b/extra/haxelib_src @@ -1 +1 @@ -Subproject commit 98637027327d8cf385d302acaaf104bd6107d2bf +Subproject commit 8d07d4a05823c5bed016cc3dd3ecd431eacbfc11