Unverified Commit 78ce1f39 authored by Philip Müller's avatar Philip Müller Committed by GitHub
Browse files

Merge pull request #10 from jonathonf/master

Refactor Makefile to remove all duplication
parents 2c92e25f 5decfcd0
PREFIX ?= /usr/local
BUILDDIR = build
ICONDIR = $(PREFIX)/share/pixmaps
APPS = office word excel onenote outlook powerpoint skype
APPS2 = office2 word2 excel2 onenote2 outlook2 powerpoint2 skype2
OFFICEDOMAINS = \"https://office.live.com\", \"https://www.office.com\"
CATEGORY ?= Office
all: build
$(APPS):
mkdir -p $(BUILDDIR)/$@
sed -e "s|@APPNAME@|\u$@|" \
-e "s|@APPNAMELOWER@|\L$@|" \
-e "s|@CATEGORIES@|Office|" launcher.desktop.in > $(BUILDDIR)/$@/$@.desktop
sed -e "s|@ICON@|$(ICONDIR)/ms-$@.png|" settings.json.in > $(BUILDDIR)/$@/settings.json
sed -e "s|@PREFIX@|$(PREFIX)|" ms-office-online.in > $(BUILDDIR)/$@/ms-office-online
build: $(APPS)
# Office
sed -i "s|@URL@|https://www.office.com/login?es=Click\&ru=%2F|" $(BUILDDIR)/office/settings.json
sed -i "s|@DOMAINS@|'https://office.live.com', 'https://www.office.com'|" $(BUILDDIR)/office/settings.json
# Word
sed -i "s|@URL@|https://office.live.com/start/Word.aspx|" $(BUILDDIR)/word/settings.json
sed -i "s|@DOMAINS@|'https://office.live.com', 'https://www.office.com'|" $(BUILDDIR)/word/settings.json
# Excel
sed -i "s|@URL@|https://office.live.com/start/Excel.aspx|" $(BUILDDIR)/excel/settings.json
sed -i "s|@DOMAINS@|'https://office.live.com', 'https://www.office.com'|" $(BUILDDIR)/excel/settings.json
# OneNote
sed -i "s|@URL@|https://www.onenote.com/notebooks|" $(BUILDDIR)/onenote/settings.json
# OutLook
sed -i "s|@URL@|https://outlook.live.com/owa|" $(BUILDDIR)/outlook/settings.json
sed -i "s|@DOMAINS@|'https://people.live.com', 'https://calendar.live.com'|" $(BUILDDIR)/outlook/settings.json
# Force new user interface
sed -i "s|@AGENT@|Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14|" $(BUILDDIR)/outlook/settings.json
# PowerPoint
sed -i "s|@URL@|https://office.live.com/start/PowerPoint.aspx|" $(BUILDDIR)/powerpoint/settings.json
sed -i "s|@DOMAINS@|'https://office.live.com', 'https://www.office.com'|" $(BUILDDIR)/powerpoint/settings.json
# Skype
sed -i "s|@URL@|https://web.skype.com|" $(BUILDDIR)/skype/settings.json
sed -i "s|Categories=Office|Categories=Network|" $(BUILDDIR)/skype/skype.desktop
sed "s|@APPNAME@|\u$@|; \
s|@APPNAMELOWER@|\L$@|; \
s|@CATEGORY@|$(CATEGORY)|" launcher.desktop.in > $(BUILDDIR)/$@/$@.desktop
sed "s|@ICON@|$(ICONDIR)/ms-$@.png|; \
s|@URL@|$(URL)|; \
s|@DOMAINS@|$(DOMAINS)|; \
s|@UA@|$(UA)|" settings.json.in > $(BUILDDIR)/$@/settings.json
sed "s|@PREFIX@|$(PREFIX)|; \
s|@APPNAMELOWER@|\L$@|" launcher.sh.in > $(BUILDDIR)/$@/ms-$@
office2: URL = https://www.office.com/login?es=Click\&ru=%2F
office2: DOMAINS = $(OFFICEDOMAINS)
office2: office
word2: URL = https://office.live.com/start/Word.aspx
word2: DOMAINS = $(OFFICEDOMAINS)
word2: word
excel2: URL = https://office.live.com/start/Excel.aspx
excel2: DOMAINS = $(OFFICEDOMAINS)
excel2: excel
onenote2: URL = https://www.onenote.com/notebooks
onenote2: onenote
outlook2: URL = https://outlook.live.com/owa
outlook2: DOMAINS = \"https://people.live.com\", \"https://calendar.live.com\"
outlook2: UA = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14
outlook2: outlook
powerpoint2: URL = https://office.live.com/start/PowerPoint.aspx
powerpoint2: DOMAINS = $(OFFICEDOMAINS)
powerpoint2: powerpoint
skype2: URL = https://web.skype.com
skype2: CATEGORY = Network
skype2: skype
build: $(APPS2)
sed "s|@PREFIX@|$(PREFIX)|" ms-office-online.in > $(BUILDDIR)/ms-office-online
install: build
install -dm755 $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/ms-office
for app in $(APPS); do \
install -Dm644 icons/$$app.png \
$(DESTDIR)$(ICONDIR)/ms-$$app.png ; \
install -Dm755 $(BUILDDIR)/$$app/ms-office-online \
$(DESTDIR)$(PREFIX)/share/ms-office/$$app/ms-office-online ; \
echo "#!/bin/sh" > "$(DESTDIR)$(PREFIX)/bin/ms-$$app" ; \
echo "cd $(PREFIX)/share/ms-office/$$app" >> "$(DESTDIR)$(PREFIX)/bin/ms-$$app" ; \
echo "./ms-office-online" >> "$(DESTDIR)$(PREFIX)/bin/ms-$$app" ; \
chmod a+x "$(DESTDIR)$(PREFIX)/bin/ms-$$app" ; \
install -Dm755 $(BUILDDIR)/ms-office-online \
$(DESTDIR)$(PREFIX)/share/ms-office-online/$$app/ms-$$app-online ; \
install -Dm755 $(BUILDDIR)/$$app/ms-$$app \
$(DESTDIR)$(PREFIX)/bin/ms-$$app ; \
install -Dm644 $(BUILDDIR)/$$app/settings.json \
$(DESTDIR)$(PREFIX)/share/ms-office/$$app/settings.json ; \
$(DESTDIR)$(PREFIX)/share/ms-office-online/$$app/settings.json ; \
install -Dm644 $(BUILDDIR)/$$app/$$app.desktop \
$(DESTDIR)$(PREFIX)/share/applications/ms-$$app.desktop ; \
done
......@@ -57,4 +69,4 @@ install: build
clean:
rm -fr $(BUILDDIR)
.PHONY: build install clean $(APPS)
.PHONY: build install clean $(APPS) $(APPS2)
......@@ -3,7 +3,7 @@ Version=1.0
Terminal=false
Icon=ms-@APPNAMELOWER@
Type=Application
Categories=@CATEGORIES@;
Categories=@CATEGORY@;
Exec=ms-@APPNAMELOWER@
Name=Microsoft @APPNAME@ Online
GenericName=@APPNAME@
......
#!/bin/sh
cd @PREFIX@/share/ms-office-online/@APPNAMELOWER@
./ms-@APPNAMELOWER@-online
#!@PREFIX@/bin/env python3
#!/usr/bin/env python3
# coding: utf-8
try:
from j.AK import Api, AppWindow, settings
......@@ -29,24 +29,24 @@ class applicationWindow(AppWindow):
"""
def check_Link(url):
if url.startswith(same_frame()):
self.webview.load_uri(url)
else:
if url.startswith(("https://people", "https://outlook", "https://calendar")):
os.chdir("@PREFIX@/share/ms-office/outlook/")
os.chdir("@PREFIX@/share/ms-office-online/outlook/")
elif url.startswith("https://www.onenote"):
os.chdir("@PREFIX@/share/ms-office/onenote/")
os.chdir("@PREFIX@/share/ms-office-online/onenote/")
elif url.startswith("https://web.skype"):
os.chdir("@PREFIX@/share/ms-office/skype/")
os.chdir("@PREFIX@/share/ms-office-online/skype/")
else:
# use default settings file
os.chdir("@PREFIX@/share/ms-office/office/")
os.chdir("@PREFIX@/share/ms-office-online/office/")
# open url in a new window
GLib.spawn_command_line_async("jak " + url)
......
......@@ -12,7 +12,7 @@
"webkit": {
"cache": "online",
"context_menu": true,
"user_agent": "@AGENT@",
"user_agent": "@UA@",
"site_quirks": true,
"same_frame": [@DOMAINS@]
}
......
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