summaryrefslogtreecommitdiffstats
path: root/devel/liboil/files/patch-liboil_liboilcpu.c
diff options
context:
space:
mode:
authorahze <ahze@df743ca5-7f9a-e211-a948-0013205c9059>2006-02-09 21:04:17 +0800
committerahze <ahze@df743ca5-7f9a-e211-a948-0013205c9059>2006-02-09 21:04:17 +0800
commitc52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec (patch)
treee27172b05e6bb821d816368b4b4dbd8e89e7733c /devel/liboil/files/patch-liboil_liboilcpu.c
parent45481de29c8dd2fc2fce4c2bdbb99324a41c7756 (diff)
downloadmarcuscom-ports-c52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec.tar
marcuscom-ports-c52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec.tar.gz
marcuscom-ports-c52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec.tar.bz2
marcuscom-ports-c52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec.tar.lz
marcuscom-ports-c52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec.tar.xz
marcuscom-ports-c52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec.tar.zst
marcuscom-ports-c52d29171d2dcaf022c2f84c54a8fb48ec3ef0ec.zip
- Add liboil at version 0.3.6, in preps of gstreamer 0.10.3
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@5646 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'devel/liboil/files/patch-liboil_liboilcpu.c')
-rw-r--r--devel/liboil/files/patch-liboil_liboilcpu.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/devel/liboil/files/patch-liboil_liboilcpu.c b/devel/liboil/files/patch-liboil_liboilcpu.c
new file mode 100644
index 000000000..6d5a57f46
--- /dev/null
+++ b/devel/liboil/files/patch-liboil_liboilcpu.c
@@ -0,0 +1,107 @@
+--- liboil/liboilcpu.c.orig Sat May 21 14:12:56 2005
++++ liboil/liboilcpu.c Sat May 21 14:34:37 2005
+@@ -59,7 +59,11 @@
+ cpuinfo = malloc(4096);
+ if (cpuinfo == NULL) return NULL;
+
++#if defined(__FreeBSD__)
++ fd = open("/var/run/dmesg.boot", O_RDONLY);
++#else
+ fd = open("/proc/cpuinfo", O_RDONLY);
++#endif
+ if (fd < 0) return NULL;
+
+ n = read(fd, cpuinfo, 4095);
+@@ -84,6 +88,37 @@
+ }
+
+ flags = strsplit(cpuinfo_flags);
++#if defined(__FreeBSD__)
++ for (f = flags; *f; f++) {
++ if (strcmp (*f, "CMOV") == 0) {
++ OIL_DEBUG ("cpu flag %s", *f);
++ oil_cpu_flags |= OIL_IMPL_FLAG_CMOV;
++ }
++ if (strcmp (*f, "MMX") == 0) {
++ OIL_DEBUG ("cpu flag %s", *f);
++ oil_cpu_flags |= OIL_IMPL_FLAG_MMX;
++ }
++ if (strcmp (*f, "SSE") == 0) {
++ OIL_DEBUG ("cpu flag %s", *f);
++ oil_cpu_flags |= OIL_IMPL_FLAG_SSE;
++ }
++ if (strcmp (*f, "AMIE") == 0) {
++ OIL_DEBUG ("cpu flag %s", *f);
++ oil_cpu_flags |= OIL_IMPL_FLAG_MMXEXT;
++ }
++ if (strcmp (*f, "SSE2") == 0) {
++ OIL_DEBUG ("cpu flag %s", *f);
++ oil_cpu_flags |= OIL_IMPL_FLAG_SSE2;
++ }
++ if (strcmp (*f, "3DNow!") == 0) {
++ OIL_DEBUG ("cpu flag %s", *f);
++ oil_cpu_flags |= OIL_IMPL_FLAG_3DNOW;
++ }
++ if (strcmp (*f, "DSP") == 0) {
++ OIL_DEBUG ("cpu flag %s", *f);
++ oil_cpu_flags |= OIL_IMPL_FLAG_3DNOWEXT;
++ }
++#else
+ for (f = flags; *f; f++) {
+ if (strcmp (*f, "cmov") == 0) {
+ OIL_DEBUG ("cpu flag %s", *f);
+@@ -113,6 +148,7 @@
+ OIL_DEBUG ("cpu flag %s", *f);
+ oil_cpu_flags |= OIL_IMPL_FLAG_3DNOWEXT;
+ }
++#endif
+
+ free (*f);
+ }
+@@ -282,12 +318,22 @@
+ char *end;
+ char *colon;
+
++#if defined(__FreeBSD__)
++ flags = strstr(cpuinfo,"Features");
++#else
+ flags = strstr(cpuinfo,"flags");
++#endif
+ if (flags == NULL) return NULL;
+
++#if defined(__FreeBSD__)
++ end = strchr(flags, '>');
++ if (end == NULL) return NULL;
++ colon = strchr (flags, '<');
++#else
+ end = strchr(flags, '\n');
+ if (end == NULL) return NULL;
+ colon = strchr (flags, ':');
++#endif
+ if (colon == NULL) return NULL;
+ colon++;
+ if(colon >= end) return NULL;
+@@ -303,15 +349,22 @@
+ char *tok;
+ int n = 0;
+
++#if !defined(__FreeBSD__)
+ while (*s == ' ') s++;
++#endif
+
+ list = malloc (1 * sizeof(char *));
+ while (*s) {
+ tok = s;
++#if defined(__FreeBSD__)
++ while (*s && *s != ',') s++;
++ list[n] = _strndup (tok, s - tok);
++ s++;
++#else
+ while (*s && *s != ' ') s++;
+-
+ list[n] = _strndup (tok, s - tok);
+ while (*s && *s == ' ') s++;
++#endif
+ list = realloc (list, (n + 2) * sizeof(char *));
+ n++;
+ }