Browse Source

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

Anonymous Maarten 9 months ago
parent
commit
4d6b23b68f
2 changed files with 41 additions and 23 deletions
  1. 14 7
      mingw/pkg-support/INSTALL.txt
  2. 27 16
      mingw/pkg-support/Makefile

+ 14 - 7
mingw/pkg-support/INSTALL.txt

@@ -2,17 +2,24 @@
 The 32-bit files are in i686-w64-mingw32
 The 64-bit files are in x86_64-w64-mingw32
 
-To install SDL for native development:
-    make native
+To install SDL for 32-bit x86 executables (i686):
+    make install-i686
 
-To install SDL for cross-compiling development:
-    make cross
+To install SDL for 64-bit x86 executables (x86_64):
+    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:
-    http://wiki.libsdl.org/
+    https://wiki.libsdl.org/SDL3/FrontPage
 
-Join the SDL developer mailing list if you want to join the community:
-    http://www.libsdl.org/mailing-list.php
+Join the SDL discourse server if you want to join the community:
+    https://discourse.libsdl.org/
 
 That's it!
 Sam Lantinga <slouken@libsdl.org>

+ 27 - 16
mingw/pkg-support/Makefile

@@ -1,26 +1,37 @@
 #
 # 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
 
-all install:
-	@echo "Type \"make native\" to install 32-bit to /usr"
-	@echo "Type \"make cross\" to install 32-bit and 64-bit to $(CROSS_PATH)"
+default:
+	@echo "Run \"make install-i686\" to install 32-bit"
+	@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:
-	make install-package arch=i686-w64-mingw32 prefix=/usr
+install:
+	@if test -d $(ARCH) && test -d $(DESTDIR); then \
+		(cd $(ARCH) && cp -rv bin include lib share $(DESTDIR)/); \
+	else \
+		echo "*** ERROR: $(ARCH) or $(DESTDIR) does not exist!"; \
+		exit 1; \
+	fi
 
-cross:
-	for arch in $(ARCHITECTURES); do \
-	    make install-package arch=$$arch prefix=$(CROSS_PATH)/$$arch; \
-	done
+install-i686:
+	$(MAKE) install ARCH=i686-w64-mingw32
 
-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; \
+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: $(arch) or $(prefix) does not exist!"; \
-	    exit 1; \
+		echo "*** ERROR: $(DESTDIR) does not exist!"; \
+		exit 1; \
 	fi
+
+.PHONY: default install install-i686 install-x86_64 install-all