Hello,
I'm attempting to patch the devel/lua-luarocks port and have run into some difficulty using sed in the makefile.
The issue: I need to insert an option into the config-3.0.4.lua configuration file that is generated at install time. The block of text (the lua table) looks like this:
and I need to insert UNZIP = "/usr/local/bin/unzip"; so that it looks like this:
I've managed to make that work using sed on the command line:
but when I try that in the makefile, I get
My incomplete pre install target looks like this:
Can anyone give me a clue on how to insert a line of text using BSD sed in a makefile? I'm running on FreeBSD11.1
I'm attempting to patch the devel/lua-luarocks port and have run into some difficulty using sed in the makefile.
The issue: I need to insert an option into the config-3.0.4.lua configuration file that is generated at install time. The block of text (the lua table) looks like this:
Code:
variables = {
LUA_DIR = "/usr/local";
LUA_INCDIR = "/usr/local/include/lua53";
LUA_BINDIR = "/usr/local/bin";
}
and I need to insert UNZIP = "/usr/local/bin/unzip"; so that it looks like this:
Code:
variables = {
UNZIP = "/usr/local/bin/unzip";
LUA_DIR = "/usr/local";
LUA_INCDIR = "/usr/local/include/lua53";
LUA_BINDIR = "/usr/local/bin";
}
I've managed to make that work using sed on the command line:
Code:
sudo sed -i -- '/variables = {/ a \
UNZIP = "/usr/local/bin/unzip";\
' /usr/local/etc/luarocks/config-5.3.lua
but when I try that in the makefile, I get
Code:
gmake[2]: Leaving directory '/usr/home/russellh/freebsd/ports/devel/lua-luarocks_304/work/luarocks-3.0.4'
/usr/bin/sed -i.bak -i -- '/variables = {/ a UNZIP = "/usr/local/bin/unzip"; ' /usr/home/russellh/freebsd/ports/devel/lua-luarocks_304/work/stage/usr/local/etc/luarocks/config-5.3.lua
sed: 1: "/variables = {/ a UNZI ...": command a expects \ followed by text
*** Error code 1
Stop.
make[1]: stopped in /usr/home/russellh/freebsd/ports/devel/lua-luarocks_304
*** Error code 1
Stop.
make: stopped in /usr/home/russellh/freebsd/ports/devel/lua-luarocks_304
Code:
pre-install:
${REINPLACE_CMD} -i -- '/variables = {/ a \
UNZIP = "${PREFIX}/bin/unzip";\
' ${STAGEDIR}${ETCDIR}/config-${LUA_VER}.lua
Can anyone give me a clue on how to insert a line of text using BSD sed in a makefile? I'm running on FreeBSD11.1
Last edited by a moderator: