improve generation of Darwin libraries
authorGuillaume Poirier <gpoirier@macbook-pro-de-guillaume-poirier.local>
Fri, 22 Aug 2008 19:05:37 +0000 (21:05 +0200)
committerGuillaume Poirier <gpoirier@macbook-pro-de-guillaume-poirier.local>
Fri, 22 Aug 2008 19:05:37 +0000 (21:05 +0200)
Patch by vmrsss %vmrsss A gmail P com%

Makefile
configure
gtk/Makefile

index e80120e..4e0d1c8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -161,7 +161,7 @@ install: x264$(EXE) $(SONAME)
 ifeq ($(SYS),MINGW)
        $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(bindir))
 else
-       $(if $(SONAME), ln -sf $(SONAME) $(DESTDIR)$(libdir)/libx264.so)
+       $(if $(SONAME), ln -sf $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX))
        $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(libdir))
 endif
        $(if $(IMPLIBNAME), install -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir))
@@ -172,7 +172,7 @@ install-gtk: libx264gtk.a
 uninstall:
        rm -f $(DESTDIR)$(includedir)/x264.h $(DESTDIR)$(libdir)/libx264.a
        rm -f $(DESTDIR)$(bindir)/x264 $(DESTDIR)$(libdir)/pkgconfig/x264.pc
-       $(if $(SONAME), rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.so)
+       $(if $(SONAME), rm -f $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX))
        $(MAKE) -C gtk uninstall
 
 etags: TAGS
index adb2748..34d99b4 100755 (executable)
--- a/configure
+++ b/configure
@@ -455,15 +455,25 @@ if [ "$shared" = "yes" ]; then
         echo 'IMPLIBNAME=libx264.dll.a' >> config.mak
         echo 'SOFLAGS=-Wl,--out-implib,$(IMPLIBNAME) -Wl,--enable-auto-image-base' >> config.mak
     elif [ "$SYS" = "MACOSX" ]; then
+        echo "SOSUFFIX=dylib" >> config.mak
         echo "SONAME=libx264.$API.dylib" >> config.mak
-        echo 'SOFLAGS=-dynamiclib -Wl,-single_module -Wl,-read_only_relocs,suppress' >> config.mak        
+        echo 'SOFLAGS=-dynamiclib -Wl,-single_module -Wl,-read_only_relocs,suppress -install_name $(DESTDIR)$(libdir)/$(SONAME)' >> config.mak
     else
+        echo "SOSUFFIX=so" >> config.mak
         echo "SONAME=libx264.so.$API" >> config.mak
         echo 'SOFLAGS=-Wl,-soname,$(SONAME)' >> config.mak
     fi
     echo 'default: $(SONAME)' >> config.mak
     if [ "$gtk" = "yes" ]; then
-        echo "SONAMEGTK=libx264gtk.so.$API" >> gtk/config.mak
+        if [ "$SYS" = "MACOSX" ]; then
+            echo "SOSUFFIX=dylib" >> gtk/config.mak
+            echo "SONAMEGTK=libx264gtk.$API.dylib" >> gtk/config.mak
+            echo 'SOFLAGS=-dynamiclib -Wl,-single_module -Wl,-read_only_relocs,suppress -install_name $(DESTDIR)$(libdir)/$(SONAMEGTK)' >> gtk/config.mak
+        else
+            echo "SOSUFFIX=so" >> gtk/config.mak
+            echo "SONAMEGTK=libx264gtk.so.$API" >> gtk/config.mak
+            echo 'SOFLAGS=-Wl,-soname,$(SONAME)' >> gtk/config.mak
+        fi
     fi
 fi
 
index 554ff1d..ac4b01c 100644 (file)
@@ -93,7 +93,7 @@ libx264gtk.a: $(OBJECTS_LIB)
 
 $(SONAMEGTK): $(OBJECTS_LIB)
        @echo "  L: $(@F)"
-       @$(CC) -shared -o $@ $(OBJECTS_LIB) -Wl,-soname,$(SONAMEGTK) $(LDFLAGS)
+       @$(CC) -shared -o $@ $(OBJECTS_LIB) $(SOFLAGS) $(LDFLAGS)
 
 # Program : test
 $(TEST_BIN): $(OBJECTS_LIB) $(OBJECTS_TEST)
@@ -142,8 +142,8 @@ install: $(ENCODE_BIN)
        @install -d "$(DESTDIR)$(libdir)"
        @echo "  I: $(DESTDIR)$(libdir)/libx264gtk.a"
        @install -m 644 libx264gtk.a "$(DESTDIR)$(libdir)"
-       @echo "  I: $(DESTDIR)$(libdir)/libx264gtk.so"
-       @$(if $(SONAMEGTK), ln -sf $(SONAMEGTK) $(DESTDIR)$(libdir)/libx264gtk.so)
+       @echo "  I: $(DESTDIR)$(libdir)/libx264gtk.$(SOSUFFIX)"
+       @$(if $(SONAMEGTK), ln -sf $(SONAMEGTK) $(DESTDIR)$(libdir)/libx264gtk.$(SOSUFFIX))
        @$(if $(SONAMEGTK), install -m 755 $(SONAMEGTK) $(DESTDIR)$(libdir))
        @echo "  D: $(DESTDIR)$(bindir)"
        @install -d "$(DESTDIR)$(bindir)"
@@ -172,9 +172,9 @@ uninstall:
        @rm -f "$(DESTDIR)$(includedir)/x264_gtk_enum.h"
        @echo "  U: $(DESTDIR)$(libdir)/libx264gtk.a"
        @rm -f "$(DESTDIR)$(libdir)/libx264gtk.a"
-       @echo "  U: $(DESTDIR)$(libdir)/libx264gtk.so"
+       @echo "  U: $(DESTDIR)$(libdir)/$(SONAMEGTK)"
        @$(if $(SONAMEGTK), rm -f "$(DESTDIR)$(libdir)/$(SONAMEGTK)")
-       @rm -f "$(DESTDIR)$(libdir)/libx264gtk.so"
+       @rm -f "$(DESTDIR)$(libdir)/libx264gtk.$(SOSUFFIX)"
        @echo "  U: $(DESTDIR)$(bindir)/$(ENCODE_BIN)"
        @rm -f "$(DESTDIR)$(bindir)/$(ENCODE_BIN)"
        @echo "  U: $(DESTDIR)${datadir}/x264"