Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input-utils: init at 1.3 #40042

Merged
merged 1 commit into from May 9, 2018
Merged

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented May 6, 2018

Motivation for this change

Adds @kraxel's input, as input-utils, the name commonly used in other distributions.

This includes the lsinput utility (among others), which can be used to list information the different input devices found under /dev/input/. This is useful e.g. when wanting to find the input device file for a joypad or for actkbd.

Things done
  • ✔️ Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • ✔️ NixOS
    • 🆖 macOS
    • ❌ other Linux distributions
  • ❌ Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • ✔️Tested execution of all binary files (usually in ./result/bin/)
  • ✔️ Fits CONTRIBUTING.md.


prePatch = ''
# Adds full path to "linux/input.h"
substituteInPlace ./emulate-key.c --replace "linux/input.h" "${stdenv.glibc.dev}/include/linux/input.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two shouldn’t be necessary. Glibc is already in the include path.

substituteInPlace ./emulate-key.c --replace "linux/input.h" "${stdenv.glibc.dev}/include/linux/input.h"
substituteInPlace ./input.h --replace "linux/input.h" "${stdenv.glibc.dev}/include/linux/input.h"
# Use proper include path for kernel include files.
substituteInPlace ./name.sh --replace "/usr/include/linux/" "${stdenv.glibc.dev}/include/linux/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you have an assertion for stdenv without glibc. Just do something like:

assert stdenv ? glibc;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know what to do for the .../include/linux/ folder, looked around nixpkgs and found two patterns:

  • linuxHeaders
  • stdenv.glibc.dev

Because of what you're saying, I now think that linuxHeaders is the better alternative since it would work without glibc, am I right? (I assumed so in my last commit).


makeFlags = [
"prefix=$(out)"
"STRIP="
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think STRIP=strip is preferred.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a bit of ag to grep around, I see:

  • 6 STRIP= (including two from packages by the same upstream author, fbida, amtterm)
  • 5 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" (ghc)
  • 2 STRIP=-s
  • 1 STRIP=${stdenv.cc.bintools.targetPrefix}strip
  • 1 STRIP=strip
  • 1 replacement of STRIP= by #STRIP=

And other misc:

  • -DCMAKE_STRIP=$(command -v $crossConfig-strip)

Using STRIP=strip leads to:

installing
install flags: install SHELL=/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash prefix=\$\(out\) STRIP=strip
install -d /nix/store/iw7g8gmal9bafsnsi5qxgp238chz8y3h-input-utils-1.3/bin /nix/store/iw7g8gmal9bafsnsi5qxgp238chz8y3h-input-utils-1.3/share/man/man8
install strip lsinput input-events input-kbd input-send input-recv /nix/store/iw7g8gmal9bafsnsi5qxgp238chz8y3h-input-utils-1.3/bin
install: cannot stat 'strip': No such file or directory
make: *** [GNUmakefile:39: install] Error 1

After looking at the source, the mk/Variables.mk#n31 file explains it all. That STRIP variable isn't for the strip binary, but for an option for install.

       -s, --strip
              strip symbol tables

The stdenv sets the environment STRIP to strip, which well, given it is used like install $STRIP would try to install [./]strip which doesn't exist.

The STRIP= bit was taken (IIRC) from the debian package description, or the archlinux PKGBUILD (I let that package sit in my local overlay for 5 months!).

@samueldr
Copy link
Member Author

samueldr commented May 9, 2018

Thanks for the review!

@matthewbauer matthewbauer merged commit d9debbe into NixOS:master May 9, 2018
@samueldr samueldr deleted the package/input-utils branch June 1, 2018 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants