mingw: use DESTDIR to change the install location of the mingw package

This commit is contained in:
Anonymous Maarten 2024-07-06 17:10:02 +02:00 committed by Anonymous Maarten
parent bfa4e71284
commit 4d6b23b68f
2 changed files with 43 additions and 25 deletions

View File

@ -2,17 +2,24 @@
The 32-bit files are in i686-w64-mingw32 The 32-bit files are in i686-w64-mingw32
The 64-bit files are in x86_64-w64-mingw32 The 64-bit files are in x86_64-w64-mingw32
To install SDL for native development: To install SDL for 32-bit x86 executables (i686):
make native make install-i686
To install SDL for cross-compiling development: To install SDL for 64-bit x86 executables (x86_64):
make cross make install-x86_64
To install both:
make install-all
Use DESTDIR to change the target location
mkdir $HOME/mingw32-prefix
make install-i686 DESTDIR=$HOME/mingw32-prefix
Look at the example programs in ./test, and check out online documentation: Look at the example programs in ./test, and check out online documentation:
http://wiki.libsdl.org/ https://wiki.libsdl.org/SDL3/FrontPage
Join the SDL developer mailing list if you want to join the community: Join the SDL discourse server if you want to join the community:
http://www.libsdl.org/mailing-list.php https://discourse.libsdl.org/
That's it! That's it!
Sam Lantinga <slouken@libsdl.org> Sam Lantinga <slouken@libsdl.org>

View File

@ -1,26 +1,37 @@
# #
# Makefile for installing the mingw32 version of the SDL library # Makefile for installing the mingw32 version of the SDL library
CROSS_PATH := /usr/local DESTDIR = /usr/local
ARCHITECTURES := i686-w64-mingw32 x86_64-w64-mingw32 ARCHITECTURES := i686-w64-mingw32 x86_64-w64-mingw32
all install: default:
@echo "Type \"make native\" to install 32-bit to /usr" @echo "Run \"make install-i686\" to install 32-bit"
@echo "Type \"make cross\" to install 32-bit and 64-bit to $(CROSS_PATH)" @echo "Run \"make install-x86_64\" to install 64-bit"
@echo "Run \"make install-all\" to install both"
@echo "Add DESTDIR=/custom/path to change the destination folder"
native: install:
make install-package arch=i686-w64-mingw32 prefix=/usr @if test -d $(ARCH) && test -d $(DESTDIR); then \
(cd $(ARCH) && cp -rv bin include lib share $(DESTDIR)/); \
cross:
for arch in $(ARCHITECTURES); do \
make install-package arch=$$arch prefix=$(CROSS_PATH)/$$arch; \
done
install-package:
@if test -d $(arch) && test -d $(prefix); then \
(cd $(arch) && cp -rv bin include lib share $(prefix)/); \
sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/lib/pkgconfig/sdl3.pc >$(prefix)/lib/pkgconfig/sdl3.pc; \
else \ else \
echo "*** ERROR: $(arch) or $(prefix) does not exist!"; \ echo "*** ERROR: $(ARCH) or $(DESTDIR) does not exist!"; \
exit 1; \ exit 1; \
fi fi
install-i686:
$(MAKE) install ARCH=i686-w64-mingw32
install-x86_64:
$(MAKE) install ARCH=x86_64-w64-mingw32
install-all:
@if test -d $(DESTDIR); then \
for arch in $(ARCHITECTURES); do \
$(MAKE) install ARCH=$$arch DESTDIR=$(DESTDIR)/$$arch; \
done \
else \
echo "*** ERROR: $(DESTDIR) does not exist!"; \
exit 1; \
fi
.PHONY: default install install-i686 install-x86_64 install-all