Skip to content

Commit

Permalink
Remove vim and sed dependency for build.
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-graj committed Mar 27, 2023
1 parent 7ccd0de commit f78ae6c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
1 change: 0 additions & 1 deletion res/gen_c.sh

This file was deleted.

8 changes: 3 additions & 5 deletions res/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
prog_xxd = find_program('xxd')
prog_sed = find_program('sed')
prog_sh = find_program('sh')
prog_python3 = find_program('python3')

gen = generator(prog_sh,
gen = generator(prog_python3,
output : '@[email protected]',
arguments : ['@CURRENT_SOURCE_DIR@/gen_c.sh', '@INPUT@'],
arguments : ['@SOURCE_DIR@/util/xxd.py', '@INPUT@'],
capture : true,
)

Expand Down
2 changes: 1 addition & 1 deletion util/wininit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

pacman -Syu
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-curl mingw-w64-x86_64-cglm mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libepoxy mingw-w64-x86_64-meson vim
pacman -S mingw-w64-x86_64-curl mingw-w64-x86_64-cglm mingw-w64-x86_64-gtk3 mingw-w64-x86_64-libepoxy mingw-w64-x86_64-meson
28 changes: 28 additions & 0 deletions util/xxd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Copyright (c) 2023 Wojciech Graj
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
"""

import sys


if __name__ == "__main__":
filename = sys.argv[1]
varname = f"{filename[3:].replace('.', '_').replace('/', '_').replace('-', '_')}"
with open(filename, "rb") as f:
data = [hex(c) for c in f.read()]
print(
f"const unsigned char {varname}[]={{"
+ ','.join(data)
+ "};"
+ f"\nconst unsigned int {varname}_len={len(data)};"
)

0 comments on commit f78ae6c

Please sign in to comment.