Skip to content

Commit b0f859f

Browse files
committed
[make] 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.
1 parent 7415e9f commit b0f859f

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

Makefile

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,24 +104,27 @@ copy_haxetoolkit: /cygdrive/c/HaxeToolkit/haxe/haxe.exe
104104
cp $< $@
105105
endif
106106

107-
ifeq ($(SYSTEM_NAME),Mac)
108-
# This assumes that haxelib and neko will both be installed into INSTALL_DIR,
109-
# which is the case when installing using the mac installer package
110-
HAXELIB_LFLAGS= -Wl,-rpath,$(INSTALL_DIR)/lib
111-
endif
107+
HAXELIB_SRC_PATH=$(CURDIR)/extra/haxelib_src
108+
109+
HAXELIB_INTERP=HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) \
110+
--cwd $(HAXELIB_SRC_PATH) each.hxml --run haxelib.client.Main
112111

113-
haxelib_unix:
114-
cd $(CURDIR)/extra/haxelib_src && \
115-
HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) client.hxml && \
116-
nekotools boot -c run.n
117-
$(CC) $(CURDIR)/extra/haxelib_src/run.c -o $(HAXELIB_OUTPUT) -lneko $(HAXELIB_LFLAGS)
112+
$(HAXELIB_SRC_PATH)/haxelib_hxb.zip:
113+
HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) --cwd $(HAXELIB_SRC_PATH) \
114+
each.hxml --interp haxelib.client.Main --hxb haxelib_hxb.zip
115+
116+
HAXELIB_INTERP=HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) \
117+
--hxb-lib $(HAXELIB_SRC_PATH)/haxelib_hxb.zip \
118+
--run haxelib.client.Main
118119

119120
# haxelib should depends on haxe, but we don't want to do that...
120-
ifeq ($(SYSTEM_NAME),Windows)
121-
haxelib: haxelib_$(PLATFORM)
122-
else
123-
haxelib: haxelib_unix
124-
endif
121+
# since haxelib isn't available in PATH yet, we have to pass -D no-compilation and build manually
122+
haxelib: $(HAXELIB_SRC_PATH)/haxelib_hxb.zip
123+
$(HAXELIB_INTERP) config > /dev/null || $(HAXELIB_INTERP) setup ~/.local/share/haxe/lib
124+
$(HAXELIB_INTERP) path hxcpp > /dev/null || $(HAXELIB_INTERP) install hxcpp
125+
HAXE_STD_PATH=$(CURDIR)/std $(CURDIR)/$(HAXE_OUTPUT) --cwd $(HAXELIB_SRC_PATH) \
126+
client_cpp.hxml -D destination=$(CURDIR)/$(HAXELIB_OUTPUT) -D no-compilation
127+
cd $(HAXELIB_SRC_PATH)/bin/cpp && $(HAXELIB_INTERP) run hxcpp Build.xml haxe
125128

126129
tools: haxelib
127130

@@ -249,7 +252,7 @@ clean_haxe:
249252
rm -f -r _build $(HAXE_OUTPUT) $(PREBUILD_OUTPUT)
250253

251254
clean_tools:
252-
rm -f $(HAXE_OUTPUT) $(PREBUILD_OUTPUT) $(HAXELIB_OUTPUT)
255+
rm -rf $(HAXE_OUTPUT) $(PREBUILD_OUTPUT) $(HAXELIB_OUTPUT) $(HAXELIB_SRC_PATH)/haxelib_hxb.zip $(HAXELIB_SRC_PATH)/bin/cpp
253256

254257
clean_package:
255258
rm -rf $(PACKAGE_OUT_DIR)

Makefile.win

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ PACKAGE_FILES=$(HAXE_OUTPUT) $(HAXELIB_OUTPUT) std \
5353
"$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libmbedtls.dll | sed -e 's/^\s*//')" \
5454
"$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libmbedx509.dll | sed -e 's/^\s*//')"
5555

56-
# haxelib should depends on haxe, but we don't want to do that...
57-
haxelib_win:
58-
cd $(CURDIR)/extra/haxelib_src && \
59-
HAXE_STD_PATH=$$(cygpath -m $(CURDIR)/std) $(CURDIR)/$(HAXE_OUTPUT) client.hxml && \
60-
nekotools boot run.n
61-
mv extra/haxelib_src/run$(EXTENSION) $(HAXELIB_OUTPUT)
62-
6356
echo_package_files:
6457
echo $(PACKAGE_FILES)
6558

0 commit comments

Comments
 (0)