Commit 44ae23e3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Lasse Karstensen

Make it possible to do

	import vmod from "/some/dir/"

and have the default vmod shlib filename appended.
parent d7e898c0
......@@ -23,3 +23,11 @@ varnish v1 -cliok "param.set vmod_dir /nowhere:${topbuild}/lib/libvmod_std/.libs
varnish v1 -vcl+backend {
import std;
}
varnish v1 -cliok "param.set vcc_unsafe_path on"
varnish v1 -cliok "param.set vmod_dir /nowhere:/else"
varnish v1 -vcl+backend {
import std from "${topbuild}/lib/libvmod_std/.libs/";
}
......@@ -67,7 +67,7 @@ varnish v1 -errvcl {Found: 'zool' at} {
shell "rm -f ${tmpdir}/a"
shell "rm -f ${tmpdir}/_start.vcl"
varnish v1 -errvcl {only works in nested VCL include files} {
varnish v1 -errvcl {needs absolute filename of including file.} {
include "./foobar";
}
......@@ -511,8 +511,8 @@ vcc_resolve_includes(struct vcc *tl)
*/
if (t1->src->name[0] != '/') {
VSB_printf(tl->sb,
"include \"./xxxxx\"; only works in "
"nested VCL include files\n");
"include \"./xxxxx\"; needs absolute "
"filename of including file.\n");
vcc_ErrWhere(tl, t1);
return;
}
......@@ -784,14 +784,14 @@ VCC_Compile(const struct vcp *vcp, struct vsb *sb,
{
struct source *sp;
char *r;
CHECK_OBJ_NOTNULL(vcp, VCP_MAGIC);
AN(sb);
AN(vclsrcfile);
if (vclsrc != NULL) {
AZ(vclsrcfile);
sp = vcc_new_source(vclsrc, NULL, "<input>");
} else {
AN(vclsrcfile);
if (vclsrc != NULL)
sp = vcc_new_source(vclsrc, NULL, vclsrcfile);
else
sp = vcc_file_source(vcp, sb, vclsrcfile);
}
if (sp == NULL)
return (NULL);
r = vcc_CompileSource(vcp, sb, sp);
......
......@@ -117,7 +117,11 @@ vcc_ParseImport(struct vcc *tl)
return;
}
ExpectErr(tl, CSTR);
bprintf(fn, "%s", tl->t->dec);
p = strrchr(tl->t->dec, '/');
if (p != NULL && p[1] == '\0')
bprintf(fn, "%slibvmod_%.*s.so", tl->t->dec, PF(mod));
else
bprintf(fn, "%s", tl->t->dec);
vcc_NextToken(tl);
} else {
bprintf(fn, "libvmod_%.*s.so", PF(mod));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment