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
120
121
122
123
|
project('l2su', 'c', 'java', default_options : {'b_ndebug': 'if-release'})
add_global_arguments('-D_XOPEN_SOURCE=700', '-DPCRE2_CODE_UNIT_WIDTH=8', language : 'c')
curl_dep = dependency('libcurl')
jansson_dep = dependency('jansson')
pcre2_dep = dependency('libpcre2-8')
libzip_dep = dependency('libzip')
libjni_dep = dependency('jni', version : '>= 1.8.0', modules : [ 'jvm' ]).partial_dependency(
compile_args : true,
includes : true)
config_data = configuration_data()
config_data.set_quoted('PROJECT_NAME', 'l2su')
config_data.set_quoted('PROJECT_NAME_UPPER', 'L2SU')
if host_machine.endian() == 'little'
config_data.set('L2SU_ENDIAN_LITTLE', true)
elif host_machine.endian() == 'big'
config_data.set('L2SU_ENDIAN_BIG', true)
else
error('Middle endian is unsupported')
endif
launcher_os = get_option('launcher_os')
launcher_arch_bits = get_option('launcher_arch_bits')
launcher_arch = get_option('launcher_arch')
launcher_jre_arch = get_option('launcher_jre_arch')
launcher_java_path_sep = get_option('launcher_java_path_sep')
if launcher_os == 'auto'
if host_machine.system() == 'linux'
launcher_os = 'linux'
elif host_machine.system() == 'darwin'
launcher_os = 'osx'
elif host_machine.system() == 'windows'
launcher_os = 'windows'
else
error('Unable to determine OS. Please use the launcher_os build option.')
endif
endif
if launcher_arch_bits == 'auto'
if host_machine.cpu_family() == 'x86'
launcher_arch_bits = '32'
elif host_machine.cpu_family() == 'x86_64' or host_machine.cpu_family() == 'arm64'
launcher_arch_bits = '64'
else
error('Unable to determine launcher arch bits. Please use the launcher_arch_bits option.')
endif
endif
if launcher_arch == ''
launcher_arch = host_machine.cpu_family()
endif
if launcher_jre_arch == 'auto'
if host_machine.system() == 'linux'
if host_machine.cpu_family() == 'x86'
launcher_jre_arch = 'linux-i386'
elif host_machine.cpu_family() == 'x86_64'
launcher_jre_arch = 'linux'
else
launcher_jre_arch = 'gamecore'
endif
elif host_machine.system() == 'darwin'
if host_machine.cpu_family() == 'aarch64'
launcher_jre_arch = 'mac-os-arm64'
else
launcher_jre_arch = 'mac-os'
endif
elif host_machine.system() == 'windows'
if host_machine.cpu_family() == 'x86'
launcher_jre_arch = 'windows-x86'
elif host_machine.cpu_family() == 'x86_64'
launcher_jre_arch = 'windows-x64'
elif host_machine.cpu_family() == 'aarch64'
launcher_jre_arch = 'windows-arm64'
else
launcher_jre_arch = 'gamecore'
endif
else
launcher_jre_arch = 'gamecore'
endif
endif
if launcher_java_path_sep == ''
if host_machine.system() == 'windows'
launcher_java_path_sep = ';'
else
launcher_java_path_sep = ':'
endif
endif
message('Using launcher OS', launcher_os)
config_data.set_quoted('L2SU_LAUNCHER_OS', launcher_os)
if launcher_os == 'linux'
config_data.set('L2SU_LAUNCHER_IS_LINUX', true)
elif launcher_os == 'osx'
config_data.set('L2SU_LAUNCHER_IS_OSX', true)
elif launcher_os == 'windows'
config_data.set('L2SU_LAUNCHER_IS_WINDOWS', true)
endif
message('Using launcher arch bits', launcher_arch_bits)
config_data.set_quoted('L2SU_LAUNCHER_ARCH_BITS', launcher_arch_bits)
message('Using launcher arch', launcher_arch)
config_data.set_quoted('L2SU_LAUNCHER_ARCH', launcher_arch)
message('Using launcher JRE arch', launcher_jre_arch)
config_data.set_quoted('L2SU_JRE_ARCH', launcher_jre_arch)
message('Using launcher classpath separator', launcher_java_path_sep)
config_data.set_quoted('L2SU_CLASSPATH_SEP', launcher_java_path_sep)
if launcher_jre_arch == 'gamecore'
message('(launcher_jre_arch == gamecore, so JREs will most likely not be downloaded.)')
endif
subdir('src')
executable('l2su', launcher_srcs, dependencies : [curl_dep, jansson_dep, pcre2_dep, libzip_dep, libjni_dep], include_directories : [config_include_dir], override_options : {'c_std': 'c99'})
|