package freeimage: fix static build and add test program

This commit is contained in:
Tony Theodore 2013-03-12 02:59:02 +11:00
parent a0d71fec95
commit 31133c3f44
3 changed files with 30 additions and 91 deletions

View File

@ -3,89 +3,10 @@ See index.html for further information.
Contains ad hoc patches for cross building.
From bc927f5ebeb38f83d6b6d36de6f4af679232ca11 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 20 Feb 2012 08:58:53 +0100
Subject: [PATCH 1/3] makefile workarounds (MXE)
diff --git a/Makefile.gnu b/Makefile.gnu
index e6007ae..631eb82 100644
--- a/Makefile.gnu
+++ b/Makefile.gnu
@@ -9,7 +9,7 @@ INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib
# Converts cr/lf to just lf
-DOS2UNIX = dos2unix
+DOS2UNIX = echo 'dos2unix not needed '
LIBRARIES = -lstdc++
@@ -40,13 +40,12 @@ all: dist
dist: FreeImage
cp *.a Dist
- cp *.so Dist
cp Source/FreeImage.h Dist
dos2unix:
@$(DOS2UNIX) $(SRCS) $(INCLS)
-FreeImage: $(STATICLIB) $(SHAREDLIB)
+FreeImage: $(STATICLIB)
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
@@ -62,12 +61,8 @@ $(SHAREDLIB): $(MODULES)
install:
install -d $(INCDIR) $(INSTALLDIR)
- install -m 644 -o root -g root $(HEADER) $(INCDIR)
- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
- ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
- ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
-# ldconfig
+ install -m 644 $(HEADER) $(INCDIR)
+ install -m 644 $(STATICLIB) $(INSTALLDIR)
clean:
rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
--
1.7.10.4
From d0f85974b3e4057a9779d6dfad7c133f3a05f094 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 20 Feb 2012 09:47:08 +0100
Subject: [PATCH 2/3] required win version (MXE)
diff --git a/Makefile.gnu b/Makefile.gnu
index 631eb82..1809017 100644
--- a/Makefile.gnu
+++ b/Makefile.gnu
@@ -15,9 +15,9 @@ LIBRARIES = -lstdc++
MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
-CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -DNO_LCMS
+CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -DNO_LCMS -DWINVER=0x0501
CFLAGS += $(INCLUDE)
-CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
+CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy -DWINVER=0x0501
CXXFLAGS += $(INCLUDE)
ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
--
1.7.10.4
From f1a9c3261457568064127586e9c782664bb8df78 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sat, 27 Oct 2012 22:57:27 +0200
Subject: [PATCH 3/3] include string.h for memset
Subject: [PATCH 1/1] include string.h for memset
taken from https://sourceforge.net/tracker/?func=detail&aid=3581223&group_id=11504&atid=311504

16
src/freeimage-test.c Normal file
View File

@ -0,0 +1,16 @@
/*
* This file is part of MXE.
* See index.html for further information.
*/
#include <stdio.h>
#include <FreeImage.h>
int main(int argc, char* argv[])
{
(void)argc;
(void)argv;
printf("%s\n", FreeImage_GetVersion());
return 0;
}

View File

@ -16,19 +16,21 @@ define $(PKG)_UPDATE
endef
define $(PKG)_BUILD
$(SED) -i 's,install ,$(INSTALL) ,' '$(1)'/Makefile.gnu
$(MAKE) -C '$(1)' -j '$(JOBS)' -f Makefile.gnu \
$(MAKE) -C '$(1)' -j '$(JOBS)' -f Makefile.mingw \
CXX='$(TARGET)-g++' \
CC='$(TARGET)-gcc' \
AR='$(TARGET)-ar' \
INCDIR='$(PREFIX)/$(TARGET)/include' \
INSTALLDIR='$(PREFIX)/$(TARGET)/lib'
RC='$(TARGET)-windres' \
FREEIMAGE_LIBRARY_TYPE=STATIC \
TARGET=freeimage
$(MAKE) -C '$(1)' -j '$(JOBS)' -f Makefile.gnu install \
CXX='$(TARGET)-g++' \
CC='$(TARGET)-gcc' \
AR='$(TARGET)-ar' \
INCDIR='$(PREFIX)/$(TARGET)/include' \
INSTALLDIR='$(PREFIX)/$(TARGET)/lib'
$(INSTALL) -d '$(PREFIX)/$(TARGET)/lib'
$(INSTALL) -m644 '$(1)/libfreeimage.a' '$(PREFIX)/$(TARGET)/lib/'
$(INSTALL) -d '$(PREFIX)/$(TARGET)/include'
$(INSTALL) -m644 '$(1)/Source/FreeImage.h' '$(PREFIX)/$(TARGET)/include/'
'$(TARGET)-gcc' \
-W -Wall -Werror -ansi -pedantic \
'$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
-lfreeimage -DFREEIMAGE_LIB
endef