Skip to content

Commit

Permalink
build and use library on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
droundy committed Jun 25, 2016
1 parent cbaf0d3 commit f9b37bf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
4 changes: 3 additions & 1 deletion build/cross-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ set -ev

(x86_64-w64-mingw32-gcc -Wall -Werror -std=c99 -g -O2 -c -o win32/create_dlls.obj win32/create_dlls.c)

(x86_64-w64-mingw32-gcc -Wall -Werror -std=c99 -g -O2 -o bigbro.exe bigbro-windows.obj fileaccesses.obj win32/inject.obj win32/queue.obj win32/create_dlls.obj win32/dll_paths.obj)
(rm -f libbigbro-windows.a && x86_64-w64-mingw32-ar rc libbigbro-windows.a bigbro-windows.obj win32/inject.obj win32/queue.obj win32/create_dlls.obj win32/dll_paths.obj && x86_64-w64-mingw32-ranlib libbigbro-windows.a)

(x86_64-w64-mingw32-gcc -o bigbro.exe fileaccesses.obj libbigbro-windows.a)

21 changes: 17 additions & 4 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def is_exe(fpath):
> bigbro
""" % (cc, cflags))

wincfiles = ['bigbro-windows.c', 'fileaccesses.c', 'win32/inject.c',
'win32/queue.c', 'win32/create_dlls.c', 'win32/dll_paths.c']
winlibraryfiles = ['bigbro-windows.c', 'win32/inject.c',
'win32/queue.c', 'win32/create_dlls.c', 'win32/dll_paths.c']
wincfiles = winlibraryfiles + ['fileaccesses.c']
dll_cfiles = ['win32/inject.c', 'win32/dll.c', 'win32/patch.c', 'win32/hooks.c',
'win32/queue.c', 'win32/dll_paths.c']

Expand Down Expand Up @@ -154,10 +155,22 @@ def is_exe(fpath):
''')

print("""
| x86_64-w64-mingw32-gcc %s -o bigbro.exe %s"""
% (cflags, ' '.join([c[:-1]+'obj' for c in wincfiles])))
| x86_64-w64-mingw32-gcc -o bigbro.exe fileaccesses.obj libbigbro-windows.a
< fileaccesses.obj
< libbigbro-windows.a
""")
for c in wincfiles:
print("< %s.obj" % c[:-2])
print("""
# We need to remove libbigbro.a before running ar, because otherwise
# it will be added to, rather than replaced.
| rm -f libbigbro-windows.a && x86_64-w64-mingw32-ar rc libbigbro-windows.a %s && x86_64-w64-mingw32-ranlib libbigbro-windows.a
> libbigbro-windows.a
""" % (' '.join([c[:-1]+'obj' for c in winlibraryfiles])))
for c in winlibraryfiles:
print("< %s.obj" % c[:-2])


for c in glob.glob('tests/*.c'):
base = c[:-2]
Expand Down

0 comments on commit f9b37bf

Please sign in to comment.