Przeglądaj źródła

Merge pull request #63 from gicmo/ltversion

Introduce libtool like library versioning
Alex Smith 6 lat temu
rodzic
commit
9631e6ddc4
3 zmienionych plików z 42 dodań i 6 usunięć
  1. 3 3
      README.md
  2. 1 1
      lib/gamemode_client.h
  3. 38 2
      lib/meson.build

+ 3 - 3
README.md

@@ -57,13 +57,13 @@ This will also satisfy the build requirement `inih` by pulling it in as a git su
 ## Requesting GameMode
 ## Requesting GameMode
 
 
 ### Users
 ### Users
-After installing `libgamemodeauto.so` simply preload it into the game:
+After installing `libgamemodeauto.so.0` simply preload it into the game:
 ```bash
 ```bash
-LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so ./game
+LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so.0 ./game
 ```
 ```
 Or edit the steam launch options:
 Or edit the steam launch options:
 ```bash
 ```bash
-LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so %command%
+LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so.0 %command%
 ```
 ```
 Please note the backslash here in `\$LIB` is required.
 Please note the backslash here in `\$LIB` is required.
 
 

+ 1 - 1
lib/gamemode_client.h

@@ -152,7 +152,7 @@ __attribute__((always_inline)) static inline int internal_load_libgamemode(void)
 	void *libgamemode = NULL;
 	void *libgamemode = NULL;
 
 
 	/* Try and load libgamemode */
 	/* Try and load libgamemode */
-	libgamemode = dlopen("libgamemode.so", RTLD_NOW);
+	libgamemode = dlopen("libgamemode.so.0", RTLD_NOW);
 	if (!libgamemode) {
 	if (!libgamemode) {
 		snprintf(internal_gamemode_client_error_string,
 		snprintf(internal_gamemode_client_error_string,
 		         sizeof(internal_gamemode_client_error_string),
 		         sizeof(internal_gamemode_client_error_string),

+ 38 - 2
lib/meson.build

@@ -1,5 +1,12 @@
+# Libtool like versioning (current.revision.age) for the libraries
+# See https://www.sourceware.org/autobook/autobook/autobook_61.html#Library-Versioning
+lt_current = '0'
+lt_revision = '0'
+lt_age = '0'
+lt_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision)
+
 # Main client library to message the daemon
 # Main client library to message the daemon
-shared_library(
+gamemode = shared_library(
     'gamemode',
     'gamemode',
     sources: [
     sources: [
         'client_impl.c',
         'client_impl.c',
@@ -8,6 +15,8 @@ shared_library(
         dep_systemd,
         dep_systemd,
     ],
     ],
     install: true,
     install: true,
+    soversion: lt_current,
+    version: lt_version,
 )
 )
 
 
 libgamemode_includes = [
 libgamemode_includes = [
@@ -15,7 +24,7 @@ libgamemode_includes = [
 ]
 ]
 
 
 # Small library to automatically use gamemode
 # Small library to automatically use gamemode
-shared_library(
+gamemodeauto = shared_library(
     'gamemodeauto',
     'gamemodeauto',
     sources: [
     sources: [
         'client_loader.c',
         'client_loader.c',
@@ -24,6 +33,8 @@ shared_library(
         libdl,
         libdl,
     ],
     ],
     install: true,
     install: true,
+    soversion: lt_current,
+    version: lt_version,
 )
 )
 
 
 # Install the gamemode_client header
 # Install the gamemode_client header
@@ -32,3 +43,28 @@ gamemode_headers = [
 ]
 ]
 
 
 install_headers(gamemode_headers)
 install_headers(gamemode_headers)
+
+# Generate a pkg-config files
+pkg = import('pkgconfig')
+desc = 'GameMode temporarily applies game specific optimisations to the host OS.'
+pkg.generate(
+  name: 'gamemode',
+  description: desc,
+  filebase: 'gamemode',
+  version: meson.project_version(),
+  libraries: [
+    libdl
+  ],
+)
+
+pkg.generate(
+  name: 'gamemode',
+  description: desc,
+  filebase: 'gamemode-auto',
+  libraries: gamemodeauto,
+  version: meson.project_version(),
+  libraries_private: [
+    libdl
+  ],
+)
+