Skip to contentSkip to conversation

package/pkg-autotools.mk: set --localstatedir=/var by default

PATCH New Jörg Krause 3 participants 6 messages Oct 17, 2014 – Oct 19, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/pkg-autotools.mk: set --localstatedir=/var by default

localstatedir is a common autoconf variable like prefix and sysconfdir. At this time 25 autotools and one generic package uses this Makefile variable. 22 of the autotools packages use --localstatedir=/var, the remaining use custom settings.

Setting localstatedir to /var is consistent with the Filesystem Hierarchy Standard (FHS). So it's time to move it as a common definition in the autotools infrastructure.

---
 package/pkg-autotools.mk | 2 ++
 1 file changed, 2 insertions(+)
package/pkg-autotools.mk +2 -0
index 2c93dd9..3c5430f 100644
@@ -134,6 +134,7 @@ define $(2)_CONFIGURE_CMDS
 		--prefix=/usr \
 		--exec-prefix=/usr \
 		--sysconfdir=/etc \
+		--localstatedir=/var \
 		--program-prefix="" \
 		--disable-gtk-doc \
 		--disable-doc \
@@ -165,6 +166,7 @@ define $(2)_CONFIGURE_CMDS
 		./configure \
 		--prefix="$$(HOST_DIR)/usr" \
 		--sysconfdir="$$(HOST_DIR)/etc" \
+		--localstatedir="$$(HOST_DIR)/var" \
 		--enable-shared --disable-static \
 		--disable-gtk-doc \
 		--disable-doc \
Signature · 1 line
2.1.2
#1 lore raw

PATCH 2/2 package/.mk files: remove --localstatedir=/var from autotools packages

Remove --localstatedir=/var from all autotools packages where it is no longer needed.

Also remove --localstatedir=/var/lib/dhcp from package dhcp. localstatedir is used by dhcp to set the default directory for the leases files. This can also be done by setting --with-*-lease-file=/var/lib/dhcp/*, which is done in dhcp.mk.

A custom --localstatedir is left in:
* proftpd.mk
* mysql.mk

This is safe to do:
One of the good thing with autoconf is that if you pass:

        --localstatedir=/var ... --localstatedir=/var/something

Then /var/something will be used. So, we can set --localstatedir=/var by default in the infrastructure, and still have certain packages doing weird things override it. [Thanks to Thomas Petazzoni]

---
 package/avahi/avahi.mk                                   | 2 +-
 package/bind/bind.mk                                     | 2 +-
 package/collectd/collectd.mk                             | 2 +-
 package/connman/connman.mk                               | 2 +-
 package/cups/cups.mk                                     | 3 +--
 package/dbus-glib/dbus-glib.mk                           | 2 +-
 package/dbus/dbus.mk                                     | 1 -
 package/dhcp/dhcp.mk                                     | 1 -
 package/directfb/directfb.mk                             | 1 -
 package/lighttpd/lighttpd.mk                             | 1 -
 package/ndisc6/ndisc6.mk                                 | 2 +-
 package/network-manager/network-manager.mk               | 1 -
 package/nss-mdns/nss-mdns.mk                             | 1 -
 package/oprofile/oprofile.mk                             | 1 -
 package/php/php.mk                                       | 1 -
 package/pulseaudio/pulseaudio.mk                         | 1 -
 package/samba/samba.mk                                   | 1 -
 package/sdl_net/sdl_net.mk                               | 2 +-
 package/sed/sed.mk                                       | 1 -
 package/sqlcipher/sqlcipher.mk                           | 3 +--
 package/sqlite/sqlite.mk                                 | 3 ---
 package/systemd/systemd.mk                               | 1 -
 package/x11r7/xserver_xorg-server/xserver_xorg-server.mk | 2 +-
 23 files changed, 10 insertions(+), 27 deletions(-)
package/avahi/avahi.mk +1 -1
index 706561f..93d093c 100644
@@ -67,7 +67,7 @@ AVAHI_CONF_ENV = ac_cv_func_strtod=yes \
 		avahi_cv_sys_cxx_works=yes \
 		DATADIRNAME=share
 
-AVAHI_CONF_OPTS = --localstatedir=/var \
+AVAHI_CONF_OPTS = \
 		--disable-qt3 \
 		--disable-qt4 \
 		--disable-gdbm \
package/bind/bind.mk +1 -1
index 88b6c9f..0dcfb40 100644
@@ -20,7 +20,7 @@ BIND_TARGET_SERVER_SBIN += dnssec-keyfromlabel dnssec-signzone
 BIND_TARGET_TOOLS_BIN = dig host nslookup nsupdate
 BIND_CONF_ENV = BUILD_CC="$(TARGET_CC)" \
 		BUILD_CFLAGS="$(TARGET_CFLAGS)"
-BIND_CONF_OPTS = --localstatedir=/var \
+BIND_CONF_OPTS = \
 		--with-randomdev=/dev/urandom \
 		--enable-epoll --with-libtool \
 		--with-gssapi=no --enable-rrl
package/collectd/collectd.mk +1 -1
index 27a7dfe..2dc27f5 100644
@@ -24,7 +24,7 @@ COLLECTD_PLUGINS_DISABLE = amqp apple_sensors aquaero ascent dbi email \
 COLLECTD_CONF_ENV += LIBS="-lm"
 
 COLLECTD_CONF_OPTS += --with-nan-emulation --with-fp-layout=nothing \
-	--localstatedir=/var --with-perl-bindings=no \
+	--with-perl-bindings=no \
 	$(foreach p, $(COLLECTD_PLUGINS_DISABLE), --disable-$(p)) \
 	$(if $(BR2_PACKAGE_COLLECTD_AGGREGATION),--enable-aggregation,--disable-aggregation) \
 	$(if $(BR2_PACKAGE_COLLECTD_APACHE),--enable-apache,--disable-apache) \
package/connman/connman.mk +1 -1
index fc1bb2c..8efc010 100644
@@ -11,7 +11,7 @@ CONNMAN_DEPENDENCIES = libglib2 dbus iptables
 CONNMAN_INSTALL_STAGING = YES
 CONNMAN_LICENSE = GPLv2
 CONNMAN_LICENSE_FILES = COPYING
-CONNMAN_CONF_OPTS += --localstatedir=/var \
+CONNMAN_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_CONNMAN_DEBUG),--enable-debug,--disable-debug)		\
 	$(if $(BR2_PACKAGE_CONNMAN_ETHERNET),--enable-ethernet,--disable-ethernet)	\
 	$(if $(BR2_PACKAGE_CONNMAN_WIFI),--enable-wifi,--disable-wifi)			\
package/cups/cups.mk +1 -2
index ff74577..318571d 100644
@@ -17,8 +17,7 @@ CUPS_CONF_OPTS = --without-perl \
 		--without-php \
 		--disable-gnutls \
 		--disable-gssapi \
-		--libdir=/usr/lib \
-		--localstatedir=/var
+		--libdir=/usr/lib
 CUPS_CONFIG_SCRIPTS = cups-config
 
 CUPS_DEPENDENCIES = $(if $(BR2_PACKAGE_ZLIB),zlib) \
package/dbus-glib/dbus-glib.mk +1 -1
index 231c558..369bac9 100644
@@ -14,7 +14,7 @@ DBUS_GLIB_CONF_ENV = ac_cv_have_abstract_sockets=yes \
 		ac_cv_func_posix_getpwnam_r=yes \
 		have_abstract_sockets=yes
 
-DBUS_GLIB_CONF_OPTS = --localstatedir=/var \
+DBUS_GLIB_CONF_OPTS = \
 		--disable-tests \
 		--disable-xml-docs \
 		--with-introspect-xml=$(DBUS_HOST_INTROSPECT) \
package/dbus/dbus.mk +0 -1
index 7cb6d43..28d3dd8 100644
@@ -25,7 +25,6 @@ DBUS_CONF_OPTS = --with-dbus-user=dbus \
 		--disable-xml-docs \
 		--disable-doxygen-docs \
 		--disable-dnotify \
-		--localstatedir=/var \
 		--with-xml=expat \
 		--with-system-socket=/var/run/dbus/system_bus_socket \
 		--with-system-pid-file=/var/run/messagebus.pid
package/dhcp/dhcp.mk +0 -1
index 0bcd469..25c9e76 100644
@@ -14,7 +14,6 @@ DHCP_CONF_ENV = \
 		-D_PATH_DHCLIENT_CONF=\"/etc/dhcp/dhclient.conf\"' \
 	ac_cv_file__dev_random=yes
 DHCP_CONF_OPTS = \
-	--localstatedir=/var/lib/dhcp \
 	--with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
 	--with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
 	--with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
package/directfb/directfb.mk +0 -1
index 5b72c7a..eb0328c 100644
@@ -14,7 +14,6 @@ DIRECTFB_INSTALL_STAGING = YES
 DIRECTFB_AUTORECONF = YES
 
 DIRECTFB_CONF_OPTS = \
-	--localstatedir=/var \
 	--disable-explicit-deps \
 	--enable-zlib \
 	--enable-freetype \
package/lighttpd/lighttpd.mk +0 -1
index ab0a4e0..ef98298 100644
@@ -14,7 +14,6 @@ LIGHTTPD_DEPENDENCIES = host-pkgconf
 LIGHTTPD_CONF_OPTS = \
 	--libdir=/usr/lib/lighttpd \
 	--libexecdir=/usr/lib \
-	--localstatedir=/var \
 	$(if $(BR2_LARGEFILE),,--disable-lfs)
 
 ifeq ($(BR2_PACKAGE_LIGHTTPD_OPENSSL),y)
package/ndisc6/ndisc6.mk +1 -1
index 4e98fe2..ef48cd2 100644
@@ -8,7 +8,7 @@ NDISC6_VERSION = 1.0.2
 NDISC6_SOURCE = ndisc6-$(NDISC6_VERSION).tar.bz2
 NDISC6_SITE = http://www.remlab.net/files/ndisc6
 NDISC6_CONF_ENV = CC="$(TARGET_CC) -std=gnu99"
-NDISC6_CONF_OPTS = --localstatedir=/var --disable-rpath --disable-suid-install
+NDISC6_CONF_OPTS = --disable-rpath --disable-suid-install
 NDISC6_LICENSE = GPLv2 or GPLv3
 NDISC6_LICENSE_FILES = COPYING
 
package/network-manager/network-manager.mk +0 -1
index 9699eea..b217781 100644
@@ -30,7 +30,6 @@ NETWORK_MANAGER_CONF_OPTS = \
 		--disable-more-warnings \
 		--without-docs \
 		--disable-gtk-doc \
-		--localstatedir=/var \
 		--with-crypto=gnutls \
 		--with-iptables=/usr/sbin/iptables \
 		--disable-ifupdown \
package/nss-mdns/nss-mdns.mk +0 -1
index 62f9907..8d23f89 100644
@@ -6,7 +6,6 @@
 
 NSS_MDNS_VERSION = 0.10
 NSS_MDNS_SITE = http://0pointer.de/lennart/projects/nss-mdns
-NSS_MDNS_CONF_OPTS = --localstatedir=/var
 NSS_MDNS_LICENSE = LGPLv2.1+
 NSS_MDNS_LICENSE_FILES = LICENSE
 
package/oprofile/oprofile.mk +0 -1
index ec0209f..ee2f212 100644
@@ -9,7 +9,6 @@ OPROFILE_SITE = http://downloads.sourceforge.net/project/oprofile/oprofile/oprof
 OPROFILE_LICENSE = GPLv2+
 OPROFILE_LICENSE_FILES = COPYING
 OPROFILE_CONF_OPTS = \
-	--localstatedir=/var \
 	--disable-account-check \
 	--enable-gui=no \
 	--with-kernel=$(STAGING_DIR)/usr
package/php/php.mk +0 -1
index 26ec67d..afb55b4 100644
@@ -18,7 +18,6 @@ PHP_CONF_OPTS = --mandir=/usr/share/man \
 		--disable-all \
 		--without-pear \
 		--with-config-file-path=/etc \
-		--localstatedir=/var \
 		--disable-rpath
 PHP_CONF_ENV = EXTRA_LIBS="$(PHP_EXTRA_LIBS)"
 
package/pulseaudio/pulseaudio.mk +0 -1
index 44c7602..8d3d0f7 100644
@@ -11,7 +11,6 @@ PULSEAUDIO_INSTALL_STAGING = YES
 PULSEAUDIO_LICENSE = LGPLv2.1+ (specific license for modules, see LICENSE file)
 PULSEAUDIO_LICENSE_FILES = LICENSE GPL LGPL
 PULSEAUDIO_CONF_OPTS = \
-	--localstatedir=/var \
 	--disable-default-build-tests \
 	--disable-legacy-runtime-dir \
 	--disable-legacy-database-entry-format \
package/samba/samba.mk +0 -1
index 5472edd..1957997 100644
@@ -33,7 +33,6 @@ SAMBA_CONF_ENV = \
 	$(if $(BR2_PACKAGE_SAMBA_AVAHI),AVAHI_LIBS=-pthread)
 
 SAMBA_CONF_OPTS = \
-	--localstatedir=/var \
 	--with-piddir=/var/run \
 	--with-lockdir=/var/lock \
 	--with-logfilebase=/var/log \
package/sdl_net/sdl_net.mk +1 -1
index d7bc78b..0800a9e 100644
@@ -10,7 +10,7 @@ SDL_NET_SOURCE = SDL_net-$(SDL_NET_VERSION).tar.gz
 SDL_NET_LICENSE = zlib
 SDL_NET_LICENSE_FILES = COPYING
 
-SDL_NET_CONF_OPTS = --localstatedir=/var \
+SDL_NET_CONF_OPTS = \
 		--with-sdl-prefix=$(STAGING_DIR)/usr \
 		--with-sdl-exec-prefix=$(STAGING_DIR)/usr
 
package/sed/sed.mk +0 -1
index 34ed355..f72b8b1 100644
@@ -14,7 +14,6 @@ SED_CONF_OPTS = --bindir=/usr/bin \
 		--libexecdir=/usr/lib \
 		--sysconfdir=/etc \
 		--datadir=/usr/share \
-		--localstatedir=/var \
 		--mandir=/usr/share/man \
 		--infodir=/usr/share/info \
 		--include=$(STAGING_DIR)/usr/include
package/sqlcipher/sqlcipher.mk +1 -2
index 253e311..a118718 100644
@@ -15,8 +15,7 @@ SQLCIPHER_CONF_ENV = \
 	TCLSH_CMD=$(HOST_DIR)/usr/bin/tclsh$(TCL_VERSION_MAJOR)
 
 SQLCIPHER_CONF_OPTS = \
-	--enable-threadsafe \
-	--localstatedir=/var
+	--enable-threadsafe
 
 SQLCIPHER_CFLAGS += -DSQLITE_HAS_CODEC # Required according to the README
 SQLCIPHER_LDFLAGS += -lcrypto -lz
package/sqlite/sqlite.mk +0 -3
index ebf60a8..e579ae8 100644
@@ -39,9 +39,6 @@ endif
 
 SQLITE_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) $(SQLITE_CFLAGS)"
 
-SQLITE_CONF_OPTS = \
-	--localstatedir=/var
-
 ifeq ($(BR2_PREFER_STATIC_LIB),y)
 SQLITE_CONF_OPTS += --enable-dynamic-extensions=no
 endif
package/systemd/systemd.mk +0 -1
index 94407ab..1ca3fd8 100644
@@ -29,7 +29,6 @@ endif
 SYSTEMD_CONF_OPTS += \
 	--with-rootprefix= \
 	--with-rootlibdir=/lib \
-	--localstatedir=/var \
 	--enable-static=no \
 	--disable-manpages \
 	--disable-selinux \
package/x11r7/xserver_xorg-server/xserver_xorg-server.mk +1 -1
index c27dd80..b269985 100644
@@ -58,7 +58,7 @@ XSERVER_XORG_SERVER_CONF_OPTS = --disable-config-hal \
 		--disable-xnest --disable-xephyr --disable-dmx \
 		--with-builder-addr=buildroot at buildroot.org \
 		CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/pixman-1" \
-		--with-fontrootdir=/usr/share/fonts/X11/ --localstatedir=/var \
+		--with-fontrootdir=/usr/share/fonts/X11/ \
 		--$(if $(BR2_PACKAGE_XSERVER_XORG_SERVER_XVFB),en,dis)able-xvfb
 
 ifeq ($(BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR),y)
Signature · 1 line
2.1.2
#2 lore raw

PATCH 2/2 package/.mk files: remove --localstatedir=/var from autotools packages

Quoted 7 lines · J?rg Krause

Remove --localstatedir=/var from all autotools packages where it is no longer needed.

Also remove --localstatedir=/var/lib/dhcp from package dhcp. localstatedir is used by dhcp to set the default directory for the leases files. This can also be done by setting --with-*-lease-file=/var/lib/dhcp/*, which is done in dhcp.mk.

I would have preferred the dhcp thing to be a separate patch, because it is
more than a mechanical change. Still,

The DHCP thing in particular should get a runtime test, however, because if it
breaks, it will only be visible at runtime.

Regards,
Arnout

Quoted 39 lines

A custom --localstatedir is left in:
* proftpd.mk
* mysql.mk

This is safe to do:
One of the good thing with autoconf is that if you pass:

        --localstatedir=/var ... --localstatedir=/var/something

Then /var/something will be used. So, we can set --localstatedir=/var by default in the infrastructure, and still have certain packages doing weird things override it. [Thanks to Thomas Petazzoni]

---
 package/avahi/avahi.mk                                   | 2 +-
 package/bind/bind.mk                                     | 2 +-
 package/collectd/collectd.mk                             | 2 +-
 package/connman/connman.mk                               | 2 +-
 package/cups/cups.mk                                     | 3 +--
 package/dbus-glib/dbus-glib.mk                           | 2 +-
 package/dbus/dbus.mk                                     | 1 -
 package/dhcp/dhcp.mk                                     | 1 -
 package/directfb/directfb.mk                             | 1 -
 package/lighttpd/lighttpd.mk                             | 1 -
 package/ndisc6/ndisc6.mk                                 | 2 +-
 package/network-manager/network-manager.mk               | 1 -
 package/nss-mdns/nss-mdns.mk                             | 1 -
 package/oprofile/oprofile.mk                             | 1 -
 package/php/php.mk                                       | 1 -
 package/pulseaudio/pulseaudio.mk                         | 1 -
 package/samba/samba.mk                                   | 1 -
 package/sdl_net/sdl_net.mk                               | 2 +-
 package/sed/sed.mk                                       | 1 -
 package/sqlcipher/sqlcipher.mk                           | 3 +--
 package/sqlite/sqlite.mk                                 | 3 ---
 package/systemd/systemd.mk                               | 1 -
 package/x11r7/xserver_xorg-server/xserver_xorg-server.mk | 2 +-
 23 files changed, 10 insertions(+), 27 deletions(-)

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 2/2 package/.mk files: remove --localstatedir=/var from autotools packages

In reply to Jörg Krause

Dear J?rg Krause,

Quoted 7 lines · J?rg Krause

Remove --localstatedir=/var from all autotools packages where it is no longer needed.

Also remove --localstatedir=/var/lib/dhcp from package dhcp. localstatedir is used by dhcp to set the default directory for the leases files. This can also be done by setting --with-*-lease-file=/var/lib/dhcp/*, which is done in dhcp.mk.

I've indeed checked that in the dhcp configure.ac script, localstatedir is only used when the --with-*-lease-file options are not passed.

Therefore, patch applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/2 package/pkg-autotools.mk: set --localstatedir=/var by default

In reply to Jörg Krause
Quoted 10 lines · J?rg Krause

localstatedir is a common autoconf variable like prefix and sysconfdir. At this time 25 autotools and one generic package uses this Makefile variable. 22 of the autotools packages use --localstatedir=/var, the remaining use custom settings.

Setting localstatedir to /var is consistent with the Filesystem Hierarchy Standard (FHS). So it's time to move it as a common definition in the autotools infrastructure.

Regards,
Arnout

Quoted 25 lines
---
 package/pkg-autotools.mk | 2 ++
 1 file changed, 2 insertions(+)
package/pkg-autotools.mk +2 -0
index 2c93dd9..3c5430f 100644
@@ -134,6 +134,7 @@ define $(2)_CONFIGURE_CMDS
 		--prefix=/usr \
 		--exec-prefix=/usr \
 		--sysconfdir=/etc \
+		--localstatedir=/var \
 		--program-prefix="" \
 		--disable-gtk-doc \
 		--disable-doc \
@@ -165,6 +166,7 @@ define $(2)_CONFIGURE_CMDS
 		./configure \
 		--prefix="$$(HOST_DIR)/usr" \
 		--sysconfdir="$$(HOST_DIR)/etc" \
+		--localstatedir="$$(HOST_DIR)/var" \
 		--enable-shared --disable-static \
 		--disable-gtk-doc \
 		--disable-doc \
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH 1/2 package/pkg-autotools.mk: set --localstatedir=/var by default

In reply to Jörg Krause

Dear J?rg Krause,

Quoted 5 lines · J?rg Krause

localstatedir is a common autoconf variable like prefix and sysconfdir. At this time 25 autotools and one generic package uses this Makefile variable. 22 of the autotools packages use --localstatedir=/var, the remaining use custom settings.

Quoted 8 lines

Setting localstatedir to /var is consistent with the Filesystem Hierarchy Standard (FHS). So it's time to move it as a common definition in the autotools infrastructure.

---
 package/pkg-autotools.mk | 2 ++
 1 file changed, 2 insertions(+)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com