aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/changelog8
-rwxr-xr-xdebian/rules102
2 files changed, 16 insertions, 94 deletions
diff --git a/debian/changelog b/debian/changelog
index 08a5e84..706eb12 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+libconfig (1.4.8-5) UNRELEASED; urgency=low
+
+ * Switch to dh_9 style rules file
+ - Hardened buildflags now provided automatically
+ - Fixes E-binary-arch-produces-all buildd warning
+
+ -- Jonathan McCrohan <jmccrohan@gmail.com> Fri, 27 Apr 2012 01:50:40 +0100
+
libconfig (1.4.8-4) unstable; urgency=low
* Add C++ hardened buildflags
diff --git a/debian/rules b/debian/rules
index 4de4b58..b070a1e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,101 +1,15 @@
#!/usr/bin/make -f
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
-
-CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
-CFLAGS += -Wall -g
-CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
-CXXFLAGS += -Wall -g
-LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
-LDFLAGS += -Wl,-z,defs
-CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
-export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
-
-# shared library versions, option 1
-version=9
-major=9
-minor=0
-
-
-config.status: configure
- dh_testdir
- test -e config.sub -a -L config.sub || \
- ln -sf /usr/share/misc/config.sub config.sub
- test -e config.guess -a -L config.guess || \
- ln -sf /usr/share/misc/config.guess config.guess
-
- ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
- --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
- --prefix=/usr \
- --mandir=\$${prefix}/share/man \
- --infodir=\$${prefix}/share/info
-
-build: build-arch build-indep
-
-build-arch: build-stamp
-
-build-indep: build-stamp
-
-build-stamp: config.status
- dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE)
+# Uncomment this to turn on verbose mode.
+# # export DH_VERBOSE=1
+override_dh_auto_build:
$(MAKE) -C doc pdf
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
-
- [ ! -f Makefile ] || $(MAKE) distclean
-
- rm -f build-stamp
-
- $(RM) config.guess config.sub config.log
- dh_clean
+ dh_auto_build
-install: build
- dh_testdir
- dh_testroot
- dh_prep
- dh_installdirs
-
- # Add here commands to install the package into debian/tmp
- $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
- $(RM) .libs/*.la
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs ChangeLog
- dh_installdocs
- dh_installexamples
- dh_install
- dh_installinfo
- dh_installman
- dh_link
+override_dh_strip:
dh_strip -p libconfig9 --dbg-package=libconfig-dbg
dh_strip -p libconfig++9 --dbg-package=libconfig++-dbg
- dh_compress
- dh_fixperms
- dh_makeshlibs -p libconfig9
- dh_makeshlibs -p libconfig++9
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+
+%:
+ dh $@ --with autotools-dev
ghlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* $Id: plugin_i2c_sensors.c,v 1.6 2004/01/30 07:12:35 reinelt Exp $
 *
 * I2C sensors plugin
 *
 * Copyright 2003,2004 Xavier Vello <xavier66@free.fr>
 *
 * This file is part of LCD4Linux.
 *
 * LCD4Linux is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * LCD4Linux is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 * $Log: plugin_i2c_sensors.c,v $
 * Revision 1.6  2004/01/30 07:12:35  reinelt
 * HD44780 busy-flag support from Martin Hejl
 * loadavg() uClibc replacement from Martin Heyl
 * round() uClibc replacement from Martin Hejl
 * warning in i2c_sensors fixed
 * [
 *
 * Revision 1.5  2004/01/29 05:55:30  reinelt
 * check for /sys mounted
 *
 * Revision 1.4  2004/01/29 04:40:02  reinelt
 * every .c file includes "config.h" now
 *
 * Revision 1.3  2004/01/27 08:13:39  reinelt
 * ported PPP token to plugin_ppp
 *
 * Revision 1.2  2004/01/27 05:06:10  reinelt
 * i2c update from Xavier
 *
 * Revision 1.1  2004/01/10 17:36:56  reinelt
 *
 * I2C Sensors plugin from Xavier added
 *
 *
 */

/* 
 * exported functions:
 *
 * int plugin_init_i2c_sensors (void)
 *  adds function i2c_sensors() to retrieve informations from
 *  the i2c sensors via the sysfs interface of 2.6.x kernels
 *
 * -- WARNING --
 * This plugin is only for kernel series 2.5/2.6 and higher !
 * It uses the new sysfs pseudo-filesystem that you can mount with:
 *       mount -t sysfs none /sys
 *
 * -- WARNING #2 --
 * This plugin should detect where your sensors are at startup.
 * If you can't get any token to work, ensure you don't get
 * an error message with "lcd4linux -Fvvv".
 *
 * If so, try to force the path to your sensors in the conf like this :
 *   i2c_sensors-path '/sys/bus/i2c/devices/0-6000/'
 *   (replace 0-6000 with the appropriate dir)
 *
 */

#include "config.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>

#include "debug.h"
#include "plugin.h"
#include "cfg.h"
#include "hash.h"

static char *path=NULL;
static HASH I2Csensors = { 0, };

static int parse_i2c_sensors(RESULT *arg)
{
  double value;
  char val[32];
  char buffer[32];
  char *key=R2S(arg);
  char file[64];
  FILE *stream;

  // construct absolute path to the file to read
  strcpy(file, path);
  strcat(file, key);

  // read of file to buffer
  stream=fopen(file, "r");
  if (stream==NULL) {
    error ("fopen(%s) failed",file);
    return -1;
  }
  fgets (buffer, sizeof(buffer), stream);
  fclose (stream);
  
  if (!buffer) {
    error ("%s empty ?!",file);	  
    return -1;
  }

  // now the formating stuff, depending on the file :
  // Some values must be divided by 1000, the others
  // are parsed directly (we just remove the \n).
  if (!strncmp(key, "temp_", 5)  ||
      !strncmp(key, "curr_", 5)  ||
      !strncmp(key, "in_", 3)    ||
      !strncmp(key, "vid", 3)) {
    value = strtod(buffer, NULL);
    // FIXME: any way to do this without converting to double ?		  
    value /= 1000.0;
    sprintf(val, "%f", value);   
		  
  } else {
    sprintf(val, "%s", buffer); 
	// we supress this nasty \n at the end
	val[strlen(val)-1]='\0';
  } 
  
  hash_set (&I2Csensors, key, val);
  return 0; 

}  

void my_i2c_sensors (RESULT *result, RESULT *arg)
{
  int age;
  char *val;
  char *key=R2S(arg);  
  
  age=hash_age(&I2Csensors, key, &val);
  // refresh every 100msec
  if (age<0 || age>100)
  {
    parse_i2c_sensors(arg);
    val=hash_get(&I2Csensors, key);
  }
  if (val) {
    SetResult(&result, R_STRING, val); 
  } else {
    SetResult(&result, R_STRING, "??"); 
  }
}

void my_i2c_sensors_path(void)
{
  struct dirent *dir;
  struct dirent *file;
  const char *base="/sys/bus/i2c/devices/";
  char dname[64];
  DIR *fd1;
  DIR *fd2;
  int done;
  
  fd1 = opendir(base);
  if (!fd1) {
    error("[i2c_sensors] Impossible to open %s! Is /sys mounted?", base);
    return;
  }
  
  while((dir = readdir(fd1)))   {
    // Skip '.' and '..'
    if (strcmp(dir->d_name, "." )==0 ||
	strcmp(dir->d_name, "..")==0) {
      continue;
    }

    // dname is the absolute path
    strcpy(dname, base);		
    strcat(dname, dir->d_name);
    strcat(dname, "/"); 
    
    fd2 = opendir(dname);
    done = 0;
    while((file = readdir(fd2))) {
      if (!strcmp(file->d_name, "temp_input1")) { // FIXME : do all sensors have a temp_input1 ?
	path = realloc(path, strlen(dname)+1);
	strcpy(path, dname);			  
	done=1;
	break;
      }
    }
    closedir(fd2);
    if (done) break;
  }
  closedir(fd1);
}

int plugin_init_i2c_sensors (void)
{
  char *path_cfg=cfg_get(NULL, "i2c_sensors-path", "");

  if (strncmp(path_cfg, "/", 1)) {
    debug("No path to i2c sensors found in the conf, calling my_i2c_sensors_path()");
    my_i2c_sensors_path();
	if (!path) {
      error("[i2c_sensors] No i2c sensors found via the i2c interface !");
      error("[i2c_sensors] Try to specify the path to the sensors !");
    } else {
      debug("Your i2c sensors are probably in %s", path);
      debug("if i2c_sensors doesn't work, try to specify the path in your conf");
    }
	
  } else {
	if (path_cfg[strlen(path_cfg)-1] != '/') {
      // the headless user forgot the trailing slash :/
      debug("adding a trailing slash at the end of the path");
      path_cfg = realloc(path_cfg, strlen(path_cfg)+2);
      strcat(path_cfg, "/");
    }
    debug("Path to i2c sensors from the conf : %s", path_cfg);
    debug("if i2c_sensors doesn't work, double check this value !");
    path = realloc(path, strlen(path_cfg)+1);
    strcpy(path, path_cfg);
	free(path_cfg);
  }

  // we activate the function only if there's a possibly path found
  if (!path) {
  free(path);
  } else {
  AddFunction ("i2c_sensors", 1, my_i2c_sensors);
  }
 
  return 0;
}