Commit e3075394 authored by Rusty Russell's avatar Rusty Russell

Allow things without test/ dirs to be modules.

Allow versions on dependencies.
Display external dependencies on info pages.
parent 75a31ebf
......@@ -10,15 +10,17 @@
# Especially tools/ccanlint/ccanlint and tools/namespacize.
# distclean: destroy everything back to pristine state
ALL=$(patsubst ccan/%/test, %, $(wildcard ccan/*/test))
ALL_DIRS=$(patsubst %, ccan/%, $(ALL))
# Anything with an _info.c file is a module.
ALL=$(patsubst ccan/%/_info.c, %, $(wildcard ccan/*/_info.c))
ALL_DEPENDS=$(patsubst %, ccan/%/.depends, $(ALL))
# Not all modules have tests.
ALL_TESTS=$(patsubst ccan/%/test/, %, $(wildcard ccan/*/test/))
default: libccan.a
include Makefile-ccan
check: $(ALL_DIRS:ccan/%=check-%)
check: $(ALL_TESTS:%=check-%)
distclean: clean
rm -f $(ALL_DEPENDS)
......
# This can be overridden on cmdline to generate pages elsewhere.
WEBDIR=~/www/html/ccan/
ALL_PAGES=$(patsubst ccan/%, $(WEBDIR)/info/%.html, $(ALL_DIRS))
DIRECT_TARBALLS=$(patsubst ccan/%, $(WEBDIR)/tarballs/%.tar.bz2, $(ALL_DIRS))
DEPEND_TARBALLS=$(patsubst ccan/%, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(ALL_DIRS))
ALL_PAGES=$(patsubst %, $(WEBDIR)/info/%.html, $(ALL))
DIRECT_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/%.tar.bz2, $(ALL))
DEPEND_TARBALLS=$(patsubst %, $(WEBDIR)/tarballs/with-deps/%.tar.bz2, $(ALL))
WEB_SUBDIRS=$(WEBDIR)/tarballs $(WEBDIR)/junkcode $(WEBDIR)/tarballs/with-deps $(WEBDIR)/info
JUNKDIRS=$(wildcard junkcode/*)
JUNKPAGES=$(JUNKDIRS:%=$(WEBDIR)/%.html)
......@@ -56,10 +56,10 @@ $(WEBDIR)/ccan.jpg: web/ccan.jpg
$(WEBDIR)/info/%.html: $(WEBDIR)/tarballs/%.tar.bz2 $(WEBDIR)/tarballs/with-deps/%.tar.bz2
@URLPREFIX=../ php5 web/staticmoduleinfo.php ccan/$* > $@
$(WEBDIR)/tarballs/%.tar.bz2: ccan/%/test
$(WEBDIR)/tarballs/%.tar.bz2: ccan/%/_info.c
tar -c -j -f $@ `bzr ls --versioned --kind=file ccan/$*`
$(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/test tools/ccan_depends
$(WEBDIR)/tarballs/with-deps/%.tar.bz2: ccan/%/_info.c tools/ccan_depends
tar cfj $@ $$(echo ccan/$* $$(tools/ccan_depends ccan/$*) | xargs -n 1 bzr ls --versioned --kind=file)
distclean: distclean-web
......
......@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
return 1;
if (strcmp(argv[1], "depends") == 0) {
printf("libvorbis\n");
printf("libvorbis >=19\n");
return 0;
}
......
......@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
if (strcmp(argv[1], "depends") == 0) {
printf("ccan/ogg_to_pcm\n"
"libvorbis\n"
"libvorbis >=19\n"
"portaudio\n");
return 0;
}
......
......@@ -11,6 +11,7 @@ int main(int argc, char *argv[])
unsigned int i;
bool compile = false;
bool recurse = true;
bool ccan = true;
if (argv[1] && streq(argv[1], "--direct")) {
argv++;
......@@ -22,10 +23,19 @@ int main(int argc, char *argv[])
argc--;
compile = true;
}
if (argv[1] && streq(argv[1], "--non-ccan")) {
argv++;
argc--;
ccan = false;
}
if (argc != 2)
errx(1, "Usage: ccan_depends [--direct] [--compile] <dir>\n"
errx(1, "Usage: ccan_depends [--direct] [--compile] [--non-ccan] <dir>\n"
"Spits out all the ccan dependencies (recursively unless --direct)");
/* We find depends without compiling by looking for ccan/ */
if (!ccan && !compile)
errx(1, "--non-ccan needs --compile");
if (compile)
deps = get_deps(talloc_autofree_context(), argv[1], recurse);
else
......@@ -33,7 +43,7 @@ int main(int argc, char *argv[])
recurse);
for (i = 0; deps[i]; i++)
if (strstarts(deps[i], "ccan/"))
if (strstarts(deps[i], "ccan/") == ccan)
printf("%s\n", deps[i]);
return 0;
}
......@@ -28,7 +28,7 @@ Or you can just download the <a href="ccan.tar.bz2">tarball of everything includ
$d = dir($argv[1]);
$modules = array();
while (false !== ($entry = $d->read())) {
if ($entry[0] != '.' && is_dir($argv[1].$entry."/test")) {
if ($entry[0] != '.' && is_file($argv[1].$entry."/_info.c")) {
array_push($modules, $entry);
}
}
......
......@@ -11,6 +11,7 @@ $summary=extract_field('summary',$module);
$description=htmlize_field('description',$module);
$example=extract_field('example',$module);
$dependencies=htmlspecialchars(shell_exec('tools/ccan_depends --direct '.$module));
$extdepends=htmlspecialchars(shell_exec('tools/ccan_depends --compile --non-ccan '.$module));
$licence=extract_field('licence',$module);
?>
<table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="3" cellspacing="1">
......@@ -64,6 +65,22 @@ if ($dependencies) {
</tr>
<?php
}
if ($extdepends) {
?>
<tr align="left" bgcolor="FFFFCC">
<td><h3>External dependencies: </h3> <?php
foreach (split("\n", $extdepends) as $dep) {
$fields=preg_split("/\s+/", $dep);
echo $fields[0].' ';
if (count($fields) > 1)
echo '(version '.$fields[1].') ';
echo '<br>';
}
?></td>
</tr>
<?php
}
?>
<tr align="left" bgcolor="FFFFCC">
<td><h3>Description: </h3> <?=$description;?> </td>
......
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