-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[lektor-774] Removing dektop app code"
This reverts commit 2bef911.
- Loading branch information
Showing
41 changed files
with
1,870 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
OSX_ARCH=x64 | ||
BUILD_DIR=build | ||
OSX_BUNDLE_BASE=$(BUILD_DIR)/Lektor-darwin-$(OSX_ARCH) | ||
OSX_BUNDLE=$(OSX_BUNDLE_BASE)/Lektor.app | ||
OSX_BUNDLE_RES=$(OSX_BUNDLE)/Contents/Resources | ||
|
||
# The identity to use for code signing | ||
CODESIGN_IDENTITY='Developer ID Application' | ||
CODESIGN_FLAGS=--force --verbose --strict --sign $(CODESIGN_IDENTITY) --preserve-metadata=i,e,req --timestamp=none | ||
|
||
REBUILD_CMD=./node_modules/.bin/electron-rebuild -w runas | ||
|
||
npm-install: | ||
cd ../lektor/admin/; npm install | ||
npm install | ||
$(REBUILD_CMD) | ||
|
||
run-only: | ||
./bin/run | ||
|
||
run: npm-install run-only | ||
|
||
$(BUILD_DIR)/Python.framework: | ||
./bin/compile-python-framework | ||
|
||
build-wheels: $(BUILD_DIR)/Python.framework | ||
./bin/build-wheels | ||
|
||
build/Lektor.icns: | ||
./bin/make-mac-icons | ||
|
||
build/ProjectFile.icns: | ||
./bin/make-mac-icons | ||
|
||
icons: build/Lektor.icns build/ProjectFile.icns | ||
|
||
build/imagemagick/convert: | ||
./bin/compile-imagemagick | ||
|
||
osx-bundle: build/imagemagick/convert icons build-wheels | ||
cd ../lektor/admin; npm install | ||
npm install | ||
npm install --production | ||
$(REBUILD_CMD) | ||
cd static; ../node_modules/.bin/webpack | ||
mkdir -p $(OSX_BUNDLE_BASE) && rm -rf $(OSX_BUNDLE) | ||
cp -RH node_modules/electron-prebuilt/dist/Electron.app $(OSX_BUNDLE) | ||
mv $(OSX_BUNDLE)/Contents/Frameworks/{Electron,Lektor}\ Helper\ EH.app | ||
mv $(OSX_BUNDLE)/Contents/Frameworks/Lektor\ Helper\ EH.app/Contents/MacOS/{Electron,Lektor}\ Helper\ EH | ||
sed -i '' s/Electron/Lektor/ $(OSX_BUNDLE)/Contents/Frameworks/Lektor\ Helper\ EH.app/Contents/Info.plist | ||
mv $(OSX_BUNDLE)/Contents/Frameworks/{Electron,Lektor}\ Helper\ NP.app | ||
mv $(OSX_BUNDLE)/Contents/Frameworks/Lektor\ Helper\ NP.app/Contents/MacOS/{Electron,Lektor}\ Helper\ NP | ||
sed -i '' s/Electron/Lektor/ $(OSX_BUNDLE)/Contents/Frameworks/Lektor\ Helper\ NP.app/Contents/Info.plist | ||
mv $(OSX_BUNDLE)/Contents/Frameworks/{Electron,Lektor}\ Helper.app | ||
mv $(OSX_BUNDLE)/Contents/Frameworks/Lektor\ Helper.app/Contents/MacOS/{Electron,Lektor}\ Helper | ||
sed -i '' s/Electron/Lektor/ $(OSX_BUNDLE)/Contents/Frameworks/Lektor\ Helper.app/Contents/Info.plist | ||
mkdir -p $(OSX_BUNDLE_RES)/app/static | ||
cp -R package.json $(OSX_BUNDLE_RES)/app | ||
cp -R static/{images,gen,index.html} $(OSX_BUNDLE_RES)/app/static | ||
cp resources/Lektor-Info.plist $(OSX_BUNDLE)/Contents/Info.plist | ||
cp build/Lektor.icns $(OSX_BUNDLE_RES) | ||
cp build/ProjectFile.icns $(OSX_BUNDLE_RES) | ||
cp build/File.icns $(OSX_BUNDLE_RES) | ||
mkdir -p $(OSX_BUNDLE_RES)/local/bin | ||
cp build/imagemagick/convert $(OSX_BUNDLE_RES)/local/bin | ||
cp resources/lektor-mac-proxy $(OSX_BUNDLE_RES)/local/bin/lektor-proxy | ||
cp resources/lektor $(OSX_BUNDLE_RES)/lektor | ||
rm $(OSX_BUNDLE_RES)/atom.icns | ||
rm -rf $(OSX_BUNDLE_RES)/default_app | ||
# Manually copy over native modules we depend on | ||
mkdir -p $(OSX_BUNDLE_RES)/app/node_modules | ||
cp -R node_modules/runas $(OSX_BUNDLE_RES)/app/node_modules/runas | ||
cp -R node_modules/nan $(OSX_BUNDLE_RES)/app/node_modules/nan | ||
cp -R $(BUILD_DIR)/Python.framework $(OSX_BUNDLE)/Contents/Frameworks/Python.framework | ||
rm $(OSX_BUNDLE)/Contents/Frameworks/Python.framework/Versions/2.7/bin/python{w,w2,w2.7} | ||
./bin/make-python-framework-relocatable $(OSX_BUNDLE)/Contents/Frameworks/Python.framework | ||
./bin/install-wheels $(OSX_BUNDLE)/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.7/site-packages | ||
find $(OSX_BUNDLE)/Contents -name '.DS_Store' -exec rm {} \; | ||
|
||
osx-signed-bundle: osx-bundle | ||
find $(OSX_BUNDLE) -name '*.dylib' -exec codesign $(CODESIGN_FLAGS) {} \; | ||
find $(OSX_BUNDLE) -name '*.so' -exec codesign $(CODESIGN_FLAGS) {} \; | ||
find $(OSX_BUNDLE) -type f -perm +0111 -exec codesign $(CODESIGN_FLAGS) {} \; | ||
codesign --force --verbose --sign $(CODESIGN_IDENTITY) $(OSX_BUNDLE)/Contents/Frameworks/Python.framework/Versions/Current/Resources/Python.app | ||
find $(OSX_BUNDLE) -name '*.app' -exec codesign $(CODESIGN_FLAGS) {} \; | ||
find $(OSX_BUNDLE) -name '*.framework' -exec codesign $(CODESIGN_FLAGS) {} \; | ||
codesign $(CODESIGN_FLAGS) $(OSX_BUNDLE)/Contents/MacOS/Electron | ||
codesign $(CODESIGN_FLAGS) $(OSX_BUNDLE_RES)/local/bin/lektor-proxy | ||
codesign $(CODESIGN_FLAGS) $(OSX_BUNDLE) | ||
codesign --verify --verbose --deep $(OSX_BUNDLE) | ||
|
||
node_modules/.bin/appdmg: | ||
npm install appdmg | ||
|
||
osx-dmg-only: | ||
rm -rf $(OSX_BUNDLE_BASE)/Lektor.dmg | ||
./node_modules/.bin/appdmg dmg-config.json $(OSX_BUNDLE_BASE)/Lektor.dmg | ||
|
||
osx-dmg: node_modules/.bin/appdmg osx-signed-bundle osx-dmg-only | ||
|
||
.PHONY: npm-install run-only run build-wheels icons osx-bundle osx-dmg-only osx-dmg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
HERE="$(cd "$(dirname "$0")"; pwd)" | ||
BASE="$HERE/.." | ||
OUT="$(cd "$BASE/build"; pwd)" | ||
TMP="$OUT/tmp" | ||
|
||
rm -rf "$TMP" "$OUT/wheels" | ||
VENV="$TMP/venv" | ||
virtualenv "$VENV" -p "$OUT/Python.framework/Versions/Current/bin/python" | ||
. "$TMP/venv/bin/activate" | ||
|
||
pip install --upgrade pip | ||
pip install wheel | ||
pip wheel "$BASE/.." -w "$OUT/wheels" | ||
|
||
rm -rf "$TMP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
HERE="$(cd "$(dirname "$0")"; pwd)" | ||
BASE="$HERE/.." | ||
BUILD="$BASE/build/imagemagick" | ||
|
||
TEMP=$(mktemp -d) | ||
PREFIX="$TEMP/out" | ||
cd "$TEMP" | ||
|
||
# The minimum version of OSX we want to compile for | ||
export MACOSX_DEPLOYMENT_TARGET=10.9 | ||
|
||
# Download all the things | ||
wget "http://ftp.nluug.nl/ImageMagick/ImageMagick.tar.gz" -O imagemagick.tar.gz | ||
mkdir imagemagick | ||
(cd imagemagick; tar --strip-components=1 -xzf "../imagemagick.tar.gz") | ||
|
||
wget "http://www.ijg.org/files/jpegsrc.v7.tar.gz" -O libjpeg.tar.gz | ||
mkdir libjpeg | ||
(cd libjpeg; tar --strip-components=1 -xzf "../libjpeg.tar.gz") | ||
|
||
wget "http://downloads.sourceforge.net/project/libpng/libpng16/1.6.21/libpng-1.6.21.tar.gz" -O libpng.tar.gz | ||
mkdir libpng | ||
(cd libpng; tar --strip-components=1 -xzf "../libpng.tar.gz") | ||
|
||
# Compile libpng | ||
(cd libpng; ./configure --prefix="$PREFIX"; make && make install) | ||
|
||
# Compile libjpeg | ||
(cd libjpeg; ./configure --prefix="$PREFIX" --enable-shared; make && make install) | ||
|
||
# Compile imagemagick | ||
cd imagemagick | ||
autoconf | ||
./configure \ | ||
--prefix=/opt/local \ | ||
--without-xml \ | ||
--without-threads \ | ||
--without-x \ | ||
--without-pango \ | ||
--without-modules \ | ||
--without-freetype \ | ||
--without-perl \ | ||
--without-gvc \ | ||
--without-fontconfig \ | ||
--without-magick-plus-plus \ | ||
--without-tiff \ | ||
--without-lzma \ | ||
--enable-delegate-build \ | ||
--enable-static \ | ||
--enable-shared=no \ | ||
--disable-dependency-tracking \ | ||
--prefix="$PREFIX" \ | ||
CFLAGS="-I$PREFIX/include" \ | ||
CPPFLAGS="-I$PREFIX/include" \ | ||
LDFLAGS="-L$PREFIX/lib"; | ||
|
||
# Unbreak the makefile | ||
sed -i '' -E 's/^LDFLAGS = /LDFLAGS = -all-static /' Makefile | ||
|
||
make | ||
make install | ||
|
||
# Copy out the only executable we care about: convert | ||
mkdir -p "$BUILD" | ||
cp "$PREFIX/bin/convert" "$BUILD" | ||
|
||
# Clean up | ||
cd "$HERE" | ||
rm -rf "$TEMP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
HERE="$(cd "$(dirname "$0")"; pwd)" | ||
BASE="$HERE/.." | ||
PYTHON_VERSION="2.7.10" | ||
PYTHON_VERSION_MAJOR="${PYTHON_VERSION:0:3}" | ||
ARCHIVE="Python-${PYTHON_VERSION}.tgz" | ||
PYTHON_DOWNLOAD_URL="https://www.python.org/ftp/python/$PYTHON_VERSION/$ARCHIVE" | ||
OUT="$BASE/build" | ||
TEMP="$BASE/build/tmp" | ||
TEMP_OUT="$TEMP/out" | ||
FRAMEWORK="$TEMP/out/Python.framework" | ||
USELESS_LIBRARIES="ensurepip bsddb config idlelib lib-tk lib2to3 test lib-dynload/_Qt.so lib-dynload/_tkinter.so" | ||
|
||
rm -rf "$TEMP" | ||
|
||
# Resolve temp out so that we have no funny business later. We need to make sure | ||
# path is reproducible at a later point so that we can rewrite the paths with | ||
# install_name_tool. See make-python-framework-relocatable:ORIGINAL_FRAMEWORK_PATH | ||
# for more information. | ||
mkdir -p "$TEMP_OUT" | ||
TEMP_OUT="$(cd $TEMP_OUT; pwd)" | ||
|
||
cd "$TEMP" | ||
|
||
# Compile settings | ||
export MACOSX_DEPLOYMENT_TARGET=10.9 | ||
|
||
# Download archive and unpack | ||
wget "$PYTHON_DOWNLOAD_URL" | ||
tar --strip-components=1 -xzf "$ARCHIVE" | ||
|
||
# Fix up setup.py for ssl | ||
python -c ' | ||
s = open("setup.py").read() | ||
s = s.replace("/usr/local/ssl", "/usr/local/opt/openssl") | ||
open("setup.py", "w").write(s) | ||
' | ||
|
||
patch -p1 < "$BASE/resources/setup.py.patch" | ||
|
||
# If you change this stuff here, you also need to change the corresponding | ||
# bits in make-python-framework-relocatable | ||
export CFLAGS="-I/usr/local/opt/openssl/include" | ||
export CPPFLAGS="-I/usr/local/opt/openssl/include" | ||
export LDFLAGS="-L/usr/local/opt/openssl/lib" | ||
export LD_LIBRARY_PATH="/usr/local/opt/openssl/lib" | ||
|
||
# Compile | ||
./configure \ | ||
--prefix="$TEMP_OUT" \ | ||
--enable-framework="$TEMP_OUT" \ | ||
--without-ensurepip \ | ||
--without-gcc \ | ||
CFLAGS=$CFLAGS \ | ||
CPPFLAGS=$CPPFLAGS \ | ||
LDFLAGS=$LDFLAGS \ | ||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH \ | ||
MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET | ||
make | ||
make frameworkinstall | ||
|
||
# Install sitecustomize | ||
cp \ | ||
"$BASE/resources/sitecustomize.py" \ | ||
"$FRAMEWORK/Versions/$PYTHON_VERSION_MAJOR/lib/python$PYTHON_VERSION_MAJOR" | ||
|
||
# Delete pyc files | ||
find "$FRAMEWORK" -name '*.py[co]' -exec rm '{}' \; | ||
|
||
# Delete stupid libraries | ||
for lib in $USELESS_LIBRARIES; do | ||
rm -rf "$FRAMEWORK/Versions/$PYTHON_VERSION_MAJOR/lib/python$PYTHON_VERSION_MAJOR/$USELESS_LIBRARIES" | ||
done | ||
|
||
# Delete other unwanted things | ||
rm -rf "$FRAMEWORK/Versions/$PYTHON_VERSION_MAJOR/lib/pkgconfig" | ||
rm -rf "$FRAMEWORK/Versions/$PYTHON_VERSION_MAJOR/Mac" | ||
rm -rf "$FRAMEWORK/Versions/$PYTHON_VERSION_MAJOR/share" | ||
|
||
# Move framework out | ||
mkdir -p "$OUT" | ||
mv "$FRAMEWORK" "$OUT" | ||
|
||
# Clean up | ||
rm -rf "$TEMP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
HERE="$(cd "$(dirname "$0")"; pwd)" | ||
BASE="$HERE/.." | ||
OUT="$BASE/build" | ||
WHEELS="$OUT/wheels" | ||
|
||
for wheel in $WHEELS/*.whl; do | ||
unzip "$wheel" -d "$1" | ||
done |
Oops, something went wrong.