Repository: mesonbuild/meson

Issue:
'StaticLibrary' object has no attribute 'import_filename'
This came up while attempting to build the harfbuzz meson port with `--default-library=static` and msvc on win10. As far as I can tell this is a meson bug, since it's not offering an error in their config and appears to be a mistaken assumption in the pkgconfig module, so I've reported it here. The full error is below:
```
Traceback (most recent call last):
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\mesonmain.py", line 112, in run
    return options.run_func(options)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 230, in run
    app.generate()
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 161, in generate
    self._generate(env)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 190, in _generate
    intr.run()
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 3874, in run
    super().run()
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 408, in run
    self.evaluate_codeblock(self.ast, start=1)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 432, in evaluate_codeblock
    raise e
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 426, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 437, in evaluate_statement
    return self.function_call(cur)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 763, in function_call
    return func(node, posargs, kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 181, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 3447, in func_subdir
    self.evaluate_codeblock(codeblock)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 432, in evaluate_codeblock
    raise e
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 426, in evaluate_codeblock
    self.evaluate_statement(cur)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 441, in evaluate_statement
    return self.method_call(cur)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 799, in method_call
    return obj.method_call(method_name, args, kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 1621, in method_call
    value = fn(state, args, kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 181, in wrapped
    return f(*wrapped_args, **wrapped_kwargs)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 428, in generate
    version, pcfile, conflicts, variables)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 321, in generate_pkgconfig_file
    ofile.write('Libs: {}\n'.format(' '.join(generate_libs_flags(deps.pub_libs))))
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 312, in generate_libs_flags
    lname = self._get_lname(l, msg, pcfile)
  File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 225, in _get_lname
    if l.import_filename:
AttributeError: 'StaticLibrary' object has no attribute 'import_filename'
```


Discussion:

Resolving patch:
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -231,7 +231,7 @@ def _get_lname(self, l, msg, pcfile):
             return l.name[3:]
         # If the library is imported via an import library which is always
         # named after the target name, '-lfoo' is correct.
-        if l.import_filename:
+        if isinstance(l, build.SharedLibrary) and l.import_filename:
             return l.name
         # In other cases, we can't guarantee that the compiler will be able to
         # find the library via '-lfoo', so tell the user that.


Test patch: