Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 58a93a10704d7594539167dd076e146f > files > 1

libglfw-2.6-5.fc12.src.rpm

Make only DSO, not a static library
Use SONAME
Make it possible to slecify libdir (lib vs. lib64)
Make it possibel to specify an installation root

Lubomir Rintel <lkundrak@v3.sk>

diff -up glfw/compile.sh.dso glfw/compile.sh
--- glfw/compile.sh.dso	2009-01-08 14:46:02.000000000 +0100
+++ glfw/compile.sh	2009-01-08 14:46:15.000000000 +0100
@@ -594,7 +594,7 @@ echo "$config_script: Creating ""$MKNAME
 cat > "$MKNAME" <<EOF
 prefix=@PREFIX@
 exec_prefix=@PREFIX@
-libdir=@PREFIX@/lib
+libdir=@PREFIX@/@LIB@
 includedir=@PREFIX@/include
 
 Name: GLFW
diff -up glfw/lib/x11/Makefile.x11.in.dso glfw/lib/x11/Makefile.x11.in
--- glfw/lib/x11/Makefile.x11.in.dso	2007-07-01 11:46:46.000000000 +0200
+++ glfw/lib/x11/Makefile.x11.in	2009-01-08 14:44:52.000000000 +0100
@@ -3,12 +3,19 @@
 # Installation prefix (default to /usr/local)
 ##########################################################################
 PREFIX ?= /usr/local
+LIB ?= lib
 
 
 ##########################################################################
-# Default: Build GLFW static library
+# Default: Build GLFW shared library
 ##########################################################################
-default: libglfw.a libglfw.so
+
+# API Version: 2.6
+# We assume API corresponds to ABI for now
+ABI_MAJOR=2.6
+ABI_MINOR=0
+SONAME=libglfw.so.$(ABI_MAJOR)
+default: $(SONAME)
 
 
 ##########################################################################
@@ -20,17 +27,18 @@ SED      = sed
 INSTALL  = install
 ARFLAGS  = -rcs
 
-
 ##########################################################################
 # Install GLFW static library
 ##########################################################################
-install: libglfw.a libglfw.pc
-	$(INSTALL) -d $(PREFIX)/lib
-	$(INSTALL) -c -m 644 libglfw.a $(PREFIX)/lib/libglfw.a
-	$(INSTALL) -d $(PREFIX)/include/GL
-	$(INSTALL) -c -m 644 ../../include/GL/glfw.h $(PREFIX)/include/GL/glfw.h
-	$(INSTALL) -d $(PREFIX)/lib/pkgconfig
-	$(INSTALL) -c -m 644 libglfw.pc $(PREFIX)/lib/pkgconfig/libglfw.pc
+install: $(SONAME) libglfw.pc
+	$(INSTALL) -d $(DESTDIR)$(PREFIX)/$(LIB)
+	$(INSTALL) -c -m 755 $(SONAME) $(DESTDIR)$(PREFIX)/$(LIB)
+	ln -sf $(SONAME) $(DESTDIR)$(PREFIX)/$(LIB)/$(SONAME).$(ABI_MINOR)
+	ln -sf $(SONAME) $(DESTDIR)$(PREFIX)/$(LIB)/libglfw.so
+	$(INSTALL) -d $(DESTDIR)$(PREFIX)/include/GL
+	$(INSTALL) -c -m 644 ../../include/GL/glfw.h $(DESTDIR)$(PREFIX)/include/GL
+	$(INSTALL) -d $(DESTDIR)$(PREFIX)/$(LIB)/pkgconfig
+	$(INSTALL) -c -m 644 libglfw.pc $(DESTDIR)$(PREFIX)/$(LIB)/pkgconfig
 
 
 ##########################################################################
@@ -91,7 +99,7 @@ SHARED_OBJS = \
 # Rule for building libglfw.pc
 ##########################################################################
 libglfw.pc: libglfw.pc.in
-	$(SED) -e 's,\@PREFIX\@,$(PREFIX),' libglfw.pc.in > libglfw.pc
+	$(SED) -e 's,\@PREFIX\@,$(PREFIX),;s,\@LIB\@,$(LIB),' libglfw.pc.in > libglfw.pc
 
 
 ##########################################################################
@@ -104,8 +112,8 @@ libglfw.a: $(STATIC_OBJS)
 ##########################################################################
 # Rule for building shared library
 ##########################################################################
-libglfw.so: $(SHARED_OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(SHARED_OBJS) $(LFLAGS) $(LIBS)
+$(SONAME): $(SHARED_OBJS)
+	$(CC) $(LDFLAGS) -o $@ -Wl,--soname,$(SONAME) $(SHARED_OBJS) $(LFLAGS) $(LIBS)
 
 
 ##########################################################################