Skip to content

Alien Author docs related to "make install" and DESTDIR #396

Open
@nrdvana

Description

@nrdvana

I wrote an alien module for FluentBit, and its make process generates a broken fluent-bit.h. While I'm waiting to get this fixed upstream, I needed to just inject my own header into the staging directory after the "make install" runs. I had a difficult time with the documentation to figure out how to do this.

The first point of confusion (reading the Author Manual) was the example of

'./configure --prefix=%{.install.prefix} --disable-shared'

which would indicate that the build process is actually installing to ->install_prop->{prefix}, but this is not the case. (I was using cmake, but just assumed it would follow the same pattern as automake)

The second confusion was the example where it shows

prefix: /tmp/7RtAusykNN

which would also indicate ->install_prop->{prefix} was pointing to the staging directory at some stage of the build. My testing (again, with the cmake plugin) seems to indicate that the {prefix} variables always point to the final installation path, which doesn't exist at the time the module is first installed.

The ->{stage} variable isn't mentioned in the entire Author Documentation, but when I found that I assumed it was what I was looking for, but it seems it doesn't get populated until some time after the 'Gather' stage.

I finally dug into the source for ::Plugin::Gather::IsolateDynamic and found

      my $install_root;
      if($build->meta_prop->{destdir})
      {
        my $destdir = $ENV{DESTDIR};
        $install_root = Path::Tiny->new(_destdir_prefix($ENV{DESTDIR}, $build->install_prop->{prefix}));
      }
      else
      {
        $install_root = Path::Tiny->new($build->install_prop->{stage});
      }

which seems to be what I needed.

My resulting solution to my problem is Alien::FluentBit alienfile

Proposed Changes

For the Author, I think it would be helpful to structure the documentation per each each phase of the alienfile, describing the initial state of things, what the directives are supposed to accomplish, and the resulting state that should be achieved.

I get the idea that DESTDIR is an implementation detail that complicated the original clean plan for staging the builds? If so, there should at least be some wrapper around that so that alien authors can find the location of the directory that 'make install' just wrote to so that they can perform final adjustments to those files during the 'build' phase. Ideally it would be the same code for automake and cmake, regardless of where they are actually writing their directories. It could be something as simple as running the above code and storing it in ->install_prop->{make_install_dir}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    📖DocumentationNeeds new or re-worded documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions