diff --git a/Makefile b/Makefile index e5909114cd7..78579f1221e 100644 --- a/Makefile +++ b/Makefile @@ -104,24 +104,29 @@ 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 +HAXE_STD_PATH=$(CURDIR)/std +HAXELIB_SRC_PATH=extra/haxelib_src + +$(HAXELIB_SRC_PATH)/haxelib_hxb.zip: + HAXE_STD_PATH=$(HAXE_STD_PATH) ./$(HAXE_OUTPUT) --cwd $(HAXELIB_SRC_PATH) \ + each.hxml --interp haxelib.client.Main --hxb haxelib_hxb.zip -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_INTERP=HAXE_STD_PATH=./std ./$(HAXE_OUTPUT) \ + --hxb-lib $(HAXELIB_SRC_PATH)/haxelib_hxb.zip --run haxelib.client.Main + +haxelib_hxcpp: $(HAXELIB_SRC_PATH)/haxelib_hxb.zip + $(HAXELIB_INTERP) config > /dev/null || $(HAXELIB_INTERP) newrepo + $(HAXELIB_INTERP) path hxcpp > /dev/null || \ + ($(HAXELIB_INTERP) git hxcpp https://github.com/HaxeFoundation/hxcpp.git && \ + hxcpp_path=`$(HAXELIB_INTERP) libpath hxcpp | tr -d '\r'` && \ + ./$(HAXE_OUTPUT) --cwd $$hxcpp_path/tools/hxcpp compile.hxml) # 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_hxcpp + HAXE_STD_PATH=$(HAXE_STD_PATH) ./$(HAXE_OUTPUT) --cwd $(HAXELIB_SRC_PATH) \ + client_cpp.hxml -D destination=../../../../$(HAXELIB_OUTPUT) -D no-compilation + $(HAXELIB_INTERP) --cwd $(HAXELIB_SRC_PATH)/bin/cpp run hxcpp Build.xml haxe tools: haxelib @@ -249,7 +254,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..853122a040b 100644 --- a/Makefile.win +++ b/Makefile.win @@ -3,6 +3,7 @@ MAKEFILENAME=Makefile.win include Makefile HAXE_OUTPUT=haxe.exe HAXELIB_OUTPUT=haxelib.exe +HAXE_STD_PATH=$(shell cygpath -m "$(CURDIR)/std") PREBUILD_OUTPUT=prebuild.exe EXTENSION=.exe PACKAGE_SRC_EXTENSION=.zip @@ -53,13 +54,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..3a6aebf35e5 160000 --- a/extra/haxelib_src +++ b/extra/haxelib_src @@ -1 +1 @@ -Subproject commit 98637027327d8cf385d302acaaf104bd6107d2bf +Subproject commit 3a6aebf35e5eac2a1318f556a413a06c7b7912f5 diff --git a/src/generators/gencpp.ml b/src/generators/gencpp.ml index e741c280cfc..b90e97f427e 100644 --- a/src/generators/gencpp.ml +++ b/src/generators/gencpp.ml @@ -7050,10 +7050,12 @@ let write_build_options common_ctx filename defines = PMap.iter ( fun name value -> match name with | "true" | "sys" | "dce" | "cpp" | "debug" -> () | _ -> write_define name (escape_command value)) defines; - let pin,pid = Process_helper.open_process_args_in_pid "haxelib" [|"haxelib"; "path"; "hxcpp"|] in - set_binary_mode_in pin false; - write_define "hxcpp" (Stdlib.input_line pin); - Stdlib.ignore (Process_helper.close_process_in_pid (pin,pid)); + if not (PMap.exists "no_compilation" defines) then begin + let pin,pid = Process_helper.open_process_args_in_pid "haxelib" [|"haxelib"; "path"; "hxcpp"|] in + set_binary_mode_in pin false; + write_define "hxcpp" (Stdlib.input_line pin); + Stdlib.ignore (Process_helper.close_process_in_pid (pin,pid)); + end; writer#close;; let create_member_types common_ctx =