nigels-com / glew

The OpenGL Extension Wrangler Library
Other
2.58k stars 609 forks source link

Cross compile: "make install" puts libraries into wrong path #316

Open mariob92 opened 2 years ago

mariob92 commented 2 years ago

I want to cross compile GLEW on Ubuntu for mingw-w64.

make install SYSTEM=linux-mingw64 installs the library files into the wrong path:

mario@ubuntu:~/glew$ sudo make install SYSTEM=linux-mingw64
install -d -m 0755 "/usr/local/include/GL"
install -m 0644 include/GL/wglew.h "/usr/local/include/GL/"
install -m 0644 include/GL/glew.h "/usr/local/include/GL/"
install -m 0644 include/GL/glxew.h "/usr/local/include/GL/"
install -m 0644 include/GL/eglew.h "/usr/local/include/GL/"
sed \
        -e "s|@prefix@|/usr/local|g" \
        -e "s|@libdir@|/usr/local/lib|g" \
        -e "s|@exec_prefix@|/usr/local/bin|g" \
        -e "s|@includedir@|/usr/local/include/GL|g" \
        -e "s|@version@|2.2.0|g" \
        -e "s|@cflags@||g" \
        -e "s|@libname@|glew32|g" \
        -e "s|@libgl@|-L/usr/x86_64-w64-mingw32/lib -lopengl32 -lgdi32 -luser32 -lkernel32|g" \
        -e "s|@requireslib@|glu|g" \
        < glew.pc.in > glew.pc
install -d -m 0755 "/usr/local/lib"
install -m 0644 lib/glew32.dll "/usr/local/lib/"
install -m 0644 lib/libglew32.a         "/usr/local/lib/"
install -d -m 0755 "/usr/local/lib/pkgconfig"
install -d -m 0755 "/usr/local/lib/pkgconfig"
install -m 0644 glew.pc "/usr/local/lib/pkgconfig/"

The files are installed into /usr/local/, however, they should be installed in something like /usr/local/x86_64-w64-mingw32/ (for win64) and /usr/local/i686-w64-mingw32/ (for win32).

This is an issue if I want to compile GLEW for different architectures (e.g. win32 and win64).

I'm not really an expert into Makefiles, but in the Makefile the following to lines hardcode the destination path, but they should be definied like /usr/local/$(HOST), where HOST is defined in the config/Makefile.*-files to the appropriate host.

 43 GLEW_PREFIX ?= /usr/local
 44 GLEW_DEST ?= /usr/local
nigels-com commented 2 years ago

Thanks for the detailed report.