|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * ██╗ ██╗██████╗ ██╗ ██╗██████╗ ██╗███████╗███████╗ |
| 5 | + * ██║ ██║██╔══██╗╚██╗██╔╝██╔══██╗██║██╔════╝██╔════╝ |
| 6 | + * ██║ ██║██████╔╝ ╚███╔╝ ██║ ██║██║█████╗ █████╗ |
| 7 | + * ██║ ██║██╔══██╗ ██╔██╗ ██║ ██║██║██╔══╝ ██╔══╝ |
| 8 | + * ███████╗██║██████╔╝██╔╝ ██╗██████╔╝██║██║ ██║ |
| 9 | + * ╚══════╝╚═╝╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═╝ |
| 10 | + */ |
| 11 | + |
| 12 | + |
| 13 | +$path = ARCH_PATH . $lib->name . '-' . $lib->version . '\\'; |
| 14 | +$xdifflog = LOG . 'libxdiff.log'; |
| 15 | + |
| 16 | + |
| 17 | +// Download and unzip libxdiff |
| 18 | +$tmpfile = TMP.pathinfo($lib->download_url, PATHINFO_BASENAME); |
| 19 | +if(!download_file($lib->download_url, $tmpfile, pathinfo($tmpfile, PATHINFO_BASENAME))) exit_error(); |
| 20 | +if(!untar($tmpfile, ARCH_PATH)) exit_error(); |
| 21 | +if(!is_dir($path)) exit_error("Can't find untar results"); |
| 22 | + |
| 23 | + |
| 24 | +// Patch makefile.win32 |
| 25 | +$contents = file_get_contents($path . 'makefile.win32'); |
| 26 | +$contents = str_replace(':I386', ':X64', $contents); |
| 27 | +file_put_contents($path . 'makefile.win32', $contents); |
| 28 | + |
| 29 | + |
| 30 | +// Compile libxdiff |
| 31 | +$label = "Compile " . $lib->name . '-' . $lib->version; |
| 32 | +draw_line($label, "running", Yellow); |
| 33 | +$bat = '@echo off'.RN; |
| 34 | +$bat .= 'cd ' . escapeshellarg($path).RN; |
| 35 | +$bat .= 'nmake /f makefile.win32 CFG=release'.RN; |
| 36 | +$batfile = TMP . 'build_libxdiff.bat'; |
| 37 | +file_put_contents($batfile, $bat); |
| 38 | +$ret = shell_exec_vs16($batfile); |
| 39 | +file_put_contents($xdifflog, $ret); |
| 40 | + |
| 41 | + |
| 42 | +// Verify if the build works |
| 43 | +if(!is_file($path . 'release\xdiff.lib')) draw_status($label, "failed", Red, true, 'SEE: ' . $xdifflog); |
| 44 | +else draw_status($label, "complete", Green); |
| 45 | + |
| 46 | + |
| 47 | +// Install libxdiff |
| 48 | +$label = "Install " . $lib->name . '-' . $lib->version; |
| 49 | +draw_line($label, "running", Yellow); |
| 50 | +$builddir = $path . 'build\\'; |
| 51 | + |
| 52 | +$files[$path . 'release\xdiff.lib'] = 'lib\xdiff_a.lib'; |
| 53 | +$files[$path . 'xdiff\xdiff.h'] = 'include\xdiff.h'; |
| 54 | + |
| 55 | +if(!create_build($builddir, $files)) draw_status($label, "failed", Red, true); |
| 56 | +if(!install_deps($builddir)) draw_status($label, "failed", Red, true); |
| 57 | +else draw_status($label, "complete", Green); |
| 58 | + |
| 59 | +delete_parent_deps($lib->name); |
0 commit comments