spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 9b201a9ef121963bcd21647bc21ec2ea9793c2a4
parent 9617eab9d4e2ace6b3f6713f78a81ae30201a763
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Mon, 28 Jun 2010 17:13:44 +1000

Fix platform detection

Get rid of sys/utsname.h reference, it's not available on mingw32.

Diffstat:
Mconfigure.ac | 7+++++++
Msrc/Makefile.am | 4+---
Msrc/spek-spectrogram.vala | 9++++-----
Mvapi/Makefile.am | 3+--
Mvapi/config.vapi | 3+++
Dvapi/sys.vapi | 15---------------
6 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -4,6 +4,13 @@ AC_INIT([spek], [0.5]) AC_CONFIG_SRCDIR([src/spek.vala]) AC_CONFIG_HEADERS([config.h]) +# Determine the system type. +AC_CANONICAL_HOST +AC_SUBST(host_os) +AC_DEFINE_UNQUOTED(HOST_OS, "$host_os", + [Define the canonical host OS type.] +) + AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2]) # Enable silent rules is available diff --git a/src/Makefile.am b/src/Makefile.am @@ -9,7 +9,6 @@ spek_SOURCES = \ INCLUDES = \ -include config.h \ - -include sys/utsname.h \ $(SPEK_CFLAGS) \ $(IGE_MAC_CFLAGS) \ -DLOCALEDIR=\""$(localedir)"\" \ @@ -17,8 +16,7 @@ INCLUDES = \ -DPKGLIBDIR=\""$(pkglibdir)"\" VALAFLAGS = \ - --vapidir=$(srcdir)/../vapi - --pkg config --pkg sys \ + --vapidir=$(srcdir)/../vapi --pkg config \ @SPEK_PACKAGES@ spek_LDADD = \ diff --git a/src/spek-spectrogram.vala b/src/spek-spectrogram.vala @@ -20,7 +20,6 @@ using Cairo; using Gdk; using Gtk; using Pango; -using Sys; namespace Spek { class Spectrogram : DrawingArea { @@ -41,13 +40,13 @@ namespace Spek { private const int BPAD = 40; private const int GAP = 10; private const int RULER = 10; - private double FONT_SCALE; + private double FONT_SCALE = 1.0; public Spectrogram () { // Pango/Quartz fonts are smaller than on X. - var name = UtsName (); - uname (ref name); - FONT_SCALE = name.sysname == "Darwin" ? 1.5 : 1.0; + if (Config.HOST_OS.down ().has_prefix ("darwin")) { + FONT_SCALE = 1.4; + } // Pre-draw the palette. palette = new ImageSurface (Format.RGB24, RULER, BANDS); diff --git a/vapi/Makefile.am b/vapi/Makefile.am @@ -1,6 +1,5 @@ noinst_DATA = \ - config.vapi \ - sys.vapi + config.vapi EXTRA_DIST = \ $(noinst_DATA) diff --git a/vapi/config.vapi b/vapi/config.vapi @@ -13,4 +13,7 @@ namespace Config { public const string LOCALEDIR; /* /usr/local/share/locale */ public const string PKGDATADIR; /* /usr/local/share/spek */ public const string PKGLIBDIR; /* /usr/local/lib/spek */ + + /* linux*, mingw*, or darwin* */ + public const string HOST_OS; } diff --git a/vapi/sys.vapi b/vapi/sys.vapi @@ -1,14 +0,0 @@ -[CCode (cheader_filename = "sys/utsname.h")] -namespace Sys { - [CCode (cname = "struct utsname")] - public struct UtsName { - public weak string sysname; - public weak string nodename; - public weak string release; - public weak string version; - public weak string machine; - public weak string domainname; - } - [CCode (cname = "uname")] - public int uname (ref UtsName name); -} -\ No newline at end of file