Skip to content
Snippets Groups Projects
Commit 08da6753 authored by Simon McVittie's avatar Simon McVittie
Browse files

Add symbolic constants for the i386 and x86_64 ABIs

parent 4dc869b3
No related branches found
No related tags found
1 merge request!7Add a skeleton for SrtLibrary, representing a shared library
...@@ -45,9 +45,9 @@ main (int argc, ...@@ -45,9 +45,9 @@ main (int argc,
g_print ("{\n"); g_print ("{\n");
g_print (" \"can-run\": {\n"); g_print (" \"can-run\": {\n");
g_print (" \"i386-linux-gnu\": %s,\n", g_print (" \"%s\": %s,\n", SRT_ABI_I386,
srt_architecture_can_run_i386 () ? "true" : "false"); srt_architecture_can_run_i386 () ? "true" : "false");
g_print (" \"x86_64-linux-gnu\": %s\n", g_print (" \"%s\": %s\n", SRT_ABI_X86_64,
srt_architecture_can_run_x86_64 () ? "true" : "false"); srt_architecture_can_run_x86_64 () ? "true" : "false");
g_print (" }\n"); g_print (" }\n");
......
...@@ -84,7 +84,7 @@ out: ...@@ -84,7 +84,7 @@ out:
/** /**
* srt_architecture_can_run_i386: * srt_architecture_can_run_i386:
* *
* Check whether we can run an i386 executable. * Check whether we can run an i386 (%SRT_ABI_I386) executable.
* *
* For this check to work as intended, the contents of the * For this check to work as intended, the contents of the
* `libsteam-runtime-tools-0-helpers:i386` package must be available * `libsteam-runtime-tools-0-helpers:i386` package must be available
...@@ -107,13 +107,13 @@ out: ...@@ -107,13 +107,13 @@ out:
gboolean gboolean
srt_architecture_can_run_i386 (void) srt_architecture_can_run_i386 (void)
{ {
return _srt_architecture_can_run ("i386-linux-gnu"); return _srt_architecture_can_run (SRT_ABI_I386);
} }
/** /**
* srt_architecture_can_run_x86_64: * srt_architecture_can_run_x86_64:
* *
* Check whether we can run an x86_64 executable. * Check whether we can run an x86_64 (%SRT_ABI_X86_64) executable.
* *
* For this check to work as intended, the contents of the * For this check to work as intended, the contents of the
* `libsteam-runtime-tools-0-helpers:amd64` package must be available * `libsteam-runtime-tools-0-helpers:amd64` package must be available
...@@ -125,5 +125,5 @@ srt_architecture_can_run_i386 (void) ...@@ -125,5 +125,5 @@ srt_architecture_can_run_i386 (void)
gboolean gboolean
srt_architecture_can_run_x86_64 (void) srt_architecture_can_run_x86_64 (void)
{ {
return _srt_architecture_can_run ("x86_64-linux-gnu"); return _srt_architecture_can_run (SRT_ABI_X86_64);
} }
...@@ -31,5 +31,21 @@ ...@@ -31,5 +31,21 @@
#include <glib.h> #include <glib.h>
/**
* SRT_ABI_I386:
*
* The multiarch tuple for the i386 (IA-32) ABI normally used on
* 32-bit x86 Linux.
*/
#define SRT_ABI_I386 "i386-linux-gnu"
/**
* SRT_ABI_X86_64:
*
* The multiarch tuple for the x86_64 ABI normally used on
* 64-bit x86 Linux.
*/
#define SRT_ABI_X86_64 "x86_64-linux-gnu"
gboolean srt_architecture_can_run_i386 (void); gboolean srt_architecture_can_run_i386 (void);
gboolean srt_architecture_can_run_x86_64 (void); gboolean srt_architecture_can_run_x86_64 (void);
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
/* /*
* _srt_library_new: * _srt_library_new:
* @multiarch_tuple: A multiarch tuple like i386-linux-gnu, * @multiarch_tuple: A multiarch tuple like %SRT_ABI_I386,
* representing an ABI * representing an ABI
* @soname: A SONAME like libz.so.1 * @soname: A SONAME like libz.so.1
* @issues: Problems found when loading a @multiarch_tuple copy * @issues: Problems found when loading a @multiarch_tuple copy
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "steam-runtime-tools/library.h" #include "steam-runtime-tools/library.h"
#include "steam-runtime-tools/architecture.h"
#include "steam-runtime-tools/enums.h" #include "steam-runtime-tools/enums.h"
/** /**
...@@ -183,8 +184,8 @@ srt_library_class_init (SrtLibraryClass *cls) ...@@ -183,8 +184,8 @@ srt_library_class_init (SrtLibraryClass *cls)
properties[PROP_MULTIARCH_TUPLE] = properties[PROP_MULTIARCH_TUPLE] =
g_param_spec_string ("multiarch-tuple", "Multiarch tuple", g_param_spec_string ("multiarch-tuple", "Multiarch tuple",
"Debian-style multiarch tuple representing the " "Debian-style multiarch tuple representing the "
"ABI of this library, usually i386-linux-gnu " "ABI of this library, usually " SRT_ABI_I386 " "
"or x86_64-linux-gnu", "or " SRT_ABI_X86_64,
NULL, NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS); G_PARAM_STATIC_STRINGS);
...@@ -220,8 +221,8 @@ srt_library_get_soname (SrtLibrary *self) ...@@ -220,8 +221,8 @@ srt_library_get_soname (SrtLibrary *self)
* *
* Return the multiarch tuple representing the ABI of @self. * Return the multiarch tuple representing the ABI of @self.
* *
* Returns: A Debian-style multiarch tuple, usually `i386-linux-gnu` * Returns: A Debian-style multiarch tuple, usually %SRT_ABI_I386
* or `x86_64-linux-gnu` * or %SRT_ABI_X86_64
*/ */
const char * const char *
srt_library_get_multiarch_tuple (SrtLibrary *self) srt_library_get_multiarch_tuple (SrtLibrary *self)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment