Package: gyp
Version: 0.1+20180428git4d467626-2
Severity: minor

I have a simple test consisting of two files (see attachments). As you
can see, it sets the GYP_OS_VAL macro equal to the value of the OS
predefined variable, and the main.cpp file prints this value to stdout.
In that way I examined the initial value of the OS variable set by gyp.
But I am puzzled by the results on kFreeBSD, the Debian port, and on
GNU/Hurd. The variable contains a string "linux". Which I think is not
quite correct as these systems have no connection with the Linux kernel
and sometimes require special handling.

Below I am showing what I have gotten on kFreeBSD.

    $ uname -a
    GNU/kFreeBSD nola 9.0-2-686 #0 Sun May 17 22:06:56 UTC 2015 i386 i386 
Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz GNU/kFreeBSD
    $ gyp --no-parallel --depth .
    $ make
    CC(target) out/Default/obj.target/ttt/main.o
    LINK(target) out/Default/ttt
    $ out/Default/ttt
    GYP_OS_VAL=linux

And here is what happened on GNU/Hurd.

    $ uname -a
    GNU debian 0.9 GNU-Mach 1.8+git20190109-486/Hurd-0.9 i686-AT386 GNU
    $ gyp --no-parallel --depth .
    $ make
    CC(target) out/Default/obj.target/ttt/main.o
    LINK(target) out/Default/ttt
    $ out/Default/ttt
    GYP_OS_VAL=linux

Please provide a built-in mechanism to distinguish Linux as target
system from kFreeBSD or GNU/Hurd.
#include <stdio.h>
int main()
{
  printf("GYP_OS_VAL=%s\n", GYP_OS_VAL);
  return 0;
}
{
  'targets': [
    {
      'target_name': 'ttt',
      'type': 'executable',
      'defines': [
        'GYP_OS_VAL="<(OS)"',
      ],
      'sources': [
        'main.c',
      ],
    },
  ],
}

Reply via email to