zfsonlinux/zfs — pull request #1874 by FransUrbo (2013-11-16 03:42:05+00:00)
Title: Accept user specified spl and kernel source dir.

I've issued this patch several times, but this time I'd make it a simple one, not a combination of many fixes.

Having '/usr/src/spl-' hardcoded (and almost the only choice) is a BAD THING (tm). This patch will accept the values issues with a previous './configure --with-spl=... --with-spl-obj=...' and generate propper zfs-kmod.spec file that is usable without any softlinks or installs of spl before hand.

PS. The change from '%configure' to '%_configure' have been discussed before, but I have NEVER been able to build a package with the previous behaviour - there simply IS no 'configure' script in that directory:

```
Executing(%build): /bin/sh -e /tmp/zfs-build-root-VEIVvrlC/TMP/rpm-tmp.18516
+ umask 022
+ cd /tmp/zfs-build-root-VEIVvrlC/BUILD
+ cd zfs-kmod-0.6.2
+ for kernel_version in 3.12.0+scst+tf.1___/lib/modules/3.12.0+scst+tf.1/build/
+ cd _kmod_build_3.12.0+scst+tf.1
+ CFLAGS='-O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'
+ export FFLAGS
++ '[' -e /lib/modules/3.12.0+scst+tf.1/source ']'
++ echo /lib/modules/3.12.0+scst+tf.1/source
+ ./configure --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i386-rpm-linux --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/usr/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/usr/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-config=kernel --with-linux=/lib/modules/3.12.0+scst+tf.1/source --with-linux-obj=/lib/modules/3.12.0+scst+tf.1/build --with-spl=/usr/src/spl-0.6.2 --with-spl-obj=/usr/src/spl-0.6.2/3.12.0+scst+tf.1 --disable-debug --disable-debug-dmu-tx
/tmp/zfs-build-root-VEIVvrlC/TMP/rpm-tmp.18516: line 29: ./configure: No such file or directory
error: Bad exit status from /tmp/zfs-build-root-VEIVvrlC/TMP/rpm-tmp.18516 (%build)

RPM build errors:
Bad exit status from /tmp/zfs-build-root-VEIVvrlC/TMP/rpm-tmp.18516 (%build)
```

Because:

```
(CHROOT)# cd /tmp/zfs-build-root-VEIVvrlC/BUILD/zfs-kmod-0.6.2/_kmod_build_3.12.0+scst+tf.1
(CHROOT)# ls
(CHROOT)# ls ../
_kmod_build_3.12.0+scst+tf.1/ zfs-0.6.2/
(CHROOT)# ls ../zfs-0.6.2/
AUTHORS META OPENSOLARIS.LICENSE autogen.sh* configure* dracut/ lib/ rpm/ zfs-script-config.sh.in
COPYRIGHT Makefile.am README.markdown cmd/ configure.ac etc/ man/ scripts/ zfs.release.in
DISCLAIMER Makefile.in aclocal.m4 config/ copy-builtin* include/ module/ udev/ zfs_config.h.in
```