|
2 | 2 | --- @param ctx table |
3 | 3 | --- @field ctx.rootPath string Installation root path |
4 | 4 | function PLUGIN:PostInstall(ctx) |
5 | | - local os_type = RUNTIME.osType |
6 | | - |
7 | | - -- Windows uses the .exe installer, not source compilation |
8 | | - if os_type == "windows" then |
9 | | - print("Windows installation requires the ChezScheme.exe installer from GitHub releases") |
10 | | - print("Please download and run it manually from:") |
11 | | - print("https://github.com/cisco/ChezScheme/releases") |
12 | | - return |
13 | | - end |
14 | | - |
15 | | - local root_path = ctx.rootPath |
16 | | - |
17 | | - -- The tarball extracts with contents at root level (no top-level directory to strip) |
18 | | - -- We need to run configure and make install |
19 | | - print("Compiling Chez Scheme from source...") |
20 | | - |
21 | | - -- Configure with install prefix |
22 | | - local configure_cmd = "cd " .. root_path .. " && ./configure --installprefix=" .. root_path |
23 | | - print("Running: " .. configure_cmd) |
24 | | - local result = os.execute(configure_cmd) |
25 | | - if result ~= 0 and result ~= true then |
26 | | - error("Configure failed") |
27 | | - end |
28 | | - |
29 | | - -- Build |
30 | | - local make_cmd = "cd " .. root_path .. " && make" |
31 | | - print("Running: make") |
32 | | - result = os.execute(make_cmd) |
33 | | - if result ~= 0 and result ~= true then |
34 | | - error("Make failed") |
35 | | - end |
36 | | - |
37 | | - -- Install to the prefix directory |
38 | | - local install_cmd = "cd " .. root_path .. " && make install" |
39 | | - print("Running: make install") |
40 | | - result = os.execute(install_cmd) |
41 | | - if result ~= 0 and result ~= true then |
42 | | - error("Make install failed") |
43 | | - end |
44 | | - |
45 | | - -- Clean up build artifacts to save space (optional) |
46 | | - os.execute("cd " .. root_path .. " && rm -rf boot c examples mats s unicode workarea Makefile configure LOG NOTICE 2>/dev/null") |
47 | | - |
48 | | - print("Chez Scheme compilation complete!") |
| 5 | + local os_type = RUNTIME.osType |
| 6 | + |
| 7 | + -- Windows uses the .exe installer, not source compilation |
| 8 | + if os_type == "windows" then |
| 9 | + print("Windows installation requires the ChezScheme.exe installer from GitHub releases") |
| 10 | + print("Please download and run it manually from:") |
| 11 | + print("https://github.com/cisco/ChezScheme/releases") |
| 12 | + return |
| 13 | + end |
| 14 | + |
| 15 | + local root_path = ctx.rootPath |
| 16 | + |
| 17 | + -- The tarball extracts with contents at root level (no top-level directory to strip) |
| 18 | + -- We need to run configure and make install |
| 19 | + print("Compiling Chez Scheme from source...") |
| 20 | + |
| 21 | + -- Configure with install prefix |
| 22 | + local configure_cmd = "cd " .. root_path .. " && ./configure --installprefix=" .. root_path |
| 23 | + print("Running: " .. configure_cmd) |
| 24 | + local result = os.execute(configure_cmd) |
| 25 | + if result ~= 0 and result ~= true then |
| 26 | + error("Configure failed") |
| 27 | + end |
| 28 | + |
| 29 | + -- Build |
| 30 | + local make_cmd = "cd " .. root_path .. " && make" |
| 31 | + print("Running: make") |
| 32 | + result = os.execute(make_cmd) |
| 33 | + if result ~= 0 and result ~= true then |
| 34 | + error("Make failed") |
| 35 | + end |
| 36 | + |
| 37 | + -- Install to the prefix directory |
| 38 | + local install_cmd = "cd " .. root_path .. " && make install" |
| 39 | + print("Running: make install") |
| 40 | + result = os.execute(install_cmd) |
| 41 | + if result ~= 0 and result ~= true then |
| 42 | + error("Make install failed") |
| 43 | + end |
| 44 | + |
| 45 | + -- Clean up build artifacts to save space (optional) |
| 46 | + os.execute( |
| 47 | + "cd " |
| 48 | + .. root_path |
| 49 | + .. " && rm -rf boot c examples mats s unicode workarea Makefile configure LOG NOTICE 2>/dev/null" |
| 50 | + ) |
| 51 | + |
| 52 | + print("Chez Scheme compilation complete!") |
49 | 53 | end |
0 commit comments