Skip to content
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

Add MinGW-w64 Makefile target #220

Closed
wants to merge 2 commits into from
Closed

Conversation

jcadduono
Copy link

@jcadduono jcadduono commented Feb 8, 2017

I was having a bit of trouble with Makefile.gcc so I made a few modifications under a new name, ex. Makefile.mingw-w64

Maybe Makefile.mingw would be a better name, as you can probably just use
HOST=i586-pc-mingw32 make -fwin32/Makefile.mingw-w64
to have it compile for 32-bit.

It should happily compile & install to /usr/x86_64-w64-mingw32 with just make -fwin32/Makefile.mingw-w64

It builds both shared and static libraries. You can avoid building the executable files by using:
make lib -fwin32/Makefile.mingw-w64

HOST defaults to x86_64-w64-mingw32.
Install location can be set with PREFIX. (defaults to /usr/$HOST)

root@gallifrey:/home/jc/build/lib/zlib# make -fwin32/Makefile.mingw-w64
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o adler32.o adler32.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o compress.o compress.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o crc32.o crc32.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o deflate.o deflate.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o gzclose.o gzclose.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o gzlib.o gzlib.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o gzread.o gzread.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o gzwrite.o gzwrite.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o infback.o infback.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o inffast.o inffast.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o inflate.o inflate.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o inftrees.o inftrees.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o trees.o trees.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o uncompr.o uncompr.c
x86_64-w64-mingw32-gcc  -O3 -Wall -c -o zutil.o zutil.c
x86_64-w64-mingw32-ar rcs libz.a adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o 
x86_64-w64-mingw32-windres --define GCC_WINDRES -o zlibrc.o win32/zlib1.rc
x86_64-w64-mingw32-gcc -shared -Wl,--out-implib,libz.dll.a  \
-o zlib1.dll win32/zlib.def adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o  zlibrc.o
x86_64-w64-mingw32-strip zlib1.dll
x86_64-w64-mingw32-gcc  -O3 -Wall -I. -c -o example.o test/example.c
x86_64-w64-mingw32-gcc  -o example.exe example.o libz.a
x86_64-w64-mingw32-strip example.exe
x86_64-w64-mingw32-gcc  -O3 -Wall -I. -c -o minigzip.o test/minigzip.c
x86_64-w64-mingw32-gcc  -o minigzip.exe minigzip.o libz.a
x86_64-w64-mingw32-strip minigzip.exe
x86_64-w64-mingw32-gcc  -o example_d.exe example.o libz.dll.a
x86_64-w64-mingw32-strip example_d.exe
x86_64-w64-mingw32-gcc  -o minigzip_d.exe minigzip.o libz.dll.a
x86_64-w64-mingw32-strip minigzip_d.exe
root@gallifrey:/home/jc/build/lib/zlib# 

Successfully managed to use zlib1.dll under nginx.exe :)

@Neustradamus
Copy link

@madler: It is possible to look this PR?

@dbjh
Copy link

dbjh commented Feb 11, 2024

With all due respect, but what does this PR address? The provided reason is "a bit of trouble with Makefile.gcc". The PR is from 7 years ago. I tried win32/Makefile.gcc today, as well as running configure and then just running make. Both appear to work with GCC 13 as part of MinGW-w64.

@jcadduono jcadduono closed this Feb 11, 2024
@pmqs
Copy link
Contributor

pmqs commented Feb 11, 2024

That reminds me -- I have a workflow that will test the MinGW variants. Will see if I can find it.

@pmqs
Copy link
Contributor

pmqs commented Feb 11, 2024

See #935 for the MinGW build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants