OILS / win32 / deps.sh View on Github | oils.pub

88 lines, 36 significant
1#!/usr/bin/env bash
2#
3# Test bash, python3, C and C++ under Wine!
4#
5# Notes:
6# python3 is called python.exe on Windows
7#
8# Other things to try:
9
10# - python3
11# - test out asyncio on Windows!
12# - especially process creation
13# - a test framework for stdin/stdout/stderr would be nice
14# - can sh_spec.py work with non-shell scripts?
15#
16# - git
17# - can we clone our repo? commit?
18#
19# And then do this all inside QEMU - it seems more automated than VirtualBox
20#
21# - do automated installation of everything?
22
23readonly DIR=_tmp/win32
24
25my-curl() {
26 curl --location --continue-at - \
27 --remote-name --output-dir $DIR "$@"
28}
29
30download() {
31 mkdir -p $DIR
32
33 my-curl 'https://www.python.org/ftp/python/3.13.3/python-3.13.3-amd64.exe'
34
35 my-curl \
36 'https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-64-bit.exe'
37
38 my-curl \
39 'https://github.com/jmeubank/tdm-gcc/releases/download/v10.3.0-tdm64-2/tdm64-gcc-10.3.0-2.exe'
40}
41
42find-python() {
43 find ~/.wine/drive_c/|grep python.exe
44}
45
46test-python3() {
47 # takes 326 ms
48 time wine \
49 ~/.wine/drive_c/users/andy/AppData/Local/Programs/Python/Python313/python.exe \
50 -c 'print("hi")'
51}
52
53readonly BASH=~/'.wine/drive_c/Program Files/Git/bin/bash.exe'
54readonly GIT_BASH=~/'.wine/drive_c/Program Files/Git/git-bash.exe'
55
56test-bash() {
57 # 378 ms
58 # works, but getting a bunch of warnings
59
60 # Hm this respects $PATH, finds python
61 time wine "$BASH" -c 'echo "hi from bash"; python.exe -c "print(\"hi from python3\")"'
62
63 #time wine "$GIT_BASH" -c 'echo hi'
64}
65
66test-gcc() {
67 echo '
68#include <iostream>
69int main() {
70 std::cout << "Hello from C++ in Wine!" << std::endl;
71 return 0;
72}' > $DIR/hello.cpp
73
74 wine cmd /c "g++ $DIR/hello.cpp -o $DIR/hello.exe"
75
76 wine $DIR/hello.exe
77
78}
79
80build-create-process() {
81 wine cmd /c "g++ win32/create-process.c -o $DIR/create-process.exe"
82}
83
84run-create-process() {
85 wine $DIR/create-process.exe
86}
87
88"$@"