Skip to content

fix win10 build #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ jobs:
- displayTargetName: windows-2019
os: windows
runs_on: windows-2019
pip_option: --break-system-packages
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the --user parameter to install to a local %APPDATA%\Python path instead of modifying the system python package? It's for CI so it probably doesn't matter...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can. For this CI, I wanted to reduce OS depends code so, used the nasty option(--break-system-packages) for that.

shell: msys2 {0}
- displayTargetName: clang-build
os: unix
@@ -58,7 +59,7 @@ jobs:
echo "/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc

- uses: msys2/setup-msys2@v2
- uses: msys2/setup-msys2@v2.26.0
if: runner.os == 'Windows'
with:
msystem: MSYS
@@ -77,7 +78,7 @@ jobs:
if: runner.os == 'Linux'
uses: actions/checkout@v4
- name: Install pip dependencies
run: pip install yamlish junit-xml
run: pip install ${{ matrix.pip_option }} yamlish junit-xml
- name: Install openvpn
if: runner.os == 'Windows'
shell: pwsh
48 changes: 25 additions & 23 deletions arch/lkl/scripts/headers_install.py
Original file line number Diff line number Diff line change
@@ -63,11 +63,11 @@ def find_ml_symbols(regexp, store):
def find_enums(block_regexp, symbol_regexp, store):
for h in headers:
# remove comments
content = re.sub(re.compile("(\/\*(\*(?!\/)|[^*])*\*\/)", re.S|re.M), " ", open(h).read())
content = re.sub(re.compile(r"(\/\*(\*(?!\/)|[^*])*\*\/)", re.S|re.M), " ", open(h).read())
# remove preprocesor lines
clean_content = ""
for l in content.split("\n"):
if re.match("\s*#", l):
if re.match(r"\s*#", l):
continue
clean_content += l + "\n"
for i in block_regexp.finditer(clean_content):
@@ -103,11 +103,11 @@ def lkl_prefix(w):
def replace(h):
content = open(h).read()
for i in includes:
search_str = "(#[ \t]*include[ \t]*[<\"][ \t]*)" + i + "([ \t]*[>\"])"
search_str = r"(#[ \t]*include[ \t]*[<\"][ \t]*)" + i + r"([ \t]*[>\"])"
replace_str = "\\1" + "lkl/" + i + "\\2"
content = re.sub(search_str, replace_str, content)
tmp = ""
for w in re.split("(\W+)", content):
for w in re.split(r"(\W+)", content):
if w in defines:
w = lkl_prefix(w)
tmp += w
@@ -116,11 +116,11 @@ def replace(h):
# XXX: cleaner way?
if s == 'TAG':
continue
search_str = "(\W?struct\s+)" + s + "(\W)"
search_str = r"(\W?struct\s+)" + s + r"(\W)"
replace_str = "\\1" + lkl_prefix(s) + "\\2"
content = re.sub(search_str, replace_str, content, flags = re.MULTILINE)
for s in unions:
search_str = "(\W?union\s+)" + s + "(\W)"
search_str = r"(\W?union\s+)" + s + r"(\W)"
replace_str = "\\1" + lkl_prefix(s) + "\\2"
content = re.sub(search_str, replace_str, content, flags = re.MULTILINE)
open(h, 'w').write(content)
@@ -162,25 +162,25 @@ def replace(h):
structs = set()
unions = set()

p = re.compile("#[ \t]*define[ \t]*(\w+)")
p = re.compile(r"#[ \t]*define[ \t]*(\w+)")
find_symbols(p, defines)
p = re.compile("typedef.*(\(\*(\w+)\)\(.*\)\s*|\W+(\w+)\s*|\s+(\w+)\(.*\)\s*);")
p = re.compile(r"typedef.*(\(\*(\w+)\)\(.*\)\s*|\W+(\w+)\s*|\s+(\w+)\(.*\)\s*);")
find_symbols(p, defines)
p = re.compile("typedef\s+(struct|union)\s+\w*\s*{[^\\{\}]*}\W*(\w+)\s*;", re.M|re.S)
p = re.compile(r"typedef\s+(struct|union)\s+\w*\s*{[^\\{\}]*}\W*(\w+)\s*;", re.M|re.S)
find_ml_symbols(p, defines)
defines.add("siginfo_t")
defines.add("sigevent_t")
p = re.compile("struct\s+(\w+)\s*\{")
p = re.compile(r"struct\s+(\w+)\s*\{")
find_symbols(p, structs)
structs.add("iovec")
p = re.compile("union\s+(\w+)\s*\{")
p = re.compile(r"union\s+(\w+)\s*\{")
find_symbols(p, unions)
p = re.compile("static\s+__inline__(\s+\w+)+\s+(\w+)\([^)]*\)\s")
p = re.compile(r"static\s+__inline__(\s+\w+)+\s+(\w+)\([^)]*\)\s")
find_symbols(p, defines)
p = re.compile("static\s+__always_inline(\s+\w+)+\s+(\w+)\([^)]*\)\s")
p = re.compile(r"static\s+__always_inline(\s+\w+)+\s+(\w+)\([^)]*\)\s")
find_symbols(p, defines)
p = re.compile("enum\s+(\w*)\s*{([^}]*)}", re.M|re.S)
q = re.compile("(\w+)\s*(,|=[^,]*|$)", re.M|re.S)
p = re.compile(r"enum\s+(\w*)\s*{([^}]*)}", re.M|re.S)
q = re.compile(r"(\w+)\s*(,|=[^,]*|$)", re.M|re.S)
find_enums(p, q, defines)

# needed for i386
@@ -190,11 +190,13 @@ def process_header(h):
print(" REPLACE\t%s" % (out_dir + "/" + os.path.basename(h)))
replace(h)

p = multiprocessing.Pool(args.jobs)
try:
p.map_async(process_header, headers).wait(999999)
p.close()
except:
p.terminate()
finally:
p.join()
if __name__ == '__main__':
multiprocessing.freeze_support()
p = multiprocessing.Pool(args.jobs)
try:
p.map_async(process_header, headers).wait(999999)
p.close()
except:
p.terminate()
finally:
p.join()