Switched to a real Makefile.
Targets: * all --- extension javascript in build/ * rsakey --- generate key.pem if not there * crx --- compile gplusblacklist.crx Chrome extension
This commit is contained in:
parent
5b6a5eaa22
commit
4d3b4e5eee
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
/key.pem
|
||||
/src.crx
|
||||
/gplusblacklist.crx
|
||||
/*.crx
|
||||
|
40
Makefile
Normal file
40
Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
CC=coffee
|
||||
SRCDIR=src
|
||||
BUILDDIR=build
|
||||
ALL_SRC_FILES := $(wildcard $(SRCDIR)/*)
|
||||
ALL_OTHER_SRC_FILES := $(filter-out %.coffee, $(ALL_SRC_FILES))
|
||||
ALL_OTHER_FILES := $(ALL_OTHER_SRC_FILES:$(SRCDIR)/%=$(BUILDDIR)/%)
|
||||
|
||||
SRC=$(wildcard $(SRCDIR)/*.coffee)
|
||||
BUILD=$(SRC:$(SRCDIR)/%.coffee=$(BUILDDIR)/%.js)
|
||||
|
||||
all: other coffee
|
||||
|
||||
# coffeescript files
|
||||
|
||||
coffee: $(BUILD)
|
||||
|
||||
$(BUILDDIR)/%.js: $(SRCDIR)/%.coffee
|
||||
$(CC) -cs < $< > $@
|
||||
|
||||
# other files
|
||||
|
||||
other: $(ALL_OTHER_FILES)
|
||||
|
||||
$(ALL_OTHER_FILES): $(BUILDDIR)/%: $(SRCDIR)/%
|
||||
cp $< $@
|
||||
|
||||
# crx building stuff
|
||||
|
||||
rsakey: key.pem
|
||||
|
||||
crx: gplusblacklist.crx
|
||||
|
||||
key.pem:
|
||||
@echo "Generating RSA key in PKCS#8 format."
|
||||
openssl genrsa 4096 | openssl pkcs8 -topk8 -nocrypt -out $@
|
||||
|
||||
gplusblacklist.crx: $(ALL_OTHER_FILES) $(BUILD) key.pem
|
||||
google-chrome --pack-extension="$(BUILDDIR)/" --pack-extension-key="key.pem"
|
||||
mv $(BUILDDIR).crx $@
|
||||
-rm libpeerconnection.log
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Yes, I'm paranoid!
|
||||
echo "Generating RSA key in PKCS#8 format..."
|
||||
openssl genrsa 4096 | openssl pkcs8 -topk8 -nocrypt -out key.pem
|
40
make.sh
40
make.sh
@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
if [ ! -f key.pem ]; then
|
||||
./genkey.sh
|
||||
fi
|
||||
|
||||
SRCDIR="src"
|
||||
BUILDDIR="build"
|
||||
FILENAME="gplusblacklist"
|
||||
|
||||
rm $BUILDDIR/*
|
||||
|
||||
find "$SRCDIR/" -type f ! -name "*.coffee" -exec cp {} "$BUILDDIR/" \;
|
||||
coffee -o "$BUILDDIR/" -c "$SRCDIR/"
|
||||
|
||||
NAME=`grep "\"name\":" "$BUILDDIR/manifest.json" | sed -e 's/^.*: "\(.*\)\".*$/\1/'`
|
||||
VERSION=`grep "\"version\":" "$BUILDDIR/manifest.json" | sed -e 's/^.*: "\(.*\)\".*$/\1/'`
|
||||
OUTPUT="$FILENAME-$VERSION.crx"
|
||||
|
||||
if [ -f "$BUILDDIR.crx" ]; then
|
||||
echo "Cleaning up old $BUILDDIR.crx."
|
||||
rm "$BUILDDIR.crx"
|
||||
fi
|
||||
|
||||
echo "Generating $NAME $VERSION..."
|
||||
google-chrome --pack-extension="$BUILDDIR/" --pack-extension-key="key.pem" >/dev/null
|
||||
|
||||
if [ ! -f "$BUILDDIR.crx" ]; then
|
||||
echo "ERROR: Could not compile extension!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# rename output file
|
||||
mv "$BUILDDIR.crx" "$OUTPUT"
|
||||
|
||||
echo "Compiled $OUTPUT ."
|
||||
|
||||
# remove Chrome garbage
|
||||
if [ -f libpeerconnection.log ]; then
|
||||
rm libpeerconnection.log
|
||||
fi
|
Reference in New Issue
Block a user