-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.win
119 lines (102 loc) · 4.49 KB
/
Makefile.win
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
PLATFORM=win
MAKEFILENAME=Makefile.win
include Makefile
HAXE_OUTPUT=haxe.exe
HAXELIB_OUTPUT=haxelib.exe
PREBUILD_OUTPUT=prebuild.exe
EXTENSION=.exe
PACKAGE_SRC_EXTENSION=.zip
ARCH?=32
DUNE_COMMAND=dune.exe
ifeq ($(ARCH),64)
NEKO_ARCH_STR=64
endif
kill:
-@taskkill /F /IM haxe.exe
# allow Ocaml/Mingw as well
NATIVE_LIBS += -I "c:/program files/mingw/lib/"
# use make WODI=wodi32 -f Makefile.win to build using WODI 32bit
ifdef WODI
NATIVE_LIBS += -I "/opt/${WODI}/lib"
endif
# use make MSVC=1 -f Makefile.win to build for OCaml/MSVC
ifeq (${MSVC}, 1)
NATIVE_LIBS = shell32.lib libs/extc/extc_stubs.obj libs/extc/process_stubs.obj libs/extc/zlib/zlib.lib libs/objsize/c_objsize.obj
endif
ifeq (${MSVC_OUTPUT}, 1)
FILTER=sed 's/File "\([^"]\+\)", line \([0-9]\+\), \(.*\)/\1(\2): \3/' tmp.cmi
endif
ifeq (${FD_OUTPUT}, 1)
FILTER=sed -e '/File/{ N; s/File "\([^"]\+\)", line \([0-9]\+\), characters \([0-9-]\+\):[\r\n]*\(.*\)/\1:\2: characters \3 : \4/ }' -e 's/_build\/src\//src\//' tmp.cmi
endif
ifdef FILTER
CC_CMD=($(COMPILER) $(ALL_CFLAGS) -c $< 2>tmp.cmi && $(FILTER)) || ($(FILTER) && exit 1)
endif
ifeq ($(STATICLINK),0)
LIB_PARAMS = -cclib -lpcre2-8 -cclib -lz -cclib -lcrypt32 -cclib -lmbedtls -cclib -lmbedcrypto -cclib -lmbedx509
endif
PACKAGE_FILES=$(HAXE_OUTPUT) $(HAXELIB_OUTPUT) std \
"$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep zlib1.dll | sed -e 's/^\s*//')" \
"$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libpcre2-8-0.dll | sed -e 's/^\s*//')" \
"$$(cygcheck $(CURDIR)/$(HAXE_OUTPUT) | grep libmbedcrypto.dll | sed -e 's/^\s*//')" \
"$$(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)
package_win:
mkdir -p out
rm -rf $(PACKAGE_FILE_NAME) $(PACKAGE_FILE_NAME).zip temp.zip
# Copy the package contents to $(PACKAGE_FILE_NAME)
# Using poor man's cp (zip then unzip), because cp in cygwin is quite broken
mkdir -p $(PACKAGE_FILE_NAME)
7z a -y -tzip -mx0 temp.zip $(PACKAGE_FILES) > log.txt || type log.txt
cd extra && 7z a -y -tzip -mx0 ../temp.zip LICENSE.txt CONTRIB.txt CHANGES.txt > log.txt || type log.txt
7z x -y temp.zip -o$(PACKAGE_FILE_NAME) > log.txt || type log.txt
rm temp.zip
# archive
7z a -r -tzip out/$(PACKAGE_FILE_NAME)_bin.zip $(PACKAGE_FILE_NAME) > log.txt || type log.txt
rm -r $(PACKAGE_FILE_NAME)
rm log.txt extra/log.txt
package_choco:
mkdir -p OUTPUT
7z x -y out/$(PACKAGE_FILE_NAME)_bin.zip -oout > log.txt || type log.txt
mv out/$(PACKAGE_FILE_NAME) out/choco
cp extra/choco/haxe.nuspec out/choco/haxe.nuspec
sed -i 's/@SNAPSHOT_VERSION@/$(HAXE_VERSION_SHORT)-SNAP$(COMMIT_DATE)/g' out/choco/haxe.nuspec
sed -i 's/@NEKO_VERSION@/$(NEKO_VERSION)/g' out/choco/haxe.nuspec
cd out/choco && choco pack
mv out/choco/haxe.*.nupkg out
rm -rf out/choco
$(INSTALLER_TMP_DIR)/neko-win.zip: $(INSTALLER_TMP_DIR)
curl -L https://github.com/HaxeFoundation/neko/releases/download/$(NEKO_VERSION_TAG)/neko-$(NEKO_VERSION)-win$(NEKO_ARCH_STR).zip -o installer/neko-win.zip
package_installer_win: $(INSTALLER_TMP_DIR)/neko-win.zip package_win
$(eval OUTFILE := $(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_installer.zip)
rm -rf $(INSTALLER_TMP_DIR)/resources
# neko
mkdir $(INSTALLER_TMP_DIR)/resources
cd $(INSTALLER_TMP_DIR) && 7z x -y neko-win.zip
rm $(INSTALLER_TMP_DIR)/neko-win.zip
mv $(INSTALLER_TMP_DIR)/neko* $(INSTALLER_TMP_DIR)/resources/neko
# haxe
7z x -y $(PACKAGE_OUT_DIR)/$(PACKAGE_FILE_NAME)_bin.zip -o$(INSTALLER_TMP_DIR)/resources
mv $(INSTALLER_TMP_DIR)/resources/haxe* $(INSTALLER_TMP_DIR)/resources/haxe
# WinSetup.hx
cp extra/WinSetup.hx $(INSTALLER_TMP_DIR)/resources/haxe
# extra
cp extra/*.nsi $(INSTALLER_TMP_DIR)
cp extra/*.nsh $(INSTALLER_TMP_DIR)
cp -rf extra/images $(INSTALLER_TMP_DIR)
# nsis
sed -i "s/%%VERSION%%/$(HAXE_VERSION_SHORT)/g" $(INSTALLER_TMP_DIR)/installer.nsi
sed -i "s/%%VERSTRING%%/$(HAXE_VERSION)/g" $(INSTALLER_TMP_DIR)/installer.nsi
sed -i "s/%%VERLONG%%/$(HAXE_VERSION)/g" $(INSTALLER_TMP_DIR)/installer.nsi
sed -i "s/%%NEKO_VERSION%%/$(NEKO_VERSION)/g" $(INSTALLER_TMP_DIR)/installer.nsi
cd $(INSTALLER_TMP_DIR) && makensis installer.nsi
7z a -r -tzip $(OUTFILE) $(INSTALLER_TMP_DIR)/*.exe
dir $(PACKAGE_OUT_DIR)