Browse Source

add AUTHORS.txt to distributable (it's referenced by LICENSE.txt); embed LICENSE.txt and AUTHORS.txt in an ascii-cleaned-up way into duktape.c and duktape.h

pull/20/head
Sami Vaarala 11 years ago
parent
commit
61baf70847
  1. 6
      src/duktape.h.in
  2. 20
      util/combine_src.py
  3. 29
      util/make_dist.sh

6
src/duktape.h.in

@ -11,6 +11,12 @@
* licensing information. * licensing information.
*/ */
/* LICENSE.txt */
@LICENSE_TXT@
/* AUTHORS.txt */
@AUTHORS_TXT@
#ifndef DUKTAPE_H_INCLUDED #ifndef DUKTAPE_H_INCLUDED
#define DUKTAPE_H_INCLUDED #define DUKTAPE_H_INCLUDED

20
util/combine_src.py

@ -131,7 +131,7 @@ def processDeclarations(f):
elif line.data.startswith('extern int') or line.data.startswith('extern void '): elif line.data.startswith('extern int') or line.data.startswith('extern void '):
line.data = 'static ' + line.data[7:] # replace extern with static line.data = 'static ' + line.data[7:] # replace extern with static
def createCombined(files, extinc, intinc, duk_version, git_commit, git_describe): def createCombined(files, extinc, intinc, duk_version, git_commit, git_describe, license_file, authors_file):
res = [] res = []
emit_state = [ None, None ] # curr_filename, curr_lineno emit_state = [ None, None ] # curr_filename, curr_lineno
@ -152,6 +152,20 @@ def createCombined(files, extinc, intinc, duk_version, git_commit, git_describe)
res.append(' */') res.append(' */')
res.append('') res.append('')
# Add LICENSE.txt and AUTHORS.txt to combined source so that they're automatically
# included and are up-to-date.
res.append('/* LICENSE.txt */')
f = open(license_file, 'rb')
for line in f:
res.append(line.strip())
f.close()
res.append('/* AUTHORS.txt */')
f = open(authors_file, 'rb')
for line in f:
res.append(line.strip())
f.close()
def emit(line): def emit(line):
if isinstance(line, (str, unicode)): if isinstance(line, (str, unicode)):
res.append(line) res.append(line)
@ -228,6 +242,8 @@ def main():
duk_version = int(sys.argv[3]) duk_version = int(sys.argv[3])
git_commit = sys.argv[4] git_commit = sys.argv[4]
git_describe = sys.argv[5] git_describe = sys.argv[5]
license_file = sys.argv[6]
authors_file = sys.argv[7]
print 'Read input files' print 'Read input files'
files = [] files = []
@ -263,7 +279,7 @@ def main():
pass pass
print 'Output final file' print 'Output final file'
final = createCombined(files, extinc, intinc, duk_version, git_commit, git_describe) final = createCombined(files, extinc, intinc, duk_version, git_commit, git_describe, license_file, authors_file)
f = open(outname, 'wb') f = open(outname, 'wb')
f.write(final) f.write(final)
f.close() f.close()

29
util/make_dist.sh

@ -250,6 +250,7 @@ cat README.txt.dist | sed \
-e "s/@GIT_DESCRIBE@/$GIT_DESCRIBE/" \ -e "s/@GIT_DESCRIBE@/$GIT_DESCRIBE/" \
> $DIST/README.txt > $DIST/README.txt
cp LICENSE.txt $DIST/LICENSE.txt cp LICENSE.txt $DIST/LICENSE.txt
cp AUTHORS.txt $DIST/AUTHORS.txt
cp RELEASES.txt $DIST/RELEASES.txt cp RELEASES.txt $DIST/RELEASES.txt
for i in \ for i in \
@ -258,9 +259,28 @@ for i in \
cp licenses/$i $DIST/licenses/ cp licenses/$i $DIST/licenses/
done done
# Build temp versions of LICENSE.txt and AUTHORS.txt for embedding into
# autogenerated C/H files.
echo '/*' > $DIST/LICENSE.txt.tmp
cat LICENSE.txt | python util/make_ascii.py | sed -e 's/^/ \* /' >> $DIST/LICENSE.txt.tmp
echo ' */' >> $DIST/LICENSE.txt.tmp
echo '/*' > $DIST/AUTHORS.txt.tmp
cat AUTHORS.txt | python util/make_ascii.py | sed -e 's/^/ \* /' >> $DIST/AUTHORS.txt.tmp
echo ' */' >> $DIST/AUTHORS.txt.tmp
# Build duktape.h from parts, with some git-related replacements. # Build duktape.h from parts, with some git-related replacements.
cat src/duktape.h.in | sed -e ' cat src/duktape.h.in | sed -e '
/^@LICENSE_TXT@$/ {
r dist/LICENSE.txt.tmp
d
}
/^@AUTHORS_TXT@$/ {
r dist/AUTHORS.txt.tmp
d
}
/^@DUK_FEATURES_H@$/ { /^@DUK_FEATURES_H@$/ {
r src/duk_features.h.in r src/duk_features.h.in
d d
@ -513,7 +533,7 @@ sed -f $DISTSRCSEP/sed.tmp $DISTSRCSEP/duk_unicode_tables.c.tmp > $DISTSRCSEP/du
rm $DISTSRCSEP/sed.tmp rm $DISTSRCSEP/sed.tmp
rm $DISTSRCSEP/duk_unicode_tables.c.tmp rm $DISTSRCSEP/duk_unicode_tables.c.tmp
# Clean up sources: after this step only relevant files should remain # Clean up sources
rm $DISTSRCSEP/*.tmp rm $DISTSRCSEP/*.tmp
for i in \ for i in \
@ -536,12 +556,13 @@ rm $DISTSRCSEP/caseconv.txt
# are met. # are met.
python util/combine_src.py $DISTSRCSEP $DISTSRCCOM/duktape.c \ python util/combine_src.py $DISTSRCSEP $DISTSRCCOM/duktape.c \
"$DUK_VERSION" "$GIT_COMMIT" "$GIT_DESCRIBE" "$DUK_VERSION" "$GIT_COMMIT" "$GIT_DESCRIBE" \
$DIST/LICENSE.txt.tmp $DIST/AUTHORS.txt.tmp
echo "CLOC report on combined duktape.c source file" echo "CLOC report on combined duktape.c source file"
perl cloc-1.60.pl --quiet $DISTSRCCOM/duktape.c perl cloc-1.60.pl --quiet $DISTSRCCOM/duktape.c
cp $DISTSRCSEP/duktape.h $DISTSRCCOM/duktape.h cp $DISTSRCSEP/duktape.h $DISTSRCCOM/duktape.h
# Final cleanup # Clean up remaining files
# nothing now
rm $DIST/*.tmp

Loading…
Cancel
Save