Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#38570 closed defect (fixed)

lua-lpeg @0.11: portfile parse error if lua is not installed

Reported by: cooljeanius (Eric Gallager) Owned by: anddam (Andrea D'Amore)
Priority: Normal Milestone:
Component: ports Version: 2.1.3
Keywords: Cc: andremm@…
Port: lua-lpeg

Description

During my most recent selfupdate lua-lpeg gave me this message:

Failed to parse file devel/lua-lpeg/Portfile: Package lua was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua.pc'
to the PKG_CONFIG_PATH environment variable
No package 'lua' found

Change History (7)

comment:1 Changed 12 years ago by cooljeanius (Eric Gallager)

installing lua makes this error go away, but I shouldn't have to install lua just to selfupdate

comment:2 Changed 12 years ago by larryv (Lawrence Velázquez)

Cc: and.damore@… removed
Owner: changed from macports-tickets@… to and.damore@…
Summary: lua-lpeg @0.11: portfile fails to parse during selfupdatelua-lpeg @0.11: portfile parse error if lua is not installed

This line…

LDFLAGS="${configure.ldflags} [exec ${prefix}/bin/pkg-config lua --libs]"

…needs to go into a pre-build block or something, so that the exec command is not evaluated when the portfile is parsed.

comment:3 in reply to:  2 ; Changed 12 years ago by anddam (Andrea D'Amore)

Resolution: fixed
Status: newclosed

Replying to larryv@…:

This line…

LDFLAGS="${configure.ldflags} [exec ${prefix}/bin/pkg-config lua --libs]"

…needs to go into a pre-build block or something, so that the exec command is not evaluated when the portfile is parsed.

That's not possible AFAIK, even if you set a variable in an augmented phase it would not be available at portfile's main level. A correct approach is patching the makefile rather than passing the values on build args.

Committed r104585, ticket closed.

comment:4 in reply to:  1 Changed 12 years ago by anddam (Andrea D'Amore)

Replying to egall@…:

but I shouldn't have to install lua just to selfupdate

Yes, sorry about that, you can uninstall it. Thanks for reporting.

comment:5 in reply to:  3 ; Changed 12 years ago by larryv (Lawrence Velázquez)

Replying to and.damore@…:

That's not possible AFAIK, even if you set a variable in an augmented phase it would not be available at portfile's main level. A correct approach is patching the makefile rather than passing the values on build args.

Sorry, I wasn’t clear. You’d use a block like this:

pre-build {
    build.args-append   LDFLAGS="${configure.ldflags} [exec ${prefix}/bin/pkg-config lua --libs]"
}

Or set build.args all at once, if you’d like:

pre-build {
    build.args      CC="${configure.cc} [get_canonical_archflags]" \
                    LUADIR=${prefix}/include \
                    CFLAGS="${configure.cflags}" \
                    LDFLAGS="${configure.ldflags} [exec ${prefix}/bin/pkg-config lua --libs]"
}

These idioms obviate the need for unnecessary patching.

comment:6 in reply to:  5 Changed 12 years ago by anddam (Andrea D'Amore)

Replying to larryv@…:

Sorry, I wasn’t clear. You’d use a block like this:

pre-build {
    build.args-append   LDFLAGS="${configure.ldflags} [exec ${prefix}/bin/pkg-config lua --libs]"
}

Ofc, -appending is a proper solution, I'm just too used to patching. Will change back to that soon.

comment:7 Changed 12 years ago by jmroot (Joshua Root)

Patching is fine too. But lib dependencies aren't guaranteed to be available in the patch phase either, so you need to use backticks instead of exec to make the command execute in the makefile rather than the portfile.

Note: See TracTickets for help on using tickets.