> What you need to do is to *port* the code to use what's available on > Windows instead of the functionality declared in the "missing" header > files. Of course, it is highly likely that a library like openjpeg intended to be generally usable and cross-platform already *is* portable to Windows. And indeed it is. It's just that only project files for MSVC are provided. Furthermore, openjpeg uses a hardcoded Makefile for Unix-like compilation. no configure scripts etc, which is a bit sad. But openjpeg is far from complex and it was trivial to modify the Unix Makefile to work with mingw. Took some fifteen minutes. There is no comprehensive test suite, but I tried building the two programs in the "codec" folder and they seemed to work, converting a TIFF image to JPEG2000 and back to TIFF. The JPEG2000 image also loaded fine into IrfanView. Patch included below, as I don't think attachments make it through this mailing list. The patch simply adds two files, Makefile.mingw and codec/Makefile.mingw, and adds the targets "mingw", "mingwinstall" and "mingwclean" to the main Makefile. I build only a shared library (DLL) in Makefile.mingw. Building a static library is left as an exercise to the interested. BTW, why does the code bother to use the stdcall calling convention? Isn't stdcall kinda a historical artefact of dubious value for new code? But oh well, I didn't bother to change that. --tml diff -ru ../1.3.orig/codec/Makefile.mingw ./codec/Makefile.mingw --- ../1.3.orig/codec/Makefile.mingw 2008-10-28 12:27:23.509000000 +0200 +++ ./codec/Makefile.mingw 2008-10-28 12:24:06.665500000 +0200 @@ -0,0 +1,16 @@ +# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k + +CFLAGS = -O3 + +TIFF = /devel/dist/win32/tiff-3.8.2-1 + +all: j2k_to_image.exe image_to_j2k.exe + +j2k_to_image.exe: j2k_to_image.c ../libopenjpeg-2.dll.a + gcc $(CFLAGS) compat/getopt.c index.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg-2 -I ../libopenjpeg -L$(TIFF)/lib -ltiff + +image_to_j2k.exe: image_to_j2k.c ../libopenjpeg-2.dll.a + gcc $(CFLAGS) compat/getopt.c index.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg-2 -I ../libopenjpeg -L$(TIFF)/lib -ltiff + +clean: + rm -f j2k_to_image image_to_j2k diff -ru ../1.3.orig/Makefile ./Makefile --- ../1.3.orig/Makefile 2007-12-21 12:39:41.000000000 +0200 +++ ./Makefile 2008-10-28 12:12:18.149875000 +0200 @@ -76,3 +76,13 @@ osxclean: make -f Makefile.osx clean + +mingw: + make -f Makefile.mingw + +mingwinstall: + make -f Makefile.mingw install + +mingwclean: + make -f Makefile.mingw clean + diff -ru ../1.3.orig/Makefile.mingw ./Makefile.mingw --- ../1.3.orig/Makefile.mingw 2008-10-28 12:27:29.196000000 +0200 +++ ./Makefile.mingw 2008-10-28 12:37:06.681125000 +0200 @@ -0,0 +1,54 @@ +# MinGW (i.e. GNU toolchain targeting Win32) makefile for OpenJPEG + +VER_MAJOR = 2 +VER_MINOR = 1.3.0 + +SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c +INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_malloc.h ./libopenjpeg/opj_includes.h +INCLUDE = -Ilibopenjpeg + +# General configuration variables: +CC = gcc +AR = ar + +PREFIX = /dummy +INSTALL_BINDIR = $(PREFIX)/bin +INSTALL_LIBDIR = $(PREFIX)/lib +INSTALL_INCLUDE = $(PREFIX)/include + +COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -DWIN32 -DOPJ_EXPORTS + +MODULES = $(SRCS:.c=.o) +CFLAGS = $(COMPILERFLAGS) $(INCLUDE) + +TARGET = openjpeg +SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dll +IMPLIB = lib$(TARGET)-$(VER_MAJOR).dll.a + + +default: all + +all: OpenJPEG + +dist: OpenJPEG + install -d dist + install $(SHAREDLIB) dist + install $(IMPLIB) dist + install libopenjpeg/openjpeg.h dist + +OpenJPEG: $(SHAREDLIB) + +.c.o: + $(CC) $(CFLAGS) -c $< -o $@ + +$(SHAREDLIB): $(MODULES) + $(CC) -shared -o $@ -Wl,--out-implib,$(IMPLIB) $(MODULES) $(LIBRARIES) + +install: OpenJPEG + install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)' + install $(SHAREDLIB) '$(DESTDIR)$(INSTALL_BINDIR)' + install $(IMPLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' + install libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)' + +clean: + rm -rf dist u2dtmp* $(MODULES) $(SHAREDLIB) $(IMPLIB) _______________________________________________ Gimp-developer mailing list Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer