mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 19:50:05 +02:00
libprefs: enable x86 architecture and fix undefined reference.
Needed for bghostview.
This commit is contained in:
@@ -8,14 +8,14 @@ is."
|
||||
HOMEPAGE="http://ftp.icm.edu.pl/pub/beos/contrib/libraries/"
|
||||
COPYRIGHT="1998 Jon Watte"
|
||||
LICENSE="Public Domain"
|
||||
REVISION="2"
|
||||
REVISION="3"
|
||||
SOURCE_URI="http://ftp.icm.edu.pl/pub/beos/contrib/libraries/libprefs125.zip"
|
||||
CHECKSUM_SHA256="39532c9c6c69f915a6d99fde4fd827a5bdb676ee0cf00558b6956fc91db9a737"
|
||||
SOURCE_DIR="libprefs125"
|
||||
PATCHES="libprefs-1.2.5.patch"
|
||||
PATCHES="libprefs-1.2.5.patchset"
|
||||
|
||||
ARCHITECTURES="x86_gcc2 !x86 !x86_64"
|
||||
SECONDARY_ARCHITECTURES="x86_gcc2 !x86"
|
||||
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
|
||||
|
||||
PROVIDES="
|
||||
libprefs$secondaryArchSuffix = $portVersion
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
diff --git a/src/libprefs.cpp b/src/libprefs.cpp
|
||||
index da58013..90d0aa4 100644
|
||||
--- a/src/libprefs.cpp
|
||||
+++ b/src/libprefs.cpp
|
||||
@@ -71,6 +71,7 @@
|
||||
#include <image.h>
|
||||
#endif
|
||||
|
||||
+#include <Entry.h>
|
||||
|
||||
/* identifier for this implementation of the prefs library */
|
||||
#define PREF_VERSION_STRING "simple libprefs.so version 1.2.4"
|
||||
@@ -435,7 +436,7 @@ _PREFMakePath(
|
||||
{
|
||||
status_t err = B_OK;
|
||||
BPath bpath;
|
||||
- err = find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL);
|
||||
+ err = find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL);
|
||||
if (err < B_OK) return err;
|
||||
strncpy(path, bpath.Path(), path_max);
|
||||
path[path_max-1] = 0;
|
||||
@@ -894,9 +895,9 @@ PREFReloadSet(PREFData data)
|
||||
#if DEBUG
|
||||
printf("reload read %d\n", rd);
|
||||
#endif
|
||||
+ char * buffer = (char *)malloc(size);
|
||||
if (rd < 0) { err = rd; goto cleanup; }
|
||||
if (rd != sizeof(size)) { err = B_ERROR; goto cleanup; }
|
||||
- char * buffer = (char *)malloc(size);
|
||||
if (buffer == NULL) { err = B_NO_MEMORY; goto cleanup; }
|
||||
rd = read(data->transaction->fd, buffer, size);
|
||||
#if DEBUG
|
||||
@@ -1156,7 +1157,7 @@ typedef struct _PREFAppIterator {
|
||||
curItem = 0;
|
||||
item = new char*[block];
|
||||
BPath bpath;
|
||||
- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
+ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
{
|
||||
BDirectory dir(bpath.Path());
|
||||
BEntry entry;
|
||||
@@ -1278,7 +1279,7 @@ typedef struct _PREFSetIterator
|
||||
curItem = 0;
|
||||
item = new char*[block];
|
||||
BPath bpath;
|
||||
- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
+ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
{
|
||||
char str[B_FILE_NAME_LENGTH+20];
|
||||
strcpy(str, LP_MAGIC);
|
||||
111
haiku-libs/libprefs/patches/libprefs-1.2.5.patchset
Normal file
111
haiku-libs/libprefs/patches/libprefs-1.2.5.patchset
Normal file
@@ -0,0 +1,111 @@
|
||||
From f8807bd4979b9ddd718100bf5af2e18228c84a8c Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Sun, 10 Mar 2019 16:47:58 +0100
|
||||
Subject: applying patch libprefs-1.2.5.patch
|
||||
|
||||
|
||||
diff --git a/src/libprefs.cpp b/src/libprefs.cpp
|
||||
index da58013..90d0aa4 100644
|
||||
--- a/src/libprefs.cpp
|
||||
+++ b/src/libprefs.cpp
|
||||
@@ -71,6 +71,7 @@
|
||||
#include <image.h>
|
||||
#endif
|
||||
|
||||
+#include <Entry.h>
|
||||
|
||||
/* identifier for this implementation of the prefs library */
|
||||
#define PREF_VERSION_STRING "simple libprefs.so version 1.2.4"
|
||||
@@ -435,7 +436,7 @@ _PREFMakePath(
|
||||
{
|
||||
status_t err = B_OK;
|
||||
BPath bpath;
|
||||
- err = find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL);
|
||||
+ err = find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL);
|
||||
if (err < B_OK) return err;
|
||||
strncpy(path, bpath.Path(), path_max);
|
||||
path[path_max-1] = 0;
|
||||
@@ -894,9 +895,9 @@ PREFReloadSet(PREFData data)
|
||||
#if DEBUG
|
||||
printf("reload read %d\n", rd);
|
||||
#endif
|
||||
+ char * buffer = (char *)malloc(size);
|
||||
if (rd < 0) { err = rd; goto cleanup; }
|
||||
if (rd != sizeof(size)) { err = B_ERROR; goto cleanup; }
|
||||
- char * buffer = (char *)malloc(size);
|
||||
if (buffer == NULL) { err = B_NO_MEMORY; goto cleanup; }
|
||||
rd = read(data->transaction->fd, buffer, size);
|
||||
#if DEBUG
|
||||
@@ -1156,7 +1157,7 @@ typedef struct _PREFAppIterator {
|
||||
curItem = 0;
|
||||
item = new char*[block];
|
||||
BPath bpath;
|
||||
- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
+ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
{
|
||||
BDirectory dir(bpath.Path());
|
||||
BEntry entry;
|
||||
@@ -1278,7 +1279,7 @@ typedef struct _PREFSetIterator
|
||||
curItem = 0;
|
||||
item = new char*[block];
|
||||
BPath bpath;
|
||||
- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
+ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL))
|
||||
{
|
||||
char str[B_FILE_NAME_LENGTH+20];
|
||||
strcpy(str, LP_MAGIC);
|
||||
--
|
||||
2.19.1
|
||||
|
||||
|
||||
From 3337f96a5487660f97dc1a51f17dbfd2b067e3e1 Mon Sep 17 00:00:00 2001
|
||||
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
Date: Sun, 10 Mar 2019 18:26:34 +0100
|
||||
Subject: Remove non-existant syscall.
|
||||
|
||||
|
||||
diff --git a/src/libprefs.cpp b/src/libprefs.cpp
|
||||
index 90d0aa4..50cd31d 100644
|
||||
--- a/src/libprefs.cpp
|
||||
+++ b/src/libprefs.cpp
|
||||
@@ -83,11 +83,6 @@ long long POLL_INTERVAL = 9000000; /* nine seconds */
|
||||
/* COMMON_DIRNAME is used to disambigue the case where user folder == common folder */
|
||||
#define COMMON_DIRNAME "(libprefs common)"
|
||||
|
||||
-/* some magic system calls */
|
||||
-extern "C" int _klock_node_(int fd);
|
||||
-extern "C" int _kunlock_node_(int fd);
|
||||
-
|
||||
-
|
||||
/* changes allowing hierarchical sets */
|
||||
#define PRE_121 0
|
||||
|
||||
@@ -1525,7 +1520,7 @@ PREFBeginTransaction(
|
||||
release_sem(fTransSem);
|
||||
/* open and lock file */
|
||||
open_again:
|
||||
- int fd = open(data->prefs, O_RDWR | O_CREAT, 0666);
|
||||
+ int fd = open(data->prefs, O_RDWR | O_CREAT | O_EXCL, 0666);
|
||||
#if DEBUG
|
||||
printf("open %s returns %d\n", data->prefs, fd);
|
||||
#endif
|
||||
@@ -1534,16 +1529,6 @@ open_again:
|
||||
if (fd < 0) printf("errno = %08x\n", errno);
|
||||
#endif
|
||||
if ((fd < 0) && (errno != EBUSY)) return fd;
|
||||
- if ((fd < 0) || (_klock_node_(fd) < B_OK))
|
||||
- { /* it is unfortunate that there is no atomic/blocking way to wait */
|
||||
- /* for exclusive access to a file - now we are forces to busy-wait */
|
||||
- if (fd >= 0) close(fd);
|
||||
-#if DEBUG
|
||||
- printf("can't lock - snoozing\n", fd);
|
||||
-#endif
|
||||
- snooze((rand()&0x7fff)+(find_thread(NULL)&0x7fff)+10000); // random snooze time to break ties
|
||||
- goto open_again;
|
||||
- }
|
||||
/* acquire transaction semaphore - this will always work, */
|
||||
/* because the transaction semaphore is never held across blocking system calls */
|
||||
acquire_sem(fTransSem);
|
||||
--
|
||||
2.19.1
|
||||
|
||||
Reference in New Issue
Block a user