Compare commits
No commits in common. "ci" and "main" have entirely different histories.
3016 changed files with 642270 additions and 114 deletions
23
.babelrc
Normal file
23
.babelrc
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"compact": false,
|
||||||
|
"retainLines": true,
|
||||||
|
"presets": [
|
||||||
|
"@babel/preset-react"
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"chrome/content/zotero/include.js",
|
||||||
|
"chrome/content/zotero/xpcom/citeproc.js",
|
||||||
|
"chrome/content/ace/*",
|
||||||
|
"chrome/content/scaffold/templates/*",
|
||||||
|
"resource/react-virtualized.js",
|
||||||
|
"test/resource/*.js"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"transform-es2015-modules-commonjs",
|
||||||
|
{
|
||||||
|
"strictMode": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
17
.eslintignore
Normal file
17
.eslintignore
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
build/*
|
||||||
|
chrome/content/zotero/xpcom/citeproc.js
|
||||||
|
chrome/content/zotero/xpcom/isbn.js
|
||||||
|
chrome/content/zotero/xpcom/rdf/*
|
||||||
|
chrome/content/zotero/xpcom/xregexp/*
|
||||||
|
chrome/content/zotero/xpcom/translation/tlds.js
|
||||||
|
chrome/skin/default/zotero/timeline/bundle.js
|
||||||
|
chrome/skin/default/zotero/timeline/timeline-api.js
|
||||||
|
resource/bluebird/*
|
||||||
|
resource/classnames.js
|
||||||
|
resource/csl-validator.js
|
||||||
|
resource/jspath.js
|
||||||
|
resource/prop-types.js
|
||||||
|
resource/react*
|
||||||
|
resource/tinymce/*
|
||||||
|
test/resource/*
|
||||||
|
translators/*
|
63
.eslintrc
Normal file
63
.eslintrc
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"Zotero": false,
|
||||||
|
"ZOTERO_CONFIG": false,
|
||||||
|
"AddonManager": false,
|
||||||
|
"Cc": false,
|
||||||
|
"Ci": false,
|
||||||
|
"ChromeUtils": false,
|
||||||
|
"Components": false,
|
||||||
|
"ConcurrentCaller": false,
|
||||||
|
"ctypes": false,
|
||||||
|
"OS": false,
|
||||||
|
"MozXULElement": false,
|
||||||
|
"PluralForm": false,
|
||||||
|
"Services": false,
|
||||||
|
"windowUtils": false,
|
||||||
|
"XPCOMUtils": false,
|
||||||
|
"XRegExp": false,
|
||||||
|
"XULElement": false,
|
||||||
|
"XULElementBase": false,
|
||||||
|
"ItemPaneSectionElementBase": false,
|
||||||
|
"Cu": false,
|
||||||
|
"ChromeWorker": false,
|
||||||
|
"Localization": false,
|
||||||
|
"L10nFileSource": false,
|
||||||
|
"L10nRegistry": false,
|
||||||
|
"ZoteroPane_Local": false,
|
||||||
|
"ZoteroPane": false,
|
||||||
|
"Zotero_Tabs": false,
|
||||||
|
"ZoteroContextPane": false,
|
||||||
|
"IOUtils": false,
|
||||||
|
"NetUtil": false,
|
||||||
|
"FileUtils": false,
|
||||||
|
"globalThis": false
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"@zotero",
|
||||||
|
"plugin:react/recommended"
|
||||||
|
],
|
||||||
|
"parser": "@babel/eslint-parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2018,
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": true
|
||||||
|
},
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"react",
|
||||||
|
"@babel"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"react": {
|
||||||
|
"version": "17.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rules": {}
|
||||||
|
}
|
|
@ -1,64 +0,0 @@
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
ref_name:
|
|
||||||
description: 'Tag or commit'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-tarball:
|
|
||||||
name: Build tarball w/ submodules
|
|
||||||
runs-on: x86_64
|
|
||||||
container:
|
|
||||||
image: alpine:latest
|
|
||||||
env:
|
|
||||||
CI_PROJECT_NAME: zotero
|
|
||||||
steps:
|
|
||||||
- name: Environment setup
|
|
||||||
run: apk add nodejs git git-archive-all gzip
|
|
||||||
- name: Repo pull
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 500
|
|
||||||
ref: ${{ inputs.ref_name }}
|
|
||||||
- name: Package build
|
|
||||||
run: |
|
|
||||||
if test $GITHUB_REF_NAME == "ci" ; then
|
|
||||||
CI_REF_NAME=${{ inputs.ref_name }}
|
|
||||||
else
|
|
||||||
CI_REF_NAME=$GITHUB_REF_NAME
|
|
||||||
fi
|
|
||||||
echo "building tarball for $CI_REF_NAME"
|
|
||||||
git-archive-all --force-submodules $CI_PROJECT_NAME-$CI_REF_NAME.tar.gz
|
|
||||||
echo "Generating sha512sum"
|
|
||||||
sha512sum $CI_PROJECT_NAME-$CI_REF_NAME.tar.gz > $CI_PROJECT_NAME-$CI_REF_NAME.tar.gz.sha512sum
|
|
||||||
- name: Package upload
|
|
||||||
uses: forgejo/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: tarball
|
|
||||||
path: zotero-*.tar*
|
|
||||||
upload-tarball:
|
|
||||||
name: Upload to generic repo
|
|
||||||
runs-on: x86_64
|
|
||||||
needs: [build-tarball]
|
|
||||||
container:
|
|
||||||
image: alpine:latest
|
|
||||||
steps:
|
|
||||||
- name: Environment setup
|
|
||||||
run: apk add nodejs curl
|
|
||||||
- name: Package download
|
|
||||||
uses: forgejo/download-artifact@v3
|
|
||||||
- name: Package deployment
|
|
||||||
run: |
|
|
||||||
if test $GITHUB_REF_NAME == "ci" ; then
|
|
||||||
CI_REF_NAME=${{ inputs.ref_name }}
|
|
||||||
else
|
|
||||||
CI_REF_NAME=$GITHUB_REF_NAME
|
|
||||||
fi
|
|
||||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/zotero-*.tar.gz ${{ github.server_url }}/api/packages/mirrors/generic/zotero/$CI_REF_NAME/zotero-$CI_REF_NAME.tar.gz
|
|
||||||
curl --user ${{ vars.CODE_FORGEJO_USER }}:${{ secrets.CODE_FORGEJO_TOKEN }} --upload-file ./tarball/zotero-*.tar.gz.sha512sum ${{ github.server_url }}/api/packages/mirrors/generic/zotero/$CI_REF_NAME/zotero-$CI_REF_NAME.tar.gz.sha512sum
|
|
|
@ -1,50 +0,0 @@
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
schedule:
|
|
||||||
- cron: '@hourly'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
mirror:
|
|
||||||
name: Pull from upstream
|
|
||||||
runs-on: x86_64
|
|
||||||
container:
|
|
||||||
image: alpine:latest
|
|
||||||
env:
|
|
||||||
upstream: https://github.com/zotero/zotero
|
|
||||||
tags: '7.*'
|
|
||||||
steps:
|
|
||||||
- name: Environment setup
|
|
||||||
run: apk add grep git sed coreutils bash nodejs
|
|
||||||
- name: Fetch destination
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch_depth: 1
|
|
||||||
ref: ci
|
|
||||||
token: ${{ secrets.CODE_FORGEJO_TOKEN }}
|
|
||||||
- name: Missing tag detecting
|
|
||||||
run: |
|
|
||||||
git ls-remote $upstream "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > upstream_tags
|
|
||||||
git ls-remote ${{ github.server_url}}/${{ github.repository }} "refs/tags/$tags" | grep -v '{' | sed 's|.*/||' > destination_tags
|
|
||||||
cat upstream_tags destination_tags | tr ' ' '\n' | sort | uniq -u > missing_tags
|
|
||||||
echo "Missing tags:"
|
|
||||||
cat missing_tags
|
|
||||||
- name: Missing tag fetch
|
|
||||||
run: |
|
|
||||||
git remote add upstream $upstream
|
|
||||||
while read tag; do
|
|
||||||
git fetch upstream tag $tag --no-tags
|
|
||||||
done < missing_tags
|
|
||||||
- name: Packaging workflow injection
|
|
||||||
run: |
|
|
||||||
while read tag; do
|
|
||||||
git checkout $tag
|
|
||||||
git tag -d $tag
|
|
||||||
git checkout ci -- ./.forgejo
|
|
||||||
git config user.name "forgejo-actions[bot]"
|
|
||||||
git config user.email "dev@ayakael.net"
|
|
||||||
git commit -m 'Inject custom workflow'
|
|
||||||
git tag -a $tag -m $tag
|
|
||||||
done < missing_tags
|
|
||||||
- name: Push to destination
|
|
||||||
run: git push --force origin refs/tags/*:refs/tags/* --tags
|
|
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
*.sql text eol=lf
|
||||||
|
app/win/zotero.exe.tar.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
app/mac/updater.tar.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
app/win/updater.exe.tar.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
app/linux/updater.tar.xz filter=lfs diff=lfs merge=lfs -text
|
9
.github/ISSUE_TEMPLATE.md
vendored
Normal file
9
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
**READ THIS BEFORE CREATING AN ISSUE**
|
||||||
|
|
||||||
|
Zotero does not use GitHub Issues for bug reports or feature requests.
|
||||||
|
|
||||||
|
Please post all such requests to the Zotero Forums at https://forums.zotero.org, where Zotero developers and many others can help. For confirmed bugs or agreed-upon changes, Zotero developers will create new issues in the relevant repositories.
|
||||||
|
|
||||||
|
Development questions involving code, APIs, or other technical topics can be posted to the zotero-dev mailing list at http://groups.google.com/group/zotero-dev.
|
||||||
|
|
||||||
|
See https://www.zotero.org/support/zotero_support for more information on how Zotero support works.
|
102
.github/workflows/ci.yml
vendored
Normal file
102
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
name: CI
|
||||||
|
on: [push, pull_request]
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build, Upload, Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
lfs: true
|
||||||
|
|
||||||
|
- name: Install Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
#cache: npm
|
||||||
|
|
||||||
|
# On GitHub
|
||||||
|
- name: Install xvfb
|
||||||
|
if: env.ACT != 'true'
|
||||||
|
run: sudo apt update && sudo apt install -y xvfb
|
||||||
|
|
||||||
|
# Local via act
|
||||||
|
- name: Install packages for act
|
||||||
|
if: env.ACT == 'true'
|
||||||
|
run: apt update && apt install -y zstd xvfb dbus-x11 libgtk-3-0 libx11-xcb1 libdbus-glib-1-2 libxt6
|
||||||
|
|
||||||
|
- name: Cache xulrunner
|
||||||
|
id: xulrunner-cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: app/xulrunner/firefox-x86_64
|
||||||
|
key: xulrunner-${{ hashFiles('app/config.sh', 'app/scripts/fetch_xulrunner') }}
|
||||||
|
|
||||||
|
- name: Fetch xulrunner
|
||||||
|
if: steps.xulrunner-cache.outputs.cache-hit != 'true'
|
||||||
|
run: app/scripts/fetch_xulrunner -p l
|
||||||
|
|
||||||
|
- name: Cache Node modules
|
||||||
|
id: node-cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Install Node modules
|
||||||
|
if: steps.node-cache.outputs.cache-hit != 'true'
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build Zotero
|
||||||
|
run: npm run build
|
||||||
|
# Currently necessary for pdf-worker Webpack: https://stackoverflow.com/a/69746937
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --openssl-legacy-provider
|
||||||
|
|
||||||
|
# Somehow forces dpl v1 to be installed, even though v2 is installed without
|
||||||
|
- uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: '3.3' # Not needed with a `.ruby-version` or `.tool-versions`
|
||||||
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||||
|
|
||||||
|
- name: Upload deployment ZIP
|
||||||
|
if: |
|
||||||
|
env.ACT != 'true'
|
||||||
|
&& github.repository == 'zotero/zotero'
|
||||||
|
&& github.event_name == 'push'
|
||||||
|
&& (github.ref == 'refs/heads/main' || endsWith(github.ref, '-hotfix'))
|
||||||
|
env:
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
run: |
|
||||||
|
mkdir build-zip
|
||||||
|
cd build
|
||||||
|
zip -r ../build-zip/$GITHUB_SHA.zip *
|
||||||
|
cd ..
|
||||||
|
# Once dpl 2 works:
|
||||||
|
#sudo gem install --no-document dpl
|
||||||
|
#dpl s3 --bucket zotero-download --local_dir build-zip --upload_dir ci/client --acl public_read
|
||||||
|
sudo gem install --no-document dpl dpl-s3
|
||||||
|
dpl --provider=s3 --bucket=zotero-download --local-dir=build-zip --upload-dir=ci/client --acl=public-read --skip_cleanup=true
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: xvfb-run test/runtests.sh -f
|
||||||
|
|
||||||
|
- name: Cache utilities Node modules
|
||||||
|
id: utilities-node-cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: chrome/content/zotero/xpcom/utilities/node_modules
|
||||||
|
key: utilities-node-modules-${{ hashFiles('chrome/content/zotero/xpcom/utilities/package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Install utilities Node modules
|
||||||
|
if: steps.utilities-node-cache.outputs.cache-hit != 'true'
|
||||||
|
run: npm install --prefix chrome/content/zotero/xpcom/utilities
|
||||||
|
|
||||||
|
- name: Run utilities tests
|
||||||
|
run: |
|
||||||
|
npm test --prefix chrome/content/zotero/xpcom/utilities -- -j resource/schema/global/schema.json
|
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
build/
|
||||||
|
.signatures.json
|
||||||
|
tmp
|
||||||
|
app/win/codesign
|
58
.gitmodules
vendored
Normal file
58
.gitmodules
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
[submodule "translators"]
|
||||||
|
path = translators
|
||||||
|
url = https://github.com/zotero/translators.git
|
||||||
|
branch = master
|
||||||
|
[submodule "chrome/content/zotero/locale/csl"]
|
||||||
|
path = chrome/content/zotero/locale/csl
|
||||||
|
url = https://github.com/citation-style-language/locales.git
|
||||||
|
branch = master
|
||||||
|
[submodule "styles"]
|
||||||
|
path = styles
|
||||||
|
url = https://github.com/zotero/bundled-styles.git
|
||||||
|
branch = master
|
||||||
|
[submodule "test/resource/chai"]
|
||||||
|
path = test/resource/chai
|
||||||
|
url = https://github.com/chaijs/chai.git
|
||||||
|
branch = master
|
||||||
|
[submodule "test/resource/mocha"]
|
||||||
|
path = test/resource/mocha
|
||||||
|
url = https://github.com/mochajs/mocha.git
|
||||||
|
branch = master
|
||||||
|
[submodule "test/resource/chai-as-promised"]
|
||||||
|
path = test/resource/chai-as-promised
|
||||||
|
url = https://github.com/domenic/chai-as-promised.git
|
||||||
|
branch = master
|
||||||
|
[submodule "resource/schema/global"]
|
||||||
|
path = resource/schema/global
|
||||||
|
url = https://github.com/zotero/zotero-schema.git
|
||||||
|
branch = master
|
||||||
|
[submodule "resource/SingleFile"]
|
||||||
|
path = resource/SingleFile
|
||||||
|
url = https://github.com/gildas-lormeau/SingleFile.git
|
||||||
|
[submodule "pdf-reader"]
|
||||||
|
path = reader
|
||||||
|
url = https://github.com/zotero/reader.git
|
||||||
|
branch = master
|
||||||
|
[submodule "pdf-worker"]
|
||||||
|
path = pdf-worker
|
||||||
|
url = https://github.com/zotero/pdf-worker.git
|
||||||
|
branch = master
|
||||||
|
[submodule "note-editor"]
|
||||||
|
path = note-editor
|
||||||
|
url = https://github.com/zotero/note-editor.git
|
||||||
|
branch = master
|
||||||
|
[submodule "chrome/content/zotero/xpcom/utilities"]
|
||||||
|
path = chrome/content/zotero/xpcom/utilities
|
||||||
|
url = https://github.com/zotero/utilities.git
|
||||||
|
[submodule "chrome/content/zotero/xpcom/translate"]
|
||||||
|
path = chrome/content/zotero/xpcom/translate
|
||||||
|
url = https://github.com/zotero/translate.git
|
||||||
|
[submodule "app/modules/zotero-word-for-mac-integration"]
|
||||||
|
path = app/modules/zotero-word-for-mac-integration
|
||||||
|
url = https://github.com/zotero/zotero-word-for-mac-integration.git
|
||||||
|
[submodule "app/modules/zotero-word-for-windows-integration"]
|
||||||
|
path = app/modules/zotero-word-for-windows-integration
|
||||||
|
url = https://github.com/zotero/zotero-word-for-windows-integration.git
|
||||||
|
[submodule "app/modules/zotero-libreoffice-integration"]
|
||||||
|
path = app/modules/zotero-libreoffice-integration
|
||||||
|
url = https://github.com/zotero/zotero-libreoffice-integration.git
|
11
CONTRIBUTING.md
Normal file
11
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Contributing to Zotero
|
||||||
|
|
||||||
|
## Bug Reports and Feature Requests
|
||||||
|
|
||||||
|
Zotero does not use GitHub Issues for bug reports, feature requests, or support questions. Please post all such requests to the [Zotero Forums](https://forums.zotero.org), where Zotero developers and many others can help. See [How Zotero Support Works](https://www.zotero.org/support/zotero_support) for more information.
|
||||||
|
|
||||||
|
For confirmed bugs or agreed-upon changes, Zotero developers will create new issues in the relevant repositories.
|
||||||
|
|
||||||
|
## Working with Zotero Code
|
||||||
|
|
||||||
|
See [Zotero Source Code](https://www.zotero.org/support/dev/source_code).
|
681
COPYING
Normal file
681
COPYING
Normal file
|
@ -0,0 +1,681 @@
|
||||||
|
Zotero is Copyright © 2018 Corporation for Digital Scholarship,
|
||||||
|
Vienna, Virginia, USA http://digitalscholar.org
|
||||||
|
|
||||||
|
Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||||
|
Roy Rosenzweig Center for History and New Media, George Mason University,
|
||||||
|
Fairfax, Virginia, USA http://zotero.org
|
||||||
|
|
||||||
|
The Corporation for Digital Scholarship distributes the Zotero source code
|
||||||
|
under the GNU Affero General Public License, version 3 (AGPLv3). The full text
|
||||||
|
of this license is given below.
|
||||||
|
|
||||||
|
The Zotero name is a registered trademark of the Corporation for Digital Scholarship.
|
||||||
|
See http://zotero.org/trademark for more information.
|
||||||
|
|
||||||
|
Third-party copyright in this distribution is noted where applicable.
|
||||||
|
|
||||||
|
All rights not expressly granted are reserved.
|
||||||
|
|
||||||
|
=========================================================================
|
||||||
|
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
9
README.md
Normal file
9
README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Zotero
|
||||||
|
======
|
||||||
|
[![CI](https://github.com/zotero/zotero/actions/workflows/ci.yml/badge.svg)](https://github.com/zotero/zotero/actions/workflows/ci.yml)
|
||||||
|
|
||||||
|
[Zotero](https://www.zotero.org/) is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.
|
||||||
|
|
||||||
|
Please post feature requests or bug reports to the [Zotero Forums](https://forums.zotero.org/). If you're having trouble with Zotero, see [Getting Help](https://www.zotero.org/support/getting_help).
|
||||||
|
|
||||||
|
For more information on how to use this source code, see the [Zotero documentation](https://www.zotero.org/support/dev/source_code).
|
12
app/.gitignore
vendored
Normal file
12
app/.gitignore
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
*~
|
||||||
|
cache
|
||||||
|
config-custom.sh
|
||||||
|
dist
|
||||||
|
lastrev
|
||||||
|
staging
|
||||||
|
tmp
|
||||||
|
xulrunner
|
||||||
|
win/resource_hacker
|
||||||
|
win/firefox-*.win32.zip
|
||||||
|
win/firefox-*.win64.zip
|
||||||
|
win/firefox-*.win64-aarch64.zip
|
4
app/README.md
Normal file
4
app/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Zotero Standalone build utility
|
||||||
|
These files are used to bundle the [Zotero core](https://github.com/zotero/zotero) into distributable bundles for Mac, Windows, and Linux.
|
||||||
|
|
||||||
|
Instructions for building and packaging are available on the [Zotero wiki](https://www.zotero.org/support/dev/client_coding/building_the_standalone_client).
|
18
app/assets/application.ini
Normal file
18
app/assets/application.ini
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
[App]
|
||||||
|
Vendor=Zotero
|
||||||
|
Name=Zotero
|
||||||
|
Version={{VERSION}}
|
||||||
|
BuildID={{BUILDID}}
|
||||||
|
Copyright=Copyright (c) 2006-2022 Contributors
|
||||||
|
ID=zotero@zotero.org
|
||||||
|
|
||||||
|
[Gecko]
|
||||||
|
MinVersion=115.0
|
||||||
|
MaxVersion=115.99.*
|
||||||
|
|
||||||
|
[XRE]
|
||||||
|
EnableExtensionManager=1
|
||||||
|
EnableProfileMigrator=1
|
||||||
|
|
||||||
|
[AppUpdate]
|
||||||
|
URL=https://www.zotero.org/download/client/update/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/update.xml
|
1
app/assets/branding/locale/brand.dtd
Normal file
1
app/assets/branding/locale/brand.dtd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<!ENTITY brandShortName "Zotero">
|
7
app/assets/branding/locale/brand.ftl
Normal file
7
app/assets/branding/locale/brand.ftl
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
-brand-shorter-name = Zotero
|
||||||
|
-brand-short-name = Zotero
|
||||||
|
-brand-full-name = Zotero
|
||||||
|
-brand-product-name = Zotero
|
||||||
|
-vendor-short-name = Zotero
|
||||||
|
-app-name = Zotero
|
||||||
|
trademarkInfo = Zotero is a trademark of the Corporation for Digital Scholarship.
|
3
app/assets/branding/locale/brand.properties
Normal file
3
app/assets/branding/locale/brand.properties
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
brandShorterName=Zotero
|
||||||
|
brandShortName=Zotero
|
||||||
|
brandFullName=Zotero
|
3
app/assets/chrome.manifest
Normal file
3
app/assets/chrome.manifest
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
locale branding en-US chrome/en-US/locale/branding/
|
||||||
|
content branding chrome/branding/content/
|
||||||
|
skin browser preferences chrome/skin/
|
102
app/assets/commandLineHandler.js
Normal file
102
app/assets/commandLineHandler.js
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
let { CommandLineOptions, TestOptions } = ChromeUtils.importESModule("chrome://zotero/content/modules/commandLineOptions.mjs");
|
||||||
|
|
||||||
|
// Only allow BrowserContentHandler to open a new window if this is the initial launch,
|
||||||
|
// meaning our CLH isn't registered yet.
|
||||||
|
if (cmdLine.state != Ci.nsICommandLine.STATE_INITIAL_LAUNCH) {
|
||||||
|
cmdLine.preventDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force debug output to window
|
||||||
|
if (cmdLine.handleFlag("ZoteroDebug", false)) {
|
||||||
|
CommandLineOptions.forceDebugLog = 2;
|
||||||
|
}
|
||||||
|
// Force debug output to text console
|
||||||
|
else if (cmdLine.handleFlag("ZoteroDebugText", false)) {
|
||||||
|
CommandLineOptions.forceDebugLog = 1;
|
||||||
|
}
|
||||||
|
// Pressing Ctrl-C via the terminal is interpreted as a crash, and after three crashes
|
||||||
|
// Firefox starts up in automatic safe mode (troubleshooting mode). To avoid this, we clear the crash
|
||||||
|
// counter when using one of the debug-logging flags, which generally imply terminal usage.
|
||||||
|
if (CommandLineOptions.forceDebugLog) {
|
||||||
|
Services.prefs.getBranch("toolkit.startup.").clearUserPref("recent_crashes");
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandLineOptions.forceDataDir = cmdLine.handleFlagWithParam("datadir", false);
|
||||||
|
// Set here, to be acted upon in xpcom/commandLineHandler.js
|
||||||
|
CommandLineOptions.file = cmdLine.handleFlagWithParam("file", false);
|
||||||
|
CommandLineOptions.url = cmdLine.handleFlagWithParam("url", false);
|
||||||
|
if (CommandLineOptions.url) {
|
||||||
|
CommandLineOptions.url = cmdLine.resolveURI(CommandLineOptions.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
var processTestOptions = false;
|
||||||
|
if (cmdLine.handleFlag("ZoteroTest", false)) {
|
||||||
|
CommandLineOptions.test = true;
|
||||||
|
processTestOptions = true;
|
||||||
|
}
|
||||||
|
if (cmdLine.handleFlag("ZoteroAutomatedTest", false)) {
|
||||||
|
CommandLineOptions.automatedTest = true;
|
||||||
|
}
|
||||||
|
if (cmdLine.handleFlag("ZoteroSkipBundledFiles", false)) {
|
||||||
|
CommandLineOptions.skipBundledFiles = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (processTestOptions) {
|
||||||
|
TestOptions.tests = cmdLine.handleFlagWithParam("test", false);
|
||||||
|
TestOptions.noquit = cmdLine.handleFlag("noquit", false);
|
||||||
|
TestOptions.makeTestData = cmdLine.handleFlag("makeTestData", false);
|
||||||
|
TestOptions.noquit = !TestOptions.makeTestData && TestOptions.noquit;
|
||||||
|
TestOptions.runTests = !TestOptions.makeTestData;
|
||||||
|
TestOptions.bail = cmdLine.handleFlag("bail", false);
|
||||||
|
TestOptions.startAt = cmdLine.handleFlagWithParam("startAtTestFile", false);
|
||||||
|
TestOptions.stopAt = cmdLine.handleFlagWithParam("stopAtTestFile", false);
|
||||||
|
TestOptions.grep = cmdLine.handleFlagWithParam("grep", false);
|
||||||
|
TestOptions.timeout = cmdLine.handleFlagWithParam("ZoteroTestTimeout", false);
|
||||||
|
|
||||||
|
Services.ww.openWindow(
|
||||||
|
null,
|
||||||
|
"chrome://zotero-unit/content/runtests.html",
|
||||||
|
"_blank",
|
||||||
|
"chrome,dialog=no,all",
|
||||||
|
Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray)
|
||||||
|
);
|
||||||
|
cmdLine.preventDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmdLine.handleFlag("debugger", false)) {
|
||||||
|
(async function () {
|
||||||
|
try {
|
||||||
|
let portOrPath = Services.prefs.getBranch('').getIntPref('devtools.debugger.remote-port');
|
||||||
|
|
||||||
|
const { DevToolsLoader } = ChromeUtils.import(
|
||||||
|
"resource://devtools/shared/loader/Loader.jsm"
|
||||||
|
);
|
||||||
|
const loader = new DevToolsLoader({
|
||||||
|
freshCompartment: true,
|
||||||
|
});
|
||||||
|
const { DevToolsServer } = loader.require("devtools/server/devtools-server");
|
||||||
|
const { SocketListener } = loader.require("devtools/shared/security/socket");
|
||||||
|
|
||||||
|
if (DevToolsServer.initialized) {
|
||||||
|
dump("Debugger server already initialized\n\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DevToolsServer.init();
|
||||||
|
DevToolsServer.registerAllActors();
|
||||||
|
DevToolsServer.allowChromeProcess = true;
|
||||||
|
const socketOptions = { portOrPath };
|
||||||
|
const listener = new SocketListener(DevToolsServer, socketOptions);
|
||||||
|
await listener.open();
|
||||||
|
if (!DevToolsServer.listeningSockets) {
|
||||||
|
throw new Error("No listening sockets");
|
||||||
|
}
|
||||||
|
|
||||||
|
dump(`Debugger server started on ${portOrPath}\n\n`);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
dump(e + "\n\n");
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
242
app/assets/mac/chrome/skin/preferences/preferences.css
Normal file
242
app/assets/mac/chrome/skin/preferences/preferences.css
Normal file
|
@ -0,0 +1,242 @@
|
||||||
|
/*
|
||||||
|
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
# the License. You may obtain a copy of the License at
|
||||||
|
# http://www.mozilla.org/MPL/
|
||||||
|
#
|
||||||
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
# for the specific language governing rights and limitations under the
|
||||||
|
# License.
|
||||||
|
#
|
||||||
|
# The Original Code is the Firefox Preferences System.
|
||||||
|
#
|
||||||
|
# The Initial Developer of the Original Code is
|
||||||
|
# Ben Goodger.
|
||||||
|
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||||
|
# the Initial Developer. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Contributor(s):
|
||||||
|
# Ben Goodger <ben@mozilla.org>
|
||||||
|
# Kevin Gerich <webmail@kmgerich.com>
|
||||||
|
#
|
||||||
|
# Alternatively, the contents of this file may be used under the terms of
|
||||||
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
# of those above. If you wish to allow use of your version of this file only
|
||||||
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
# use your version of this file under the terms of the MPL, indicate your
|
||||||
|
# decision by deleting the provisions above and replace them with the notice
|
||||||
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
# the provisions above, a recipient may use your version of this file under
|
||||||
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
.windowDialog {
|
||||||
|
padding: 12px;
|
||||||
|
font: -moz-dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paneSelector {
|
||||||
|
list-style-image: url("chrome://browser/skin/preferences/Options.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- GENERAL BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=paneGeneral],
|
||||||
|
radio[pane=paneMain] {
|
||||||
|
-moz-image-region: rect(0px, 32px, 32px, 0px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- TABS BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=paneTabs] {
|
||||||
|
-moz-image-region: rect(0px, 64px, 32px, 32px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- CONTENT BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=paneContent] {
|
||||||
|
-moz-image-region: rect(0px, 96px, 32px, 64px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- APPLICATIONS BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=paneApplications] {
|
||||||
|
-moz-image-region: rect(0px, 128px, 32px, 96px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- PRIVACY BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=panePrivacy] {
|
||||||
|
-moz-image-region: rect(0px, 160px, 32px, 128px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- SECURITY BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=paneSecurity] {
|
||||||
|
-moz-image-region: rect(0px, 192px, 32px, 160px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- ADVANCED BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=paneAdvanced] {
|
||||||
|
-moz-image-region: rect(0px, 224px, 32px, 192px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----- SYNC BUTTON ----- */
|
||||||
|
|
||||||
|
radio[pane=paneSync] {
|
||||||
|
list-style-image: url("chrome://browser/skin/preferences/Options-sync.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- APPLICATIONS PREFPANE ----- */
|
||||||
|
#BrowserPreferences[animated="true"] #handlersView {
|
||||||
|
height: 25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#BrowserPreferences[animated="false"] #handlersView {
|
||||||
|
-moz-box-flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
description {
|
||||||
|
font: small-caption;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1.3em;
|
||||||
|
margin-bottom: 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
prefpane .groupbox-body {
|
||||||
|
-moz-appearance: none;
|
||||||
|
padding: 8px 4px 4px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#paneTabs > groupbox {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tabPrefsBox {
|
||||||
|
margin: 12px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
prefpane .groupbox-title {
|
||||||
|
background: url("chrome://global/skin/50pct_transparent_grey.png") repeat-x bottom left;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tabpanels {
|
||||||
|
padding: 20px 7px 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
caption {
|
||||||
|
-moz-padding-start: 5px;
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#paneMain description,
|
||||||
|
#paneContent description,
|
||||||
|
#paneAdvanced description,
|
||||||
|
#paneSecurity description {
|
||||||
|
font: -moz-dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
#paneContent {
|
||||||
|
padding-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#paneContent row {
|
||||||
|
padding: 2px 4px;
|
||||||
|
-moz-box-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#popupPolicyRow,
|
||||||
|
#enableSoftwareInstallRow,
|
||||||
|
#enableImagesRow {
|
||||||
|
margin-bottom: 4px !important;
|
||||||
|
padding-bottom: 4px !important;
|
||||||
|
border-bottom: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#browserUseCurrent,
|
||||||
|
#browserUseBookmark,
|
||||||
|
#browserUseBlank {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#advancedPrefs {
|
||||||
|
margin: 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#privacyPrefs {
|
||||||
|
padding: 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#privacyPrefs > tabpanels {
|
||||||
|
padding: 18px 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#OCSPDialogPane {
|
||||||
|
font: message-box !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Privacy Pane
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* styles for the link elements copied from .text-link in global.css */
|
||||||
|
.inline-link {
|
||||||
|
color: -moz-nativehyperlinktext;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-link:not(:focus) {
|
||||||
|
outline: 1px dotted transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Preferences
|
||||||
|
*/
|
||||||
|
#autoInstallOptions {
|
||||||
|
-moz-margin-start: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.updateControls {
|
||||||
|
-moz-margin-start: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear Private Data
|
||||||
|
*/
|
||||||
|
#SanitizeDialogPane > groupbox {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----- SYNC PANE ----- */
|
||||||
|
|
||||||
|
#syncDesc {
|
||||||
|
padding: 0 8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#accountCaptionImage {
|
||||||
|
list-style-image: url("chrome://mozapps/skin/profile/profileicon.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
#syncAddDeviceLabel {
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#syncEnginesList {
|
||||||
|
height: 10em;
|
||||||
|
}
|
||||||
|
|
1
app/assets/multilocale.txt
Normal file
1
app/assets/multilocale.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
en-US,ar,bg-BG,br,ca-AD,cs-CZ,da-DK,de,el-GR,en-AU,en-CA,en-GB,en-NZ,es-ES,et-EE,eu-ES,fa,fi-FI,fr-FR,gl-ES,hu-HU,id-ID,is-IS,it-IT,ja-JP,km,ko-KR,lt-LT,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,ru-RU,sk-SK,sl-SI,sr-RS,sv-SE,ta,th-TH,tr-TR,uk-UA,vi-VN,zh-CN,zh-TW
|
157
app/assets/prefs.js
Normal file
157
app/assets/prefs.js
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
// We only want a single window, I think
|
||||||
|
pref("toolkit.singletonWindowType", "navigator:browser");
|
||||||
|
|
||||||
|
// For debugging purposes, show errors in console by default
|
||||||
|
pref("javascript.options.showInConsole", true);
|
||||||
|
|
||||||
|
// Don't retrieve unrequested links when performing standalone translation
|
||||||
|
pref("network.prefetch-next", false);
|
||||||
|
|
||||||
|
// Let operations run as long as necessary
|
||||||
|
pref("dom.max_chrome_script_run_time", 0);
|
||||||
|
|
||||||
|
pref("intl.locale.requested", '');
|
||||||
|
pref("intl.regional_prefs.use_os_locales", false);
|
||||||
|
|
||||||
|
// Fix error initializing login manager after this was changed in Firefox 57
|
||||||
|
// Could also disable this with MOZ_LOADER_SHARE_GLOBAL, supposedly
|
||||||
|
pref("jsloader.shareGlobal", false);
|
||||||
|
|
||||||
|
// Needed due to https://bugzilla.mozilla.org/show_bug.cgi?id=1181977
|
||||||
|
pref("browser.hiddenWindowChromeURL", "chrome://zotero/content/standalone/hiddenWindow.xhtml");
|
||||||
|
// Use basicViewer for opening new DOM windows from content (for TinyMCE)
|
||||||
|
pref("browser.chromeURL", "chrome://zotero/content/standalone/basicViewer.xhtml");
|
||||||
|
// We need these to get the save dialog working with contentAreaUtils.js
|
||||||
|
pref("browser.download.useDownloadDir", false);
|
||||||
|
pref("browser.download.manager.showWhenStarting", false);
|
||||||
|
pref("browser.download.folderList", 1);
|
||||||
|
|
||||||
|
// Don't show add-on selection dialog
|
||||||
|
pref("extensions.shownSelectionUI", true);
|
||||||
|
pref("extensions.autoDisableScope", 11);
|
||||||
|
|
||||||
|
pref("network.protocol-handler.expose-all", false);
|
||||||
|
pref("network.protocol-handler.expose.zotero", true);
|
||||||
|
pref("network.protocol-handler.expose.http", true);
|
||||||
|
pref("network.protocol-handler.expose.https", true);
|
||||||
|
|
||||||
|
// Never go offline
|
||||||
|
pref("offline.autoDetect", false);
|
||||||
|
pref("network.manage-offline-status", false);
|
||||||
|
|
||||||
|
// Without this, we will throw up dialogs if asked to translate strange pages
|
||||||
|
pref("browser.xul.error_pages.enabled", true);
|
||||||
|
|
||||||
|
// Without this, scripts may decide to open popups
|
||||||
|
pref("dom.disable_open_during_load", true);
|
||||||
|
|
||||||
|
// Don't show security warning. The "warn_viewing_mixed" warning just lets the user know that some
|
||||||
|
// page elements were loaded over an insecure connection. This doesn't matter if all we're doing is
|
||||||
|
// scraping the page, since we don't provide any information to the site.
|
||||||
|
pref("security.warn_viewing_mixed", false);
|
||||||
|
|
||||||
|
// Preferences for add-on discovery
|
||||||
|
pref("extensions.getAddons.cache.enabled", false);
|
||||||
|
//pref("extensions.getAddons.maxResults", 15);
|
||||||
|
//pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/guid:%IDS%?src=thunderbird&appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%");
|
||||||
|
//pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/%APP%/search?q=%TERMS%");
|
||||||
|
//pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%?src=thunderbird");
|
||||||
|
//pref("extensions.webservice.discoverURL", "https://www.zotero.org/support/plugins");
|
||||||
|
|
||||||
|
// Check Windows certificate store for custom CAs
|
||||||
|
pref("security.enterprise_roots.enabled", true);
|
||||||
|
|
||||||
|
// Disable add-on signature checking with unbranded Firefox build
|
||||||
|
pref("xpinstall.signatures.required", false);
|
||||||
|
// Allow legacy extensions (though this might not be necessary)
|
||||||
|
pref("extensions.legacy.enabled", true);
|
||||||
|
// Allow installing XPIs from any host
|
||||||
|
pref("xpinstall.whitelist.required", false);
|
||||||
|
// Allow installing XPIs when using a custom CA
|
||||||
|
pref("extensions.install.requireBuiltInCerts", false);
|
||||||
|
pref("extensions.update.requireBuiltInCerts", false);
|
||||||
|
|
||||||
|
// Don't connect to the Mozilla extensions blocklist
|
||||||
|
pref("extensions.blocklist.enabled", false);
|
||||||
|
// Avoid warning in console when opening Tools -> Add-ons
|
||||||
|
pref("extensions.getAddons.link.url", "");
|
||||||
|
|
||||||
|
// Disable places
|
||||||
|
pref("places.history.enabled", false);
|
||||||
|
|
||||||
|
// Probably not used, but prevent an error in the console
|
||||||
|
pref("app.support.baseURL", "https://www.zotero.org/support/");
|
||||||
|
|
||||||
|
// Disable Telemetry, Health Report, error reporting, and remote settings
|
||||||
|
pref("toolkit.telemetry.unified", false);
|
||||||
|
pref("toolkit.telemetry.enabled", false);
|
||||||
|
pref("datareporting.policy.dataSubmissionEnabled", false);
|
||||||
|
pref("toolkit.crashreporter.enabled", false);
|
||||||
|
pref("extensions.remoteSettings.disabled", true);
|
||||||
|
|
||||||
|
pref("extensions.update.url", "");
|
||||||
|
|
||||||
|
// Don't try to load the "Get Add-ons" tab on first load of Add-ons window
|
||||||
|
pref("extensions.ui.lastCategory", "addons://list/extension");
|
||||||
|
|
||||||
|
// Don't show "Using experimental APIs requires a privileged add-on" warning
|
||||||
|
pref("extensions.experiments.enabled", true);
|
||||||
|
|
||||||
|
// Not set on Windows in Firefox anymore since it's a per-installation pref,
|
||||||
|
// but we override that in fetch_xulrunner
|
||||||
|
pref("app.update.auto", true);
|
||||||
|
|
||||||
|
// URL user can browse to manually if for some reason all update installation
|
||||||
|
// attempts fail.
|
||||||
|
pref("app.update.url.manual", "https://www.zotero.org/download");
|
||||||
|
|
||||||
|
// A default value for the "More information about this update" link
|
||||||
|
// supplied in the "An update is available" page of the update wizard.
|
||||||
|
pref("app.update.url.details", "https://www.zotero.org/support/changelog");
|
||||||
|
|
||||||
|
// Interval: Time between checks for a new version (in seconds)
|
||||||
|
// default=1 day
|
||||||
|
pref("app.update.interval", 86400);
|
||||||
|
|
||||||
|
// The minimum delay in seconds for the timer to fire.
|
||||||
|
// default=2 minutes
|
||||||
|
pref("app.update.timerMinimumDelay", 120);
|
||||||
|
|
||||||
|
// Whether or not we show a dialog box informing the user that the update was
|
||||||
|
// successfully applied. This is off in Firefox by default since we show a
|
||||||
|
// upgrade start page instead! Other apps may wish to show this UI, and supply
|
||||||
|
// a whatsNewURL field in their brand.properties that contains a link to a page
|
||||||
|
// which tells users what's new in this new update.
|
||||||
|
|
||||||
|
// update channel for this build
|
||||||
|
pref("app.update.channel", "default");
|
||||||
|
|
||||||
|
// This should probably not be a preference that's used in toolkit....
|
||||||
|
pref("browser.preferences.instantApply", false);
|
||||||
|
|
||||||
|
// Allow elements to be displayed full-screen
|
||||||
|
pref("full-screen-api.enabled", true);
|
||||||
|
|
||||||
|
// Allow chrome access in DevTools
|
||||||
|
// This enables the input field in the Browser Console tool
|
||||||
|
pref("devtools.chrome.enabled", true);
|
||||||
|
|
||||||
|
// Default mousewheel action with Alt/Option is History Back/Forward in Firefox
|
||||||
|
// We don't have History navigation and users want to scroll the tree with Option
|
||||||
|
// key held down
|
||||||
|
pref("mousewheel.with_alt.action", 1);
|
||||||
|
|
||||||
|
// Use the system print dialog instead of the new tab-based print dialog in Firefox
|
||||||
|
pref("print.prefer_system_dialog", true);
|
||||||
|
|
||||||
|
// Disable libvpx decoding/encoding
|
||||||
|
pref("media.webm.enabled", false);
|
||||||
|
pref("media.encoder.webm.enabled", false);
|
||||||
|
pref("media.mediasource.webm.enabled", false);
|
||||||
|
pref("media.mediasource.webm.audio.enabled", false);
|
||||||
|
pref("media.mediasource.vp9.enabled", false);
|
||||||
|
pref("media.ffvpx.enabled", false);
|
||||||
|
pref("media.ffvpx.mp3.enabled", false);
|
||||||
|
pref("media.rdd-vpx.enabled", false);
|
||||||
|
pref("media.rdd-ffvpx.enabled", false);
|
||||||
|
pref("media.utility-ffvpx.enabled", false);
|
188
app/assets/unix/skin/preferences/preferences.css
Normal file
188
app/assets/unix/skin/preferences/preferences.css
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
%if 0
|
||||||
|
/*
|
||||||
|
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
# the License. You may obtain a copy of the License at
|
||||||
|
# http://www.mozilla.org/MPL/
|
||||||
|
#
|
||||||
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
# for the specific language governing rights and limitations under the
|
||||||
|
# License.
|
||||||
|
#
|
||||||
|
# The Original Code is the Firefox Preferences System.
|
||||||
|
#
|
||||||
|
# The Initial Developer of the Original Code is
|
||||||
|
# Ben Goodger.
|
||||||
|
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||||
|
# the Initial Developer. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Contributor(s):
|
||||||
|
# Ben Goodger <ben@mozilla.org>
|
||||||
|
#
|
||||||
|
# Alternatively, the contents of this file may be used under the terms of
|
||||||
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
# of those above. If you wish to allow use of your version of this file only
|
||||||
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
# use your version of this file under the terms of the MPL, indicate your
|
||||||
|
# decision by deleting the provisions above and replace them with the notice
|
||||||
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
# the provisions above, a recipient may use your version of this file under
|
||||||
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
%endif
|
||||||
|
|
||||||
|
/* Global Styles */
|
||||||
|
#BrowserPreferences radio[pane] {
|
||||||
|
list-style-image: url("chrome://browser/skin/preferences/Options.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneMain] {
|
||||||
|
-moz-image-region: rect(0px, 32px, 32px, 0px)
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneTabs] {
|
||||||
|
-moz-image-region: rect(0px, 64px, 32px, 32px)
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneContent] {
|
||||||
|
-moz-image-region: rect(0px, 96px, 32px, 64px)
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneApplications] {
|
||||||
|
-moz-image-region: rect(0px, 128px, 32px, 96px)
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=panePrivacy] {
|
||||||
|
-moz-image-region: rect(0px, 160px, 32px, 128px)
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneSecurity] {
|
||||||
|
-moz-image-region: rect(0px, 192px, 32px, 160px)
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneAdvanced] {
|
||||||
|
-moz-image-region: rect(0px, 224px, 32px, 192px)
|
||||||
|
}
|
||||||
|
|
||||||
|
%ifdef MOZ_SERVICES_SYNC
|
||||||
|
radio[pane=paneSync] {
|
||||||
|
list-style-image: url("chrome://browser/skin/preferences/Options-sync.png") !important;
|
||||||
|
}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
/* Applications Pane */
|
||||||
|
#BrowserPreferences[animated="true"] #handlersView {
|
||||||
|
height: 25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#BrowserPreferences[animated="false"] #handlersView {
|
||||||
|
-moz-box-flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Privacy Pane */
|
||||||
|
|
||||||
|
/* styles for the link elements copied from .text-link in global.css */
|
||||||
|
.inline-link {
|
||||||
|
color: -moz-nativehyperlinktext;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-link:not(:focus) {
|
||||||
|
outline: 1px dotted transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modeless Window Dialogs */
|
||||||
|
.windowDialog,
|
||||||
|
.windowDialog prefpane {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentPane {
|
||||||
|
margin: 9px 8px 5px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actionButtons {
|
||||||
|
margin: 0px 3px 6px 3px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cookies Manager */
|
||||||
|
#cookiesChildren::-moz-tree-image(domainCol) {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
margin: 0px 2px;
|
||||||
|
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
#paneApplications {
|
||||||
|
margin-left: 4px;
|
||||||
|
margin-right: 4px;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#linksOpenInBox {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#paneAdvanced {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
#advancedPrefs {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#cookiesChildren::-moz-tree-image(domainCol, container) {
|
||||||
|
list-style-image: url("moz-icon://stock/gtk-directory?size=menu");
|
||||||
|
}
|
||||||
|
|
||||||
|
#cookieInfoBox {
|
||||||
|
border: 1px solid ThreeDShadow;
|
||||||
|
border-radius: 0px;
|
||||||
|
margin: 4px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bottom-most box containing a groupbox in a prefpane. Prevents the bottom
|
||||||
|
of the groupbox from being cutoff */
|
||||||
|
.bottomBox {
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear Private Data
|
||||||
|
*/
|
||||||
|
#SanitizeDialogPane > groupbox {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
%ifdef MOZ_SERVICES_SYNC
|
||||||
|
/* Sync Pane */
|
||||||
|
|
||||||
|
#syncDesc {
|
||||||
|
padding: 0 8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#accountCaptionImage {
|
||||||
|
list-style-image: url("chrome://mozapps/skin/profile/profileicon.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
#syncAddDeviceLabel {
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#syncEnginesList {
|
||||||
|
height: 10em;
|
||||||
|
}
|
||||||
|
|
||||||
|
%endif
|
4
app/assets/updater.ini
Normal file
4
app/assets/updater.ini
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
; This file is in the UTF-8 encoding
|
||||||
|
[Strings]
|
||||||
|
Title=Zotero Update
|
||||||
|
Info=Zotero is installing your updates and will start in a few moments…
|
178
app/assets/win/skin/preferences/preferences.css
Normal file
178
app/assets/win/skin/preferences/preferences.css
Normal file
|
@ -0,0 +1,178 @@
|
||||||
|
/*
|
||||||
|
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
# the License. You may obtain a copy of the License at
|
||||||
|
# http://www.mozilla.org/MPL/
|
||||||
|
#
|
||||||
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
# for the specific language governing rights and limitations under the
|
||||||
|
# License.
|
||||||
|
#
|
||||||
|
# The Original Code is the Firefox Preferences System.
|
||||||
|
#
|
||||||
|
# The Initial Developer of the Original Code is
|
||||||
|
# Ben Goodger.
|
||||||
|
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||||
|
# the Initial Developer. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Contributor(s):
|
||||||
|
# Ben Goodger <ben@mozilla.org>
|
||||||
|
#
|
||||||
|
# Alternatively, the contents of this file may be used under the terms of
|
||||||
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
# of those above. If you wish to allow use of your version of this file only
|
||||||
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
# use your version of this file under the terms of the MPL, indicate your
|
||||||
|
# decision by deleting the provisions above and replace them with the notice
|
||||||
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
# the provisions above, a recipient may use your version of this file under
|
||||||
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Global Styles */
|
||||||
|
#BrowserPreferences radio[pane] {
|
||||||
|
list-style-image: url("chrome://browser/skin/preferences/Options.png");
|
||||||
|
padding: 5px 3px 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneMain] {
|
||||||
|
-moz-image-region: rect(0, 32px, 32px, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneTabs] {
|
||||||
|
-moz-image-region: rect(0, 64px, 32px, 32px);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneContent] {
|
||||||
|
-moz-image-region: rect(0, 96px, 32px, 64px);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneApplications] {
|
||||||
|
-moz-image-region: rect(0, 128px, 32px, 96px);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=panePrivacy] {
|
||||||
|
-moz-image-region: rect(0, 160px, 32px, 128px);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneSecurity] {
|
||||||
|
-moz-image-region: rect(0, 192px, 32px, 160px);
|
||||||
|
}
|
||||||
|
|
||||||
|
radio[pane=paneAdvanced] {
|
||||||
|
-moz-image-region: rect(0, 224px, 32px, 192px);
|
||||||
|
}
|
||||||
|
|
||||||
|
%ifdef MOZ_SERVICES_SYNC
|
||||||
|
radio[pane=paneSync] {
|
||||||
|
list-style-image: url("chrome://browser/skin/preferences/Options-sync.png") !important;
|
||||||
|
}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
/* Applications Pane */
|
||||||
|
#BrowserPreferences[animated="true"] #handlersView {
|
||||||
|
height: 25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#BrowserPreferences[animated="false"] #handlersView {
|
||||||
|
-moz-box-flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Privacy Pane */
|
||||||
|
|
||||||
|
/* styles for the link elements copied from .text-link in global.css */
|
||||||
|
.inline-link {
|
||||||
|
color: -moz-nativehyperlinktext;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-link:not(:focus) {
|
||||||
|
outline: 1px dotted transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modeless Window Dialogs */
|
||||||
|
.windowDialog,
|
||||||
|
.windowDialog prefpane {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentPane {
|
||||||
|
margin: 9px 8px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actionButtons {
|
||||||
|
margin: 0 3px 6px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cookies Manager */
|
||||||
|
#cookiesChildren::-moz-tree-image(domainCol) {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
margin: 0 2px;
|
||||||
|
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png") !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#cookiesChildren::-moz-tree-image(domainCol, container) {
|
||||||
|
list-style-image: url("chrome://global/skin/icons/folder-item.png") !important;
|
||||||
|
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
#cookiesChildren::-moz-tree-image(domainCol, container, open) {
|
||||||
|
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
#cookieInfoBox {
|
||||||
|
border: 1px solid ThreeDShadow;
|
||||||
|
border-radius: 0;
|
||||||
|
margin: 4px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Advanced Pane */
|
||||||
|
|
||||||
|
/* Adding padding-bottom prevents the bottom of the tabpanel from being cutoff
|
||||||
|
when browser.preferences.animateFadeIn = true */
|
||||||
|
#advancedPrefs {
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* bottom-most box containing a groupbox in a prefpane. Prevents the bottom
|
||||||
|
of the groupbox from being cutoff */
|
||||||
|
.bottomBox {
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
%ifdef MOZ_SERVICES_SYNC
|
||||||
|
/* Sync Pane */
|
||||||
|
|
||||||
|
#syncDesc {
|
||||||
|
padding: 0 8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.syncGroupBox {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#accountCaptionImage {
|
||||||
|
list-style-image: url("chrome://mozapps/skin/profile/profileicon.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
#syncAddDeviceLabel {
|
||||||
|
margin-top: 1em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#syncEnginesList {
|
||||||
|
height: 11em;
|
||||||
|
}
|
||||||
|
|
||||||
|
%endif
|
929
app/build.sh
Executable file
929
app/build.sh
Executable file
|
@ -0,0 +1,929 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# Copyright (c) 2011 Zotero
|
||||||
|
# Center for History and New Media
|
||||||
|
# George Mason University, Fairfax, Virginia, USA
|
||||||
|
# http://zotero.org
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
CALLDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
. "$CALLDIR/config.sh"
|
||||||
|
|
||||||
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
|
MAC_NATIVE=1
|
||||||
|
else
|
||||||
|
MAC_NATIVE=0
|
||||||
|
fi
|
||||||
|
if [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
WIN_NATIVE=1
|
||||||
|
else
|
||||||
|
WIN_NATIVE=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat >&2 <<DONE
|
||||||
|
Usage: $0 [-d DIR] [-f FILE] -p PLATFORMS [-c CHANNEL] [-d]
|
||||||
|
Options
|
||||||
|
-d DIR build directory to build from (from build_xpi; cannot be used with -f)
|
||||||
|
-f FILE ZIP file to build from (cannot be used with -d)
|
||||||
|
-t add devtools
|
||||||
|
-p PLATFORMS build for platforms PLATFORMS (m=Mac, w=Windows, l=Linux)
|
||||||
|
-c CHANNEL use update channel CHANNEL
|
||||||
|
-e enforce signing
|
||||||
|
-s don't package; only build binaries in staging/ directory
|
||||||
|
-q quick build (skip compression and other optional steps for faster restarts during development)
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
BUILD_DIR=`mktemp -d`
|
||||||
|
function cleanup {
|
||||||
|
rm -rf $BUILD_DIR
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
function replace_line {
|
||||||
|
pattern=$1
|
||||||
|
replacement=$2
|
||||||
|
file=$3
|
||||||
|
|
||||||
|
if egrep -q "$pattern" "$file"; then
|
||||||
|
perl -pi -e "s/$pattern/$replacement/" "$file"
|
||||||
|
else
|
||||||
|
echo "$pattern" not found in "$file" -- aborting 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function abspath {
|
||||||
|
echo $(cd $(dirname $1); pwd)/$(basename $1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_lfs_file {
|
||||||
|
if [ "$(head --bytes 5 "$1")" = "versi" ]; then
|
||||||
|
echo "$1 not checked out -- install Git LFS and run 'git lfs pull'" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
SOURCE_DIR=""
|
||||||
|
ZIP_FILE=""
|
||||||
|
BUILD_MAC=0
|
||||||
|
BUILD_WIN=0
|
||||||
|
BUILD_LINUX=0
|
||||||
|
PACKAGE=1
|
||||||
|
DEVTOOLS=0
|
||||||
|
quick_build=0
|
||||||
|
while getopts "d:f:p:c:tseq" opt; do
|
||||||
|
case $opt in
|
||||||
|
d)
|
||||||
|
SOURCE_DIR="$OPTARG"
|
||||||
|
;;
|
||||||
|
f)
|
||||||
|
ZIP_FILE="$OPTARG"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
for i in `seq 0 1 $((${#OPTARG}-1))`
|
||||||
|
do
|
||||||
|
case ${OPTARG:i:1} in
|
||||||
|
m) BUILD_MAC=1;;
|
||||||
|
w) BUILD_WIN=1;;
|
||||||
|
l) BUILD_LINUX=1;;
|
||||||
|
*)
|
||||||
|
echo "$0: Invalid platform option ${OPTARG:i:1}"
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
UPDATE_CHANNEL="$OPTARG"
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
DEVTOOLS=1
|
||||||
|
;;
|
||||||
|
e)
|
||||||
|
SIGN=1
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
PACKAGE=0
|
||||||
|
;;
|
||||||
|
q)
|
||||||
|
quick_build=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift $((OPTIND-1)); OPTIND=1
|
||||||
|
done
|
||||||
|
|
||||||
|
function check_xulrunner_hash {
|
||||||
|
platform=$1
|
||||||
|
|
||||||
|
if [ $platform == "m" ]; then
|
||||||
|
platform_hash_file="hash-mac"
|
||||||
|
elif [ $platform == "w" ]; then
|
||||||
|
platform_hash_file="hash-win"
|
||||||
|
elif [ $platform == "l" ]; then
|
||||||
|
platform_hash_file="hash-linux"
|
||||||
|
else
|
||||||
|
echo "Platform parameter incorrect. Acceptable values: m/w/l"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "$CALLDIR/xulrunner/$platform_hash_file" ]; then
|
||||||
|
echo "xulrunner not found -- downloading"
|
||||||
|
echo
|
||||||
|
$CALLDIR/scripts/fetch_xulrunner -p $platform
|
||||||
|
else
|
||||||
|
recalculated_xulrunner_hash=$("$CALLDIR/scripts/xulrunner_hash" -p $platform)
|
||||||
|
current_xulrunner_hash=$(< "$CALLDIR/xulrunner/$platform_hash_file")
|
||||||
|
if [ "$current_xulrunner_hash" != "$recalculated_xulrunner_hash" ]; then
|
||||||
|
echo "xulrunner hashes don't match -- redownloading"
|
||||||
|
echo
|
||||||
|
"$CALLDIR/scripts/fetch_xulrunner" -p $platform
|
||||||
|
current_xulrunner_hash=$(< "$CALLDIR/xulrunner/$platform_hash_file")
|
||||||
|
if [ "$current_xulrunner_hash" != "$recalculated_xulrunner_hash" ]; then
|
||||||
|
echo "xulrunner hashes don't match after running fetch_xulrunner!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#Check if xulrunner and GECKO_VERSION for each platform match
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
check_xulrunner_hash m
|
||||||
|
fi
|
||||||
|
if [ $BUILD_WIN == 1 ]; then
|
||||||
|
check_xulrunner_hash w
|
||||||
|
fi
|
||||||
|
if [ $BUILD_LINUX == 1 ]; then
|
||||||
|
check_xulrunner_hash l
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Require source dir or ZIP file
|
||||||
|
if [[ -z "$SOURCE_DIR" ]] && [[ -z "$ZIP_FILE" ]]; then
|
||||||
|
usage
|
||||||
|
elif [[ -n "$SOURCE_DIR" ]] && [[ -n "$ZIP_FILE" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Require at least one platform
|
||||||
|
if [[ $BUILD_MAC == 0 ]] && [[ $BUILD_WIN == 0 ]] && [[ $BUILD_LINUX == 0 ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${ZOTERO_TEST:-}" ]] || [[ $ZOTERO_TEST == "0" ]]; then
|
||||||
|
include_tests=0
|
||||||
|
else
|
||||||
|
include_tests=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Bundle devtools with dev builds
|
||||||
|
if [ "$UPDATE_CHANNEL" == "beta" ] || [ "$UPDATE_CHANNEL" == "dev" ] || [ "$UPDATE_CHANNEL" == "test" ]; then
|
||||||
|
DEVTOOLS=1
|
||||||
|
fi
|
||||||
|
if [ -z "$UPDATE_CHANNEL" ]; then UPDATE_CHANNEL="default"; fi
|
||||||
|
BUILD_ID=`date +%Y%m%d%H%M%S`
|
||||||
|
|
||||||
|
# Paths to Gecko runtimes
|
||||||
|
MAC_RUNTIME_PATH="$CALLDIR/xulrunner/Firefox.app"
|
||||||
|
WIN_RUNTIME_PATH_PREFIX="$CALLDIR/xulrunner/firefox-"
|
||||||
|
LINUX_RUNTIME_PATH_PREFIX="$CALLDIR/xulrunner/firefox-"
|
||||||
|
|
||||||
|
base_dir="$BUILD_DIR/base"
|
||||||
|
app_dir="$BUILD_DIR/base/app"
|
||||||
|
omni_dir="$BUILD_DIR/base/app/omni"
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
mkdir -p "$app_dir"
|
||||||
|
rm -rf "$STAGE_DIR"
|
||||||
|
mkdir "$STAGE_DIR"
|
||||||
|
rm -rf "$DIST_DIR"
|
||||||
|
mkdir "$DIST_DIR"
|
||||||
|
|
||||||
|
# Save build id, which is needed for updates manifest
|
||||||
|
echo $BUILD_ID > "$DIST_DIR/build_id"
|
||||||
|
|
||||||
|
cd "$app_dir"
|
||||||
|
|
||||||
|
# Copy 'browser' files from Firefox
|
||||||
|
#
|
||||||
|
# omni.ja is left uncompressed within the Firefox application files by fetch_xulrunner
|
||||||
|
#
|
||||||
|
# TEMP: Also extract .hyf hyphenation files from the outer (still compressed) omni.ja
|
||||||
|
# This works around https://bugzilla.mozilla.org/show_bug.cgi?id=1772900
|
||||||
|
set +e
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
cp -Rp "$MAC_RUNTIME_PATH"/Contents/Resources/browser/omni "$app_dir"
|
||||||
|
unzip -qj "$MAC_RUNTIME_PATH"/Contents/Resources/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/
|
||||||
|
elif [ $BUILD_WIN == 1 ]; then
|
||||||
|
# Non-arch-specific files, so just use 64-bit version
|
||||||
|
cp -Rp "${WIN_RUNTIME_PATH_PREFIX}win-x64"/browser/omni "$app_dir"
|
||||||
|
unzip -qj "${WIN_RUNTIME_PATH_PREFIX}win-x64"/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/
|
||||||
|
elif [ $BUILD_LINUX == 1 ]; then
|
||||||
|
# Non-arch-specific files, so just use 64-bit version
|
||||||
|
cp -Rp "${LINUX_RUNTIME_PATH_PREFIX}x86_64"/browser/omni "$app_dir"
|
||||||
|
unzip -qj "${LINUX_RUNTIME_PATH_PREFIX}x86_64"/omni.ja "hyphenation/*" -d "$app_dir"/hyphenation/
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
cd $omni_dir
|
||||||
|
# Move some Firefox files that would be overwritten out of the way
|
||||||
|
mv chrome.manifest chrome.manifest-fx
|
||||||
|
mv defaults defaults-fx
|
||||||
|
|
||||||
|
# Extract Zotero files
|
||||||
|
if [ -n "$ZIP_FILE" ]; then
|
||||||
|
ZIP_FILE="`abspath $ZIP_FILE`"
|
||||||
|
echo "Building from $ZIP_FILE"
|
||||||
|
unzip -q $ZIP_FILE -d "$omni_dir"
|
||||||
|
else
|
||||||
|
rsync_params=""
|
||||||
|
if [ $include_tests -eq 0 ]; then
|
||||||
|
rsync_params="--exclude /test"
|
||||||
|
fi
|
||||||
|
rsync -a $rsync_params "$SOURCE_DIR/" ./
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv defaults defaults-z
|
||||||
|
mv defaults-fx defaults
|
||||||
|
prefs_file=defaults/preferences/zotero.js
|
||||||
|
|
||||||
|
# Transfer Firefox prefs, omitting some with undesirable overrides from the base prefs
|
||||||
|
#
|
||||||
|
# - network.captive-portal-service.enabled
|
||||||
|
# Disable the captive portal check against Mozilla servers
|
||||||
|
# - extensions.systemAddon.update.url
|
||||||
|
egrep -v '(network.captive-portal-service.enabled|extensions.systemAddon.update.url)' defaults/preferences/firefox.js > $prefs_file
|
||||||
|
rm defaults/preferences/firefox.js
|
||||||
|
|
||||||
|
# Combine app and "extension" Zotero prefs
|
||||||
|
echo "" >> $prefs_file
|
||||||
|
echo "#" >> $prefs_file
|
||||||
|
echo "# Zotero app prefs" >> $prefs_file
|
||||||
|
echo "#" >> $prefs_file
|
||||||
|
echo "" >> $prefs_file
|
||||||
|
cat "$CALLDIR/assets/prefs.js" >> $prefs_file
|
||||||
|
echo "" >> $prefs_file
|
||||||
|
echo "# Zotero extension prefs" >> $prefs_file
|
||||||
|
echo "" >> $prefs_file
|
||||||
|
cat defaults-z/preferences/zotero.js >> $prefs_file
|
||||||
|
|
||||||
|
rm -rf defaults-z
|
||||||
|
|
||||||
|
# Platform-specific prefs
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
perl -pi -e 's/pref\("browser\.preferences\.instantApply", false\);/pref\("browser\.preferences\.instantApply", true);/' $prefs_file
|
||||||
|
perl -pi -e 's/%GECKO_VERSION%/'"$GECKO_VERSION_MAC"'/g' $prefs_file
|
||||||
|
# Fix horizontal mousewheel scrolling (this is set to 4 in the Fx60 .app greprefs.js, but
|
||||||
|
# defaults to 1 in later versions of Firefox, and needs to be 1 to work on macOS)
|
||||||
|
echo 'pref("mousewheel.with_shift.action", 1);' >> $prefs_file
|
||||||
|
elif [ $BUILD_WIN == 1 ]; then
|
||||||
|
perl -pi -e 's/%GECKO_VERSION%/'"$GECKO_VERSION_WIN"'/g' $prefs_file
|
||||||
|
elif [ $BUILD_LINUX == 1 ]; then
|
||||||
|
# Modify platform-specific prefs
|
||||||
|
perl -pi -e 's/pref\("browser\.preferences\.instantApply", false\);/pref\("browser\.preferences\.instantApply", true);/' $prefs_file
|
||||||
|
perl -pi -e 's/%GECKO_VERSION%/'"$GECKO_VERSION_LINUX"'/g' $prefs_file
|
||||||
|
# Auto-scroll is disabled by default on Linux
|
||||||
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1747208
|
||||||
|
perl -pi -e 's/pref\("general\.autoScroll", false\);/pref\("general.autoScroll", true);/' $prefs_file
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clear list of built-in add-ons
|
||||||
|
echo '{"dictionaries": {"en-US": "dictionaries/en-US.dic"}, "system": []}' > chrome/browser/content/browser/built_in_addons.json
|
||||||
|
|
||||||
|
# chrome.manifest
|
||||||
|
mv chrome.manifest zotero.manifest
|
||||||
|
mv chrome.manifest-fx chrome.manifest
|
||||||
|
# TEMP
|
||||||
|
#echo "manifest zotero.manifest" >> "$base_dir/chrome.manifest"
|
||||||
|
cat zotero.manifest >> chrome.manifest
|
||||||
|
rm zotero.manifest
|
||||||
|
|
||||||
|
# Update channel
|
||||||
|
perl -pi -e 's/pref\("app\.update\.channel", "[^"]*"\);/pref\("app\.update\.channel", "'"$UPDATE_CHANNEL"'");/' $prefs_file
|
||||||
|
echo -n "Channel: "
|
||||||
|
grep app.update.channel $prefs_file
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Add devtools prefs
|
||||||
|
if [ $DEVTOOLS -eq 1 ]; then
|
||||||
|
echo >> $prefs_file
|
||||||
|
echo "// Dev Tools" >> $prefs_file
|
||||||
|
echo 'pref("devtools.debugger.remote-enabled", true);' >> $prefs_file
|
||||||
|
if [ $UPDATE_CHANNEL != "beta" ]; then
|
||||||
|
echo 'pref("devtools.debugger.prompt-connection", false);' >> $prefs_file
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use 'zotero' instead of 'zotero-bin' when passing -jsdebugger flag on Linux, since we need
|
||||||
|
# that to pass application.ini
|
||||||
|
replace_line 'let command = Services.dirsvc.get\("XREExeF", Ci.nsIFile\).path;' \
|
||||||
|
'let command = Services.dirsvc.get("XREExeF", Ci.nsIFile).path; command = command.replace("zotero-bin", "zotero");' \
|
||||||
|
chrome/devtools/modules/devtools/client/framework/browser-toolbox/Launcher.sys.mjs
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 5.0.96.3 / 5.0.97-beta.37+ddc7be75c
|
||||||
|
VERSION=`cat version`
|
||||||
|
# 5.0.96 / 5.0.97
|
||||||
|
VERSION_NUMERIC=`perl -ne 'print and last if s/^(\d+\.\d+(\.\d+)?).*/\1/;' version`
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Version number not found in version file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm version
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Version: $VERSION"
|
||||||
|
|
||||||
|
# Delete Mozilla signing info if present
|
||||||
|
rm -rf META-INF
|
||||||
|
|
||||||
|
# Copy branding
|
||||||
|
cp -R "$CALLDIR"/assets/branding/locale/brand.{dtd,properties} chrome/en-US/locale/branding/
|
||||||
|
|
||||||
|
# Copy browser localization .ftl files
|
||||||
|
for locale in `ls chrome/locale/`; do
|
||||||
|
mkdir -p localization/$locale/branding
|
||||||
|
cp "$CALLDIR/assets/branding/locale/brand.ftl" localization/$locale/branding/brand.ftl
|
||||||
|
|
||||||
|
mkdir -p localization/$locale/toolkit/global
|
||||||
|
cp chrome/locale/$locale/zotero/mozilla/textActions.ftl localization/$locale/toolkit/global
|
||||||
|
cp chrome/locale/$locale/zotero/mozilla/wizard.ftl localization/$locale/toolkit/global
|
||||||
|
|
||||||
|
mkdir -p localization/$locale/browser
|
||||||
|
cp chrome/locale/$locale/zotero/mozilla/browserSets.ftl localization/$locale/browser
|
||||||
|
cp chrome/locale/$locale/zotero/mozilla/menubar.ftl localization/$locale/browser
|
||||||
|
|
||||||
|
mkdir -p localization/$locale/devtools/client
|
||||||
|
cp chrome/locale/$locale/zotero/mozilla/toolbox.ftl localization/$locale/devtools/client
|
||||||
|
|
||||||
|
# TEMP: Until we've created zotero.ftl in all locales
|
||||||
|
touch chrome/locale/$locale/zotero/zotero.ftl
|
||||||
|
cp chrome/locale/$locale/zotero/*.ftl localization/$locale/
|
||||||
|
done
|
||||||
|
|
||||||
|
# Add to chrome manifest
|
||||||
|
echo "" >> chrome.manifest
|
||||||
|
cat "$CALLDIR/assets/chrome.manifest" >> chrome.manifest
|
||||||
|
|
||||||
|
replace_line 'handle: function bch_handle\(cmdLine\) {' 'handle: function bch_handle(cmdLine) {
|
||||||
|
\/\/ TEST_OPTIONS_PLACEHOLDER
|
||||||
|
' modules/BrowserContentHandler.sys.mjs
|
||||||
|
export CALLDIR && perl -pi -e 'BEGIN { local $/; open $fh, "$ENV{CALLDIR}/assets/commandLineHandler.js"; $replacement = <$fh>; close $fh; } s/\/\/ TEST_OPTIONS_PLACEHOLDER/$replacement/' modules/BrowserContentHandler.sys.mjs
|
||||||
|
|
||||||
|
# Move test files to root directory
|
||||||
|
if [ $include_tests -eq 1 ]; then
|
||||||
|
cat test/chrome.manifest >> chrome.manifest
|
||||||
|
rm test/chrome.manifest
|
||||||
|
cp -R test/tests "$base_dir/tests"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy platform-specific assets
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
rsync -a "$CALLDIR/assets/mac/" ./
|
||||||
|
elif [ $BUILD_WIN == 1 ]; then
|
||||||
|
rsync -a "$CALLDIR/assets/win/" ./
|
||||||
|
elif [ $BUILD_LINUX == 1 ]; then
|
||||||
|
rsync -a "$CALLDIR/assets/unix/" ./
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add word processor plug-ins
|
||||||
|
echo >> chrome.manifest
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
pluginDir="$CALLDIR/modules/zotero-word-for-mac-integration"
|
||||||
|
mkdir -p "integration/word-for-mac"
|
||||||
|
cp -RH "$pluginDir/components" \
|
||||||
|
"$pluginDir/resource" \
|
||||||
|
"$pluginDir/chrome.manifest" \
|
||||||
|
"integration/word-for-mac"
|
||||||
|
echo -n "Word for Mac plugin version: "
|
||||||
|
cat "integration/word-for-mac/resource/version.txt"
|
||||||
|
echo
|
||||||
|
echo >> $prefs_file
|
||||||
|
cat "$CALLDIR/modules/zotero-word-for-mac-integration/defaults/preferences/zoteroMacWordIntegration.js" >> $prefs_file
|
||||||
|
echo >> $prefs_file
|
||||||
|
|
||||||
|
echo "manifest integration/word-for-mac/chrome.manifest" >> chrome.manifest
|
||||||
|
|
||||||
|
elif [ $BUILD_WIN == 1 ]; then
|
||||||
|
pluginDir="$CALLDIR/modules/zotero-word-for-windows-integration"
|
||||||
|
mkdir -p "integration/word-for-windows"
|
||||||
|
cp -RH "$pluginDir/components" \
|
||||||
|
"$pluginDir/resource" \
|
||||||
|
"$pluginDir/chrome.manifest" \
|
||||||
|
"integration/word-for-windows"
|
||||||
|
echo -n "Word for Windows plugin version: "
|
||||||
|
cat "integration/word-for-windows/resource/version.txt"
|
||||||
|
echo
|
||||||
|
echo >> $prefs_file
|
||||||
|
cat "$CALLDIR/modules/zotero-word-for-windows-integration/defaults/preferences/zoteroWinWordIntegration.js" >> $prefs_file
|
||||||
|
echo >> $prefs_file
|
||||||
|
|
||||||
|
echo "manifest integration/word-for-windows/chrome.manifest" >> chrome.manifest
|
||||||
|
fi
|
||||||
|
# Libreoffice plugin for all platforms
|
||||||
|
pluginDir="$CALLDIR/modules/zotero-libreoffice-integration"
|
||||||
|
mkdir -p "integration/libreoffice"
|
||||||
|
cp -RH "$pluginDir/chrome" \
|
||||||
|
"$pluginDir/components" \
|
||||||
|
"$pluginDir/resource" \
|
||||||
|
"$pluginDir/chrome.manifest" \
|
||||||
|
"integration/libreoffice"
|
||||||
|
echo -n "LibreOffice plugin version: "
|
||||||
|
cat "integration/libreoffice/resource/version.txt"
|
||||||
|
echo
|
||||||
|
echo >> $prefs_file
|
||||||
|
cat "$CALLDIR/modules/zotero-libreoffice-integration/defaults/preferences/zoteroLibreOfficeIntegration.js" >> $prefs_file
|
||||||
|
echo >> $prefs_file
|
||||||
|
|
||||||
|
echo "manifest integration/libreoffice/chrome.manifest" >> chrome.manifest
|
||||||
|
|
||||||
|
# Delete files that shouldn't be distributed
|
||||||
|
find chrome -name .DS_Store -exec rm -f {} \;
|
||||||
|
|
||||||
|
# Zip browser and Zotero files into omni.ja
|
||||||
|
if [ $quick_build -eq 1 ]; then
|
||||||
|
# If quick build, don't compress or optimize
|
||||||
|
zip -qrXD omni.ja *
|
||||||
|
else
|
||||||
|
zip -qr9XD omni.ja *
|
||||||
|
python3 "$CALLDIR/scripts/optimizejars.py" --optimize ./ ./ ./
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv omni.ja ..
|
||||||
|
cd "$CALLDIR"
|
||||||
|
rm -rf "$omni_dir"
|
||||||
|
|
||||||
|
# Copy updater.ini
|
||||||
|
cp "$CALLDIR/assets/updater.ini" "$base_dir"
|
||||||
|
|
||||||
|
# Adjust chrome.manifest
|
||||||
|
#perl -pi -e 's^(chrome|resource)/^jar:zotero.jar\!/$1/^g' "$BUILD_DIR/zotero/chrome.manifest"
|
||||||
|
|
||||||
|
# Copy application.ini and modify
|
||||||
|
cp "$CALLDIR/assets/application.ini" "$app_dir/application.ini"
|
||||||
|
perl -pi -e "s/\{\{VERSION}}/$VERSION/" "$app_dir/application.ini"
|
||||||
|
perl -pi -e "s/\{\{BUILDID}}/$BUILD_ID/" "$app_dir/application.ini"
|
||||||
|
|
||||||
|
# Remove unnecessary files
|
||||||
|
find "$BUILD_DIR" -name .DS_Store -exec rm -f {} \;
|
||||||
|
|
||||||
|
# Mac
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
echo 'Building Zotero.app'
|
||||||
|
|
||||||
|
# Set up directory structure
|
||||||
|
APPDIR="$STAGE_DIR/Zotero.app"
|
||||||
|
rm -rf "$APPDIR"
|
||||||
|
mkdir "$APPDIR"
|
||||||
|
chmod 755 "$APPDIR"
|
||||||
|
cp -r "$CALLDIR/mac/Contents" "$APPDIR"
|
||||||
|
CONTENTSDIR="$APPDIR/Contents"
|
||||||
|
|
||||||
|
# Merge relevant assets from Firefox
|
||||||
|
mkdir "$CONTENTSDIR/MacOS"
|
||||||
|
cp -r "$MAC_RUNTIME_PATH/Contents/MacOS/"!(firefox|firefox-bin|crashreporter.app|pingsender|updater.app) "$CONTENTSDIR/MacOS"
|
||||||
|
cp -r "$MAC_RUNTIME_PATH/Contents/Resources/"!(application.ini|browser|defaults|precomplete|removed-files|updater.ini|update-settings.ini|webapprt*|*.icns|*.lproj) "$CONTENTSDIR/Resources"
|
||||||
|
|
||||||
|
# Use our own launcher
|
||||||
|
check_lfs_file "$CALLDIR/mac/zotero.xz"
|
||||||
|
xz -d --stdout "$CALLDIR/mac/zotero.xz" > "$CONTENTSDIR/MacOS/zotero"
|
||||||
|
chmod 755 "$CONTENTSDIR/MacOS/zotero"
|
||||||
|
|
||||||
|
# TEMP: Custom version of XUL with some backported Mozilla bug fixes
|
||||||
|
cp "$MAC_RUNTIME_PATH/../MacOS/XUL" "$CONTENTSDIR/MacOS/"
|
||||||
|
|
||||||
|
# Use our own updater, because Mozilla's requires updates signed by Mozilla
|
||||||
|
cd "$CONTENTSDIR/MacOS"
|
||||||
|
check_lfs_file "$CALLDIR/mac/updater.tar.xz"
|
||||||
|
tar xf "$CALLDIR/mac/updater.tar.xz"
|
||||||
|
|
||||||
|
# Modify Info.plist
|
||||||
|
perl -pi -e "s/\{\{VERSION\}\}/$VERSION/" "$CONTENTSDIR/Info.plist"
|
||||||
|
perl -pi -e "s/\{\{VERSION_NUMERIC\}\}/$VERSION_NUMERIC/" "$CONTENTSDIR/Info.plist"
|
||||||
|
if [ $UPDATE_CHANNEL == "beta" ] || [ $UPDATE_CHANNEL == "dev" ] || [ $UPDATE_CHANNEL == "source" ]; then
|
||||||
|
perl -pi -e "s/org\.zotero\.zotero/org.zotero.zotero-$UPDATE_CHANNEL/" "$CONTENTSDIR/Info.plist"
|
||||||
|
fi
|
||||||
|
perl -pi -e "s/\{\{VERSION\}\}/$VERSION/" "$CONTENTSDIR/Info.plist"
|
||||||
|
# Needed for "monkeypatch" Windows builds:
|
||||||
|
# http://www.nntp.perl.org/group/perl.perl5.porters/2010/08/msg162834.html
|
||||||
|
rm -f "$CONTENTSDIR/Info.plist.bak"
|
||||||
|
|
||||||
|
echo
|
||||||
|
grep -B 1 org.zotero.zotero "$CONTENTSDIR/Info.plist"
|
||||||
|
echo
|
||||||
|
grep -A 1 CFBundleShortVersionString "$CONTENTSDIR/Info.plist"
|
||||||
|
echo
|
||||||
|
grep -A 1 CFBundleVersion "$CONTENTSDIR/Info.plist"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Copy app files
|
||||||
|
rsync -a "$base_dir/" "$CONTENTSDIR/Resources/"
|
||||||
|
|
||||||
|
# Add word processor plug-ins
|
||||||
|
mkdir "$CONTENTSDIR/Resources/integration"
|
||||||
|
cp -RH "$CALLDIR/modules/zotero-libreoffice-integration/install" "$CONTENTSDIR/Resources/integration/libreoffice"
|
||||||
|
cp -RH "$CALLDIR/modules/zotero-word-for-mac-integration/install" "$CONTENTSDIR/Resources/integration/word-for-mac"
|
||||||
|
|
||||||
|
# Delete extraneous files
|
||||||
|
find "$CONTENTSDIR" -depth -type d -name .git -exec rm -rf {} \;
|
||||||
|
find "$CONTENTSDIR" \( -name .DS_Store -or -name update.rdf \) -exec rm -f {} \;
|
||||||
|
|
||||||
|
# Add Safari App Extension -- this depends on signing but needs to be done before generating
|
||||||
|
# the precomplete file
|
||||||
|
if [[ $SIGN == 1 ]] && [[ -n "$SAFARI_APPEX" ]] && [[ -d "$SAFARI_APPEX" ]]; then
|
||||||
|
mkdir "$APPDIR/Contents/PlugIns"
|
||||||
|
cp -R $SAFARI_APPEX "$APPDIR/Contents/PlugIns/ZoteroSafariExtension.appex"
|
||||||
|
rm -rf "$APPDIR/Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Resources/safari/test/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy over removed-files and make a precomplete file
|
||||||
|
pushd "$CONTENTSDIR/Resources/"
|
||||||
|
cp "$CALLDIR/update-packaging/removed-files_mac" removed-files
|
||||||
|
python3 "$CALLDIR/scripts/createprecomplete.py"
|
||||||
|
if [ ! -s precomplete ]; then
|
||||||
|
echo "precomplete file not created -- aborting" 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Sign
|
||||||
|
if [ $SIGN == 1 ]; then
|
||||||
|
# Unlock keychain if a password is provided (necessary for building from a shell)
|
||||||
|
if [ -n "$KEYCHAIN_PASSWORD" ]; then
|
||||||
|
security -v unlock-keychain -p "$KEYCHAIN_PASSWORD" ~/Library/Keychains/$KEYCHAIN.keychain-db
|
||||||
|
fi
|
||||||
|
# Clear extended attributes, which can cause codesign to fail
|
||||||
|
/usr/bin/xattr -cr "$APPDIR"
|
||||||
|
|
||||||
|
# Sign app
|
||||||
|
entitlements_file="$CALLDIR/mac/entitlements.xml"
|
||||||
|
/usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" \
|
||||||
|
"$APPDIR/Contents/MacOS/XUL" \
|
||||||
|
"$APPDIR/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater"
|
||||||
|
find "$APPDIR/Contents" -name '*.dylib' -exec /usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" {} \;
|
||||||
|
find "$APPDIR/Contents" -name '*.app' -exec /usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" {} \;
|
||||||
|
/usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" "$APPDIR/Contents/MacOS/zotero"
|
||||||
|
|
||||||
|
# Sign .jnilib (Java native shared library) within LibreOffice extension, since notarization
|
||||||
|
# started failing without this. The .jnilib is within a .jar within the .oxt, so we have to
|
||||||
|
# extract both, sign the library, and then update each ZIP.
|
||||||
|
pushd "$BUILD_DIR"
|
||||||
|
mkdir libreoffice-repack
|
||||||
|
cd libreoffice-repack
|
||||||
|
unzip -q "$APPDIR/Contents/Resources/integration/libreoffice/Zotero_LibreOffice_Integration.oxt" external_jars/jna.jar
|
||||||
|
unzip -q external_jars/jna.jar com/sun/jna/darwin/libjnidispatch.jnilib
|
||||||
|
/usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" com/sun/jna/darwin/libjnidispatch.jnilib
|
||||||
|
zip -u external_jars/jna.jar com/sun/jna/darwin/libjnidispatch.jnilib
|
||||||
|
zip -u "$APPDIR/Contents/Resources/integration/libreoffice/Zotero_LibreOffice_Integration.oxt" external_jars/jna.jar
|
||||||
|
cd ..
|
||||||
|
rm -rf libreoffice-repack
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Sign Safari App Extension
|
||||||
|
#
|
||||||
|
# Even though it's signed by Xcode, we sign it again to make sure it matches the parent app signature
|
||||||
|
if [ -d "$APPDIR/Contents/PlugIns/ZoteroSafariExtension.appex" ]; then
|
||||||
|
echo
|
||||||
|
# Extract entitlements, which differ from parent app
|
||||||
|
/usr/bin/codesign -d --entitlements "$BUILD_DIR/safari-entitlements.plist" --xml "$SAFARI_APPEX"
|
||||||
|
|
||||||
|
# Add suffix to appex bundle identifier
|
||||||
|
if [ $UPDATE_CHANNEL == "beta" ] || [ $UPDATE_CHANNEL == "dev" ] || [ $UPDATE_CHANNEL == "source" ]; then
|
||||||
|
perl -pi -e "s/org\.zotero\.SafariExtensionApp\.SafariExtension/org.zotero.SafariExtensionApp.SafariExtension-$UPDATE_CHANNEL/" "$APPDIR/Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Info.plist"
|
||||||
|
fi
|
||||||
|
find "$APPDIR/Contents/PlugIns/ZoteroSafariExtension.appex/Contents" -name '*.dylib' -exec /usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" {} \;
|
||||||
|
/usr/bin/codesign --force --options runtime --entitlements "$BUILD_DIR/safari-entitlements.plist" --sign "$DEVELOPER_ID" "$APPDIR/Contents/PlugIns/ZoteroSafariExtension.appex"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sign final app package
|
||||||
|
echo
|
||||||
|
/usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" "$APPDIR"
|
||||||
|
|
||||||
|
# Verify app
|
||||||
|
/usr/bin/codesign --verify -vvvv "$APPDIR"
|
||||||
|
# Verify Safari App Extension
|
||||||
|
if [[ -n "$SAFARI_APPEX" ]] && [[ -d "$SAFARI_APPEX" ]]; then
|
||||||
|
echo
|
||||||
|
/usr/bin/codesign --verify -vvvv "$APPDIR/Contents/PlugIns/ZoteroSafariExtension.appex"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build and notarize disk image
|
||||||
|
if [ $PACKAGE == 1 ]; then
|
||||||
|
if [ $MAC_NATIVE == 1 ]; then
|
||||||
|
echo "Creating Mac installer"
|
||||||
|
dmg="$DIST_DIR/Zotero-$VERSION.dmg"
|
||||||
|
"$CALLDIR/mac/pkg-dmg" --source "$STAGE_DIR/Zotero.app" \
|
||||||
|
--target "$dmg" \
|
||||||
|
--sourcefile --volname Zotero --copy "$CALLDIR/mac/DSStore:/.DS_Store" \
|
||||||
|
--symlink /Applications:"/Drag Here to Install" > /dev/null
|
||||||
|
|
||||||
|
if [ "$UPDATE_CHANNEL" != "test" ]; then
|
||||||
|
# Upload disk image to Apple
|
||||||
|
"$CALLDIR/scripts/notarize_mac_app" "$dmg"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Staple notarization info to disk image
|
||||||
|
"$CALLDIR/scripts/notarization_stapler" "$dmg"
|
||||||
|
|
||||||
|
echo "Notarization complete"
|
||||||
|
else
|
||||||
|
echo "Test build -- skipping notarization"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo 'Not building on Mac; creating Mac distribution as a zip file'
|
||||||
|
rm -f "$DIST_DIR/Zotero_mac.zip"
|
||||||
|
cd "$STAGE_DIR" && zip -rqX "$DIST_DIR/Zotero-${VERSION}_mac.zip" Zotero.app
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
if [ $BUILD_WIN == 1 ]; then
|
||||||
|
echo "Building Windows common"
|
||||||
|
|
||||||
|
COMMON_APPDIR="$STAGE_DIR/Zotero_common"
|
||||||
|
mkdir "$COMMON_APPDIR"
|
||||||
|
|
||||||
|
# Package non-arch-specific components
|
||||||
|
if [ $PACKAGE -eq 1 ]; then
|
||||||
|
# Copy installer files
|
||||||
|
cp -r "$CALLDIR/win/installer" "$BUILD_DIR/win_installer"
|
||||||
|
|
||||||
|
perl -pi -e "s/\{\{VERSION}}/$VERSION/" "$BUILD_DIR/win_installer/defines.nsi"
|
||||||
|
mkdir "$COMMON_APPDIR/uninstall"
|
||||||
|
|
||||||
|
# Compress 7zSD.sfx
|
||||||
|
upx --best -o "`cygpath -w \"$BUILD_DIR/7zSD.sfx\"`" \
|
||||||
|
"`cygpath -w \"$CALLDIR/win/installer/7zstub/firefox/7zSD.sfx\"`" > /dev/null
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
for arch in win32 win-x64 win-arm64; do
|
||||||
|
echo "Building Zotero_$arch"
|
||||||
|
|
||||||
|
runtime_path="${WIN_RUNTIME_PATH_PREFIX}${arch}"
|
||||||
|
|
||||||
|
# Set up directory
|
||||||
|
APPDIR="$STAGE_DIR/Zotero_$arch"
|
||||||
|
mkdir "$APPDIR"
|
||||||
|
|
||||||
|
# Copy relevant assets from Firefox
|
||||||
|
#
|
||||||
|
# 'i686' is a huge directory containing x86 versions of xul.dll and other files in
|
||||||
|
# Firefox ARM64 builds for use with the EME DRM plugins
|
||||||
|
cp -R "$runtime_path"/!(application.ini|browser|crashreporter*|default-browser-agent.exe|defaultagent*|defaults|devtools-files|firefox*|i686|maintenanceservice*|minidump-analyzer.exe|pingsender.exe|private_browsing*|precomplete|removed-files|uninstall|update*) "$APPDIR"
|
||||||
|
|
||||||
|
# Copy zotero.exe, which is built directly from Firefox source and then modified by
|
||||||
|
# ResourceHacker to add icons
|
||||||
|
check_lfs_file "$CALLDIR/win/zotero.exe.tar.xz"
|
||||||
|
tar xf "$CALLDIR/win/zotero.exe.tar.xz" --to-stdout zotero_$arch.exe > "$APPDIR/zotero.exe"
|
||||||
|
|
||||||
|
# Use our own updater, because Mozilla's requires updates signed by Mozilla
|
||||||
|
check_lfs_file "$CALLDIR/win/updater.exe.tar.xz"
|
||||||
|
tar xf "$CALLDIR/win/updater.exe.tar.xz" --to-stdout updater-$arch.exe > "$APPDIR/updater.exe"
|
||||||
|
|
||||||
|
# Update .exe version numbers (only possible on Windows)
|
||||||
|
if [ $WIN_NATIVE == 1 ]; then
|
||||||
|
# FileVersion is limited to four integers, so it won't be properly updated for non-release
|
||||||
|
# builds (e.g., we'll show 5.0.97.0 for 5.0.97-beta.37). ProductVersion will be the full
|
||||||
|
# version string.
|
||||||
|
rcedit "`cygpath -w \"$APPDIR/zotero.exe\"`" \
|
||||||
|
--set-file-version "$VERSION_NUMERIC" \
|
||||||
|
--set-product-version "$VERSION"
|
||||||
|
rcedit "`cygpath -w \"$APPDIR/updater.exe\"`" \
|
||||||
|
--set-file-version "$VERSION_NUMERIC" \
|
||||||
|
--set-product-version "$VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sign updater
|
||||||
|
if [ $SIGN -eq 1 ]; then
|
||||||
|
"$CALLDIR/win/codesign" "$APPDIR/updater.exe" "$SIGNATURE_DESC Updater"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy app files
|
||||||
|
rsync -a "$base_dir/" "$APPDIR/"
|
||||||
|
#mv "$APPDIR/app/application.ini" "$APPDIR/"
|
||||||
|
|
||||||
|
# Copy in common files
|
||||||
|
rsync -a "$COMMON_APPDIR/" "$APPDIR/"
|
||||||
|
|
||||||
|
cat "$CALLDIR/win/installer/updater_append.ini" >> "$APPDIR/updater.ini"
|
||||||
|
|
||||||
|
# Add devtools
|
||||||
|
#if [ $DEVTOOLS -eq 1 ]; then
|
||||||
|
# # Create devtools.jar
|
||||||
|
# cd "$BUILD_DIR"
|
||||||
|
# mkdir -p devtools/locale
|
||||||
|
# cp -r "$runtime_path"/devtools-files/chrome/devtools/* devtools/
|
||||||
|
# cp -r "$runtime_path"/devtools-files/chrome/locale/* devtools/locale/
|
||||||
|
# cd devtools
|
||||||
|
# zip -r -q ../devtools.jar *
|
||||||
|
# cd ..
|
||||||
|
# rm -rf devtools
|
||||||
|
# mv devtools.jar "$APPDIR"
|
||||||
|
#
|
||||||
|
# cp "$runtime_path/devtools-files/components/interfaces.xpt" "$APPDIR/components/"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Add word processor plug-ins
|
||||||
|
mkdir -p "$APPDIR/integration"
|
||||||
|
cp -RH "$CALLDIR/modules/zotero-libreoffice-integration/install" "$APPDIR/integration/libreoffice"
|
||||||
|
cp -RH "$CALLDIR/modules/zotero-word-for-windows-integration/install" "$APPDIR/integration/word-for-windows"
|
||||||
|
if [ $arch = 'win32' ]; then
|
||||||
|
rm "$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration_x64.dll"
|
||||||
|
rm "$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration_ARM64.dll"
|
||||||
|
elif [ $arch = 'win-x64' ]; then
|
||||||
|
mv "$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration_x64.dll" \
|
||||||
|
"$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration.dll"
|
||||||
|
rm "$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration_ARM64.dll"
|
||||||
|
elif [ $arch = 'win-arm64' ]; then
|
||||||
|
mv "$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration_ARM64.dll" \
|
||||||
|
"$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration.dll"
|
||||||
|
rm "$APPDIR/integration/word-for-windows/libzoteroWinWordIntegration_x64.dll"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Delete extraneous files
|
||||||
|
find "$APPDIR" -depth -type d -name .git -exec rm -rf {} \;
|
||||||
|
find "$APPDIR" \( -name .DS_Store -or -name '.git*' -or -name '.travis.yml' -or -name update.rdf -or -name '*.bak' \) -exec rm -f {} \;
|
||||||
|
find "$APPDIR" \( -name '*.exe' -or -name '*.dll' \) -exec chmod 755 {} \;
|
||||||
|
|
||||||
|
# Copy over removed-files and make a precomplete file
|
||||||
|
pushd "$APPDIR"
|
||||||
|
cp "$CALLDIR/update-packaging/removed-files_$arch" removed-files
|
||||||
|
python3 "$CALLDIR/scripts/createprecomplete.py"
|
||||||
|
if [ ! -s precomplete ]; then
|
||||||
|
echo "precomplete file not created -- aborting" 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
|
||||||
|
if [ $PACKAGE -eq 1 ]; then
|
||||||
|
if [ $WIN_NATIVE -eq 1 ]; then
|
||||||
|
echo "Creating Windows installer"
|
||||||
|
# Build uninstaller
|
||||||
|
if [ "$arch" = "win32" ]; then
|
||||||
|
"`cygpath -u \"${NSIS_DIR}makensis.exe\"`" /V1 "`cygpath -w \"$BUILD_DIR/win_installer/uninstaller.nsi\"`"
|
||||||
|
elif [ "$arch" = "win-x64" ]; then
|
||||||
|
"`cygpath -u \"${NSIS_DIR}makensis.exe\"`" /DHAVE_64BIT_BUILD /V1 "`cygpath -w \"$BUILD_DIR/win_installer/uninstaller.nsi\"`"
|
||||||
|
elif [ "$arch" = "win-arm64" ]; then
|
||||||
|
"`cygpath -u \"${NSIS_DIR}makensis.exe\"`" /DHAVE_64BIT_BUILD /D_ARM64_ /V1 "`cygpath -w \"$BUILD_DIR/win_installer/uninstaller.nsi\"`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv "$BUILD_DIR/win_installer/helper.exe" "$APPDIR/uninstall"
|
||||||
|
|
||||||
|
if [ $SIGN -eq 1 ]; then
|
||||||
|
"$CALLDIR/win/codesign" "$APPDIR/uninstall/helper.exe" "$SIGNATURE_DESC Uninstaller"
|
||||||
|
sleep $SIGNTOOL_DELAY
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$arch" = "win32" ]; then
|
||||||
|
INSTALLER_PATH="$DIST_DIR/Zotero-${VERSION}_win32_setup.exe"
|
||||||
|
elif [ "$arch" = "win-x64" ]; then
|
||||||
|
INSTALLER_PATH="$DIST_DIR/Zotero-${VERSION}_x64_setup.exe"
|
||||||
|
elif [ "$arch" = "win-arm64" ]; then
|
||||||
|
INSTALLER_PATH="$DIST_DIR/Zotero-${VERSION}_arm64_setup.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $SIGN -eq 1 ]; then
|
||||||
|
"$CALLDIR/win/codesign" "$APPDIR/zotero.exe" "$SIGNATURE_DESC"
|
||||||
|
sleep $SIGNTOOL_DELAY
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stage installer
|
||||||
|
INSTALLER_STAGE_DIR="$BUILD_DIR/win_installer/staging"
|
||||||
|
rm -rf "$INSTALLER_STAGE_DIR"
|
||||||
|
mkdir "$INSTALLER_STAGE_DIR"
|
||||||
|
cp -r "$APPDIR" "$INSTALLER_STAGE_DIR/core"
|
||||||
|
|
||||||
|
# Build and sign setup.exe
|
||||||
|
if [ "$arch" = "win32" ]; then
|
||||||
|
"`cygpath -u \"${NSIS_DIR}makensis.exe\"`" /V1 "`cygpath -w \"$BUILD_DIR/win_installer/installer.nsi\"`"
|
||||||
|
elif [ "$arch" = "win-x64" ]; then
|
||||||
|
"`cygpath -u \"${NSIS_DIR}makensis.exe\"`" /DHAVE_64BIT_BUILD /V1 "`cygpath -w \"$BUILD_DIR/win_installer/installer.nsi\"`"
|
||||||
|
elif [ "$arch" = "win-arm64" ]; then
|
||||||
|
"`cygpath -u \"${NSIS_DIR}makensis.exe\"`" /DHAVE_64BIT_BUILD /D_ARM64_ /V1 "`cygpath -w \"$BUILD_DIR/win_installer/installer.nsi\"`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv "$BUILD_DIR/win_installer/setup.exe" "$INSTALLER_STAGE_DIR"
|
||||||
|
|
||||||
|
if [ $SIGN == 1 ]; then
|
||||||
|
"$CALLDIR/win/codesign" "$INSTALLER_STAGE_DIR/setup.exe" "$SIGNATURE_DESC Setup"
|
||||||
|
sleep $SIGNTOOL_DELAY
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compress application
|
||||||
|
cd "$INSTALLER_STAGE_DIR" && 7z a -r -t7z "`cygpath -w \"$BUILD_DIR/app_$arch.7z\"`" \
|
||||||
|
-mx -m0=BCJ2 -m1=LZMA:d24 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3 > /dev/null
|
||||||
|
|
||||||
|
# Combine 7zSD.sfx and app.tag into setup.exe
|
||||||
|
cat "$BUILD_DIR/7zSD.sfx" "$CALLDIR/win/installer/app.tag" \
|
||||||
|
"$BUILD_DIR/app_$arch.7z" > "$INSTALLER_PATH"
|
||||||
|
|
||||||
|
# Sign installer .exe
|
||||||
|
if [ $SIGN == 1 ]; then
|
||||||
|
"$CALLDIR/win/codesign" "$INSTALLER_PATH" "$SIGNATURE_DESC Installer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 755 "$INSTALLER_PATH"
|
||||||
|
else
|
||||||
|
echo 'Not building on Windows; only building zip file'
|
||||||
|
fi
|
||||||
|
cd "$STAGE_DIR"
|
||||||
|
zip -rqX "$DIST_DIR/Zotero-${VERSION}_$arch.zip" Zotero_$arch
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -rf "$COMMON_APPDIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
if [ $BUILD_LINUX == 1 ]; then
|
||||||
|
# Skip 32-bit build in tests
|
||||||
|
if [[ "${ZOTERO_TEST:-}" = "1" ]] || [[ "${SKIP_32:-}" = "1" ]]; then
|
||||||
|
archs="x86_64"
|
||||||
|
else
|
||||||
|
archs="i686 x86_64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for arch in $archs; do
|
||||||
|
runtime_path="${LINUX_RUNTIME_PATH_PREFIX}${arch}"
|
||||||
|
|
||||||
|
# Set up directory
|
||||||
|
echo 'Building Zotero_linux-'$arch
|
||||||
|
APPDIR="$STAGE_DIR/Zotero_linux-$arch"
|
||||||
|
rm -rf "$APPDIR"
|
||||||
|
mkdir "$APPDIR"
|
||||||
|
|
||||||
|
# Merge relevant assets from Firefox
|
||||||
|
cp -r "$runtime_path/"!(application.ini|browser|defaults|devtools-files|crashreporter|crashreporter.ini|firefox|pingsender|precomplete|removed-files|run-mozilla.sh|update-settings.ini|updater|updater.ini) "$APPDIR"
|
||||||
|
|
||||||
|
# Use our own launcher that calls the original Firefox executable with -app
|
||||||
|
mv "$APPDIR"/firefox-bin "$APPDIR"/zotero-bin
|
||||||
|
cp "$CALLDIR/linux/zotero" "$APPDIR"/zotero
|
||||||
|
|
||||||
|
# Copy Ubuntu launcher files
|
||||||
|
cp "$CALLDIR/linux/zotero.desktop" "$APPDIR"
|
||||||
|
cp "$CALLDIR/linux/set_launcher_icon" "$APPDIR"
|
||||||
|
|
||||||
|
# Use our own updater, because Mozilla's requires updates signed by Mozilla
|
||||||
|
check_lfs_file "$CALLDIR/linux/updater.tar.xz"
|
||||||
|
tar xf "$CALLDIR/linux/updater.tar.xz" --to-stdout updater-$arch > "$APPDIR/updater"
|
||||||
|
chmod 755 "$APPDIR/updater"
|
||||||
|
|
||||||
|
# Copy app files
|
||||||
|
rsync -a "$base_dir/" "$APPDIR/"
|
||||||
|
|
||||||
|
# Add word processor plug-ins
|
||||||
|
mkdir "$APPDIR/integration"
|
||||||
|
cp -RH "$CALLDIR/modules/zotero-libreoffice-integration/install" "$APPDIR/integration/libreoffice"
|
||||||
|
|
||||||
|
# Copy icons
|
||||||
|
cp "$CALLDIR/linux/icons/icon32.png" "$APPDIR/icons/"
|
||||||
|
cp "$CALLDIR/linux/icons/icon64.png" "$APPDIR/icons/"
|
||||||
|
cp "$CALLDIR/linux/icons/icon128.png" "$APPDIR/icons/"
|
||||||
|
cp "$CALLDIR/linux/icons/symbolic.svg" "$APPDIR/icons/"
|
||||||
|
|
||||||
|
# Delete extraneous files
|
||||||
|
find "$APPDIR" -depth -type d -name .git -exec rm -rf {} \;
|
||||||
|
find "$APPDIR" \( -name .DS_Store -or -name update.rdf \) -exec rm -f {} \;
|
||||||
|
|
||||||
|
# Copy over removed-files and make a precomplete file
|
||||||
|
pushd "$APPDIR"
|
||||||
|
cp "$CALLDIR/update-packaging/removed-files_linux-$arch" removed-files
|
||||||
|
python3 "$CALLDIR/scripts/createprecomplete.py"
|
||||||
|
if [ ! -s precomplete ]; then
|
||||||
|
echo "precomplete file not created -- aborting" 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
|
||||||
|
if [ $PACKAGE == 1 ]; then
|
||||||
|
# Create tar
|
||||||
|
rm -f "$DIST_DIR/Zotero-${VERSION}_linux-$arch.tar.bz2"
|
||||||
|
cd "$STAGE_DIR"
|
||||||
|
tar -cjf "$DIST_DIR/Zotero-${VERSION}_linux-$arch.tar.bz2" "Zotero_linux-$arch"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf $BUILD_DIR
|
68
app/config.sh
Normal file
68
app/config.sh
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
# Version of Gecko to build with
|
||||||
|
GECKO_VERSION_MAC="115.9.1esr"
|
||||||
|
GECKO_VERSION_LINUX="115.14.0esr"
|
||||||
|
GECKO_VERSION_WIN="115.14.0esr"
|
||||||
|
RUST_VERSION=1.69.0
|
||||||
|
|
||||||
|
# URL prefix for custom builds of Firefox components
|
||||||
|
custom_components_url="https://download.zotero.org/dev/firefox-components/"
|
||||||
|
custom_components_hash_mac="bec8e3adebf8d5021f1f35fd2c65d752d4979839cbdd1ee1aa4b1d3d5ba0953b"
|
||||||
|
|
||||||
|
APP_NAME="Zotero"
|
||||||
|
APP_ID="zotero\@zotero.org"
|
||||||
|
|
||||||
|
# Whether to sign builds
|
||||||
|
SIGN=0
|
||||||
|
|
||||||
|
# OS X Developer ID certificate information
|
||||||
|
DEVELOPER_ID=F0F1FE48DB909B263AC51C8215374D87FDC12121
|
||||||
|
# Keychain and keychain password, if not building via the GUI
|
||||||
|
KEYCHAIN=""
|
||||||
|
KEYCHAIN_PASSWORD=""
|
||||||
|
NOTARIZATION_BUNDLE_ID=""
|
||||||
|
NOTARIZATION_USER=""
|
||||||
|
NOTARIZATION_TEAM_ID=""
|
||||||
|
NOTARIZATION_PASSWORD=""
|
||||||
|
|
||||||
|
# Paths for Windows installer build
|
||||||
|
NSIS_DIR='C:\Program Files (x86)\NSIS\'
|
||||||
|
|
||||||
|
SIGNTOOL_DELAY=5
|
||||||
|
|
||||||
|
# Directory for unpacked binaries
|
||||||
|
STAGE_DIR="$DIR/staging"
|
||||||
|
# Directory for packed binaries
|
||||||
|
DIST_DIR="$DIR/dist"
|
||||||
|
|
||||||
|
SOURCE_REPO_URL="https://github.com/zotero/zotero"
|
||||||
|
S3_BUCKET="zotero-download"
|
||||||
|
S3_CI_ZIP_PATH="ci/client"
|
||||||
|
S3_DIST_PATH="client"
|
||||||
|
|
||||||
|
DEPLOY_HOST="deploy.zotero"
|
||||||
|
DEPLOY_PATH="www/www-production/public/download/client/manifests"
|
||||||
|
DEPLOY_CMD="ssh $DEPLOY_HOST update-site-files"
|
||||||
|
|
||||||
|
BUILD_PLATFORMS=""
|
||||||
|
NUM_INCREMENTALS=6
|
||||||
|
|
||||||
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
|
shopt -s expand_aliases
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
export WIN_NATIVE=1
|
||||||
|
else
|
||||||
|
export WIN_NATIVE=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make utilities (mar/mbsdiff) available in the path
|
||||||
|
PATH="$DIR/xulrunner/bin:$PATH"
|
||||||
|
|
||||||
|
if [ -f "$DIR/config-custom.sh" ]; then
|
||||||
|
. "$DIR/config-custom.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset DIR
|
BIN
app/linux/icons/icon128.png
Normal file
BIN
app/linux/icons/icon128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8 KiB |
BIN
app/linux/icons/icon32.png
Normal file
BIN
app/linux/icons/icon32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
app/linux/icons/icon64.png
Normal file
BIN
app/linux/icons/icon64.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
3
app/linux/icons/symbolic.svg
Normal file
3
app/linux/icons/symbolic.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||||
|
<polygon style="fill: #000000" points="13.863 2.73 13.027 1 2.137 1 2.137 3.8 2.137 3.921 8.822 3.921 1.289 13.233 2.137 15 13.863 15 13.863 12.142 13.863 12.021 6.448 12.021 13.863 2.73"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 283 B |
27
app/linux/mozconfig
Normal file
27
app/linux/mozconfig
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Uncomment to build 32-bit
|
||||||
|
#ac_add_options --target=i686
|
||||||
|
|
||||||
|
ac_add_options --enable-bootstrap
|
||||||
|
|
||||||
|
mk_add_options AUTOCLOBBER=1
|
||||||
|
|
||||||
|
# These don't all affect the stub, but they can't hurt, and we'll want them if
|
||||||
|
# we switch to custom XUL builds
|
||||||
|
ac_add_options MOZ_ENABLE_JS_DUMP=1
|
||||||
|
ac_add_options MOZ_ENABLE_FORKSERVER=
|
||||||
|
ac_add_options MOZ_TELEMETRY_REPORTING=
|
||||||
|
ac_add_options MOZ_DATA_REPORTING=
|
||||||
|
ac_add_options --disable-tests
|
||||||
|
ac_add_options --disable-debug
|
||||||
|
ac_add_options --disable-debug-symbols
|
||||||
|
ac_add_options --disable-webrtc
|
||||||
|
ac_add_options --disable-eme
|
||||||
|
|
||||||
|
export MOZILLA_OFFICIAL=1
|
||||||
|
export RELEASE_OR_BETA=1
|
||||||
|
MOZ_REQUIRE_SIGNING=
|
||||||
|
|
||||||
|
ac_add_options --enable-official-branding
|
||||||
|
|
||||||
|
# Build updater without MAR signature verification
|
||||||
|
ac_add_options --disable-verify-mar
|
13
app/linux/set_launcher_icon
Executable file
13
app/linux/set_launcher_icon
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run this to update the launcher file with the current path to the application icon
|
||||||
|
#
|
||||||
|
|
||||||
|
APPDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
if [ -w "$APPDIR"/zotero.desktop ]; then
|
||||||
|
sed -i -e "s@^Icon=.*@Icon=$APPDIR/icons/icon128.png@" "$APPDIR"/zotero.desktop
|
||||||
|
else
|
||||||
|
echo "$APPDIR"/zotero.desktop is not writable
|
||||||
|
exit 1
|
||||||
|
fi
|
BIN
app/linux/updater.tar.xz
(Stored with Git LFS)
Normal file
BIN
app/linux/updater.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
20
app/linux/zotero
Executable file
20
app/linux/zotero
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Increase open files limit
|
||||||
|
#
|
||||||
|
# Mozilla file functions (OS.File.move()/copy(), NetUtil.asyncFetch/asyncCopy()) can leave file
|
||||||
|
# descriptors open for a few seconds (even with an explicit inputStream.close() in the case of
|
||||||
|
# the latter), so a source installation that copies ~500 translators and styles (with fds for
|
||||||
|
# source and target) can exceed the default 1024 limit.
|
||||||
|
# Current hard-limit on Ubuntu 16.10 is 4096
|
||||||
|
ulimit -n 4096
|
||||||
|
|
||||||
|
# Allow profile downgrade for Zotero
|
||||||
|
export MOZ_ALLOW_DOWNGRADE=1
|
||||||
|
# Don't create dedicated profile (default-esr)
|
||||||
|
export MOZ_LEGACY_PROFILES=1
|
||||||
|
# Use wayland backend when available
|
||||||
|
export MOZ_ENABLE_WAYLAND=1
|
||||||
|
|
||||||
|
CALLDIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
"$CALLDIR/zotero-bin" -app "$CALLDIR/app/application.ini" "$@"
|
9
app/linux/zotero.desktop
Executable file
9
app/linux/zotero.desktop
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Zotero
|
||||||
|
Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\\/\\///')))/zotero -url %U"
|
||||||
|
Icon=zotero.ico
|
||||||
|
Type=Application
|
||||||
|
Terminal=false
|
||||||
|
Categories=Office;
|
||||||
|
MimeType=text/plain;x-scheme-handler/zotero;application/x-research-info-systems;text/x-research-info-systems;text/ris;application/x-endnote-refer;application/x-inst-for-Scientific-info;application/mods+xml;application/rdf+xml;application/x-bibtex;text/x-bibtex;application/marc;application/vnd.citationstyles.style+xml
|
||||||
|
X-GNOME-SingleWindow=true
|
204
app/mac/Contents/Info.plist
Normal file
204
app/mac/Contents/Info.plist
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<!-- Import formats -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>ris</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/x-research-info-systems</string>
|
||||||
|
<string>text/x-research-info-systems</string>
|
||||||
|
<string>text/ris</string>
|
||||||
|
<string>ris</string>
|
||||||
|
<string>application/x-endnote-refer</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Research Information Systems Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>ciw</string>
|
||||||
|
<string>isi</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/x-inst-for-Scientific-info</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>ISI Common Export Format Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>mods</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/mods+xml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Metadata Object Description Schema Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>rdf</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/rdf+xml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Resource Description Framework Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>bib</string>
|
||||||
|
<string>bibtex</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/x-bibtex</string>
|
||||||
|
<string>text/x-bibtex</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>BibTeX Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>mrc</string>
|
||||||
|
<string>marc</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/marc</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>MARC Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
|
||||||
|
<!-- Citation styles -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>csl</string>
|
||||||
|
<string>csl.txt</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/vnd.citationstyles.style+xml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>CSL Citation Style</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
|
||||||
|
<!-- Hopefully, we don't become the default app for these -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>xml</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>XML Document</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>txt</string>
|
||||||
|
</array>
|
||||||
|
<!--<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Text File</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>zotero</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>Zotero {{VERSION}}, © 2006-2018 Contributors</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>zotero</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.zotero.zotero</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Zotero</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>{{VERSION_NUMERIC}}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>ZOTR</string>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<!--<key>CFBundleURLIconFile</key>
|
||||||
|
<string>document.icns</string>-->
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>zotero URL</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>zotero</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>{{VERSION_NUMERIC}}</string>
|
||||||
|
<key>NSAppleScriptEnabled</key>
|
||||||
|
<true/>
|
||||||
|
<key>CGDisableCoalescedUpdates</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.9.0</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
1
app/mac/Contents/PkgInfo
Normal file
1
app/mac/Contents/PkgInfo
Normal file
|
@ -0,0 +1 @@
|
||||||
|
APPLZOTR
|
BIN
app/mac/Contents/Resources/zotero.icns
Normal file
BIN
app/mac/Contents/Resources/zotero.icns
Normal file
Binary file not shown.
BIN
app/mac/DSStore
Normal file
BIN
app/mac/DSStore
Normal file
Binary file not shown.
66
app/mac/build-and-unify
Executable file
66
app/mac/build-and-unify
Executable file
|
@ -0,0 +1,66 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
fx_app_name=Firefox.app
|
||||||
|
|
||||||
|
# Get Mozilla source directory from command line
|
||||||
|
if [ -z "${1:-}" ]; then
|
||||||
|
echo "Usage: $0 /path/to/mozilla-unified" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
GECKO_PATH=$1
|
||||||
|
mach=$GECKO_PATH/mach
|
||||||
|
|
||||||
|
BUILD_DIR=`mktemp -d`
|
||||||
|
function cleanup {
|
||||||
|
rm -rf $BUILD_DIR
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
export MOZ_BUILD_DATE=`date "+%Y%m%d%H%M%S"`
|
||||||
|
|
||||||
|
# Install required Rust version
|
||||||
|
rustup toolchain install $RUST_VERSION
|
||||||
|
rustup target add aarch64-apple-darwin
|
||||||
|
rustup target add x86_64-apple-darwin
|
||||||
|
rustup default $RUST_VERSION
|
||||||
|
|
||||||
|
cp "$SCRIPT_DIR/mozconfig" "$GECKO_PATH"
|
||||||
|
|
||||||
|
# Build Firefox for Intel and Apple Silicon
|
||||||
|
export Z_ARCH=x64
|
||||||
|
$mach build
|
||||||
|
$mach package
|
||||||
|
export Z_ARCH=aarch64
|
||||||
|
$mach build
|
||||||
|
$mach package
|
||||||
|
|
||||||
|
cd $BUILD_DIR
|
||||||
|
|
||||||
|
# Unify into Universal build
|
||||||
|
# From https://searchfox.org/mozilla-central/rev/97c902e8f92b15dc63eb584bfc594ecb041242a4/taskcluster/scripts/misc/unify.sh
|
||||||
|
for i in x86_64 aarch64; do
|
||||||
|
$mach python -m mozbuild.action.unpack_dmg "$GECKO_PATH"/obj-$i-apple-darwin/dist/*.dmg $i
|
||||||
|
done
|
||||||
|
mv x86_64 x64
|
||||||
|
|
||||||
|
$mach python "$GECKO_PATH/toolkit/mozapps/installer/unify.py" x64/*.app aarch64/*.app
|
||||||
|
|
||||||
|
cp x64/$fx_app_name/Contents/MacOS/firefox zotero
|
||||||
|
xz zotero
|
||||||
|
mv zotero.xz "$APP_ROOT_DIR/mac/zotero.xz"
|
||||||
|
|
||||||
|
# TEMP: Copy a unified XUL for now
|
||||||
|
cp x64/$fx_app_name/Contents/MacOS/XUL "$APP_ROOT_DIR/mac/XUL"
|
||||||
|
|
||||||
|
# Uncomment to build updater
|
||||||
|
#cd x64/$fx_app_name/Contents/MacOS/
|
||||||
|
#"$APP_ROOT_DIR/mac/updater_renamer"
|
||||||
|
#cat updater.app/Contents/Resources/English.lproj/InfoPlist.strings
|
||||||
|
#tar cfvJ "$APP_ROOT_DIR/mac/updater.tar.xz" updater.app/
|
34
app/mac/entitlements.xml
Normal file
34
app/mac/entitlements.xml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<!--
|
||||||
|
Entitlements to apply during codesigning of production builds.
|
||||||
|
-->
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<!-- Firefox needs to create executable pages (without MAP_JIT) -->
|
||||||
|
<key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
|
||||||
|
|
||||||
|
<!-- Allow loading third party libraries. Needed for Flash and CDMs -->
|
||||||
|
<!-- Disabled for Zotero -->
|
||||||
|
<key>com.apple.security.cs.disable-library-validation</key><false/>
|
||||||
|
|
||||||
|
<!-- Firefox needs to access the microphone on sites the user allows -->
|
||||||
|
<!-- Disabled for Zotero -->
|
||||||
|
<key>com.apple.security.device.audio-input</key><false/>
|
||||||
|
|
||||||
|
<!-- Firefox needs to access the camera on sites the user allows -->
|
||||||
|
<!-- Disabled for Zotero -->
|
||||||
|
<key>com.apple.security.device.camera</key><false/>
|
||||||
|
|
||||||
|
<!-- Firefox needs to access the location on sites the user allows -->
|
||||||
|
<!-- Disabled for Zotero -->
|
||||||
|
<key>com.apple.security.personal-information.location</key><false/>
|
||||||
|
|
||||||
|
<!-- For SmartCardServices(7) -->
|
||||||
|
<!-- Disabled for Zotero -->
|
||||||
|
<key>com.apple.security.smartcard</key><false/>
|
||||||
|
|
||||||
|
<!-- Added for Zotero to control Word and bring windows to the front -->
|
||||||
|
<key>com.apple.security.automation.apple-events</key><true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
30
app/mac/mozconfig
Normal file
30
app/mac/mozconfig
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
if [ "$Z_ARCH" == "x64" ]; then
|
||||||
|
ac_add_options --target=x86_64-apple-darwin
|
||||||
|
elif [ "$Z_ARCH" == "aarch64" ]; then
|
||||||
|
ac_add_options --target=aarch64-apple-darwin
|
||||||
|
fi
|
||||||
|
ac_add_options --enable-bootstrap
|
||||||
|
ac_add_options --with-macos-sdk=$HOME/tmp/MacOSX13.3.sdk
|
||||||
|
|
||||||
|
mk_add_options AUTOCLOBBER=1
|
||||||
|
|
||||||
|
# These don't all affect the stub, but they can't hurt, and we'll want them if
|
||||||
|
# we switch to custom XUL builds
|
||||||
|
ac_add_options MOZ_ENABLE_JS_DUMP=1
|
||||||
|
ac_add_options MOZ_ENABLE_FORKSERVER=
|
||||||
|
ac_add_options MOZ_TELEMETRY_REPORTING=
|
||||||
|
ac_add_options MOZ_DATA_REPORTING=
|
||||||
|
ac_add_options --disable-tests
|
||||||
|
ac_add_options --disable-debug
|
||||||
|
ac_add_options --disable-debug-symbols
|
||||||
|
ac_add_options --disable-webrtc
|
||||||
|
ac_add_options --disable-eme
|
||||||
|
|
||||||
|
export MOZILLA_OFFICIAL=1
|
||||||
|
export RELEASE_OR_BETA=1
|
||||||
|
MOZ_REQUIRE_SIGNING=
|
||||||
|
|
||||||
|
ac_add_options --enable-official-branding
|
||||||
|
|
||||||
|
# Build updater without MAR signature verification
|
||||||
|
ac_add_options --enable-unverified-updates
|
1508
app/mac/mozilla-115.patch
Normal file
1508
app/mac/mozilla-115.patch
Normal file
File diff suppressed because it is too large
Load diff
1520
app/mac/pkg-dmg
Executable file
1520
app/mac/pkg-dmg
Executable file
File diff suppressed because it is too large
Load diff
BIN
app/mac/updater.tar.xz
(Stored with Git LFS)
Normal file
BIN
app/mac/updater.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
10
app/mac/updater_renamer
Executable file
10
app/mac/updater_renamer
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Convert localized app name from "Firefox Software Update" to "Zotero Software Update"
|
||||||
|
#
|
||||||
|
# plist is UTF-16
|
||||||
|
f='updater.app/Contents/Resources/English.lproj/InfoPlist.strings'
|
||||||
|
with open(f, 'r', encoding='utf-16') as inputfile:
|
||||||
|
newText = inputfile.read().replace('Firefox', 'Zotero')
|
||||||
|
with open(f, 'w', encoding='utf-16') as outputfile:
|
||||||
|
outputfile.write(newText)
|
BIN
app/mac/zotero.xz
Executable file
BIN
app/mac/zotero.xz
Executable file
Binary file not shown.
1
app/modules/zotero-libreoffice-integration
Submodule
1
app/modules/zotero-libreoffice-integration
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 39a4b0586c110d9ed42561295bc36e4e0383c793
|
1
app/modules/zotero-word-for-mac-integration
Submodule
1
app/modules/zotero-word-for-mac-integration
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit de8ab22db748bef42f3730c20b9da1c0563de6c2
|
1
app/modules/zotero-word-for-windows-integration
Submodule
1
app/modules/zotero-word-for-windows-integration
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9883ac3cdadb5e452b17750230f1b305164d169d
|
30
app/scripts/7.0_beta_build_and_deploy
Executable file
30
app/scripts/7.0_beta_build_and_deploy
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
CHANNEL="beta"
|
||||||
|
BRANCH="main"
|
||||||
|
export SAFARI_APPEX="$ROOT_DIR/../safari-app-extension-builds/beta/ZoteroSafariExtension.appex"
|
||||||
|
|
||||||
|
# Set Safari extension LSMinimumSystemVersion to Mojave for betas
|
||||||
|
perl -pi -e 's/<string>11\.0<\/string>/<string>10.14<\/string>/' "$SAFARI_APPEX"/Contents/Info.plist
|
||||||
|
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
./check_requirements
|
||||||
|
|
||||||
|
hash=`./get_repo_branch_hash $BRANCH`
|
||||||
|
source_dir=`./get_commit_files $hash`
|
||||||
|
build_dir=`mktemp -d`
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "$source_dir"
|
||||||
|
rm -rf "$build_dir"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
./prepare_build -s "$source_dir" -o "$build_dir" -c $CHANNEL -m $hash
|
||||||
|
./build_and_deploy -d "$build_dir" -p $BUILD_PLATFORMS -c $CHANNEL
|
27
app/scripts/7.0_dev_build_and_deploy
Executable file
27
app/scripts/7.0_dev_build_and_deploy
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
CHANNEL="dev"
|
||||||
|
BRANCH="main"
|
||||||
|
export SAFARI_APPEX="$ROOT_DIR/../safari-app-extension-builds/dev/ZoteroSafariExtension.appex"
|
||||||
|
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
./check_requirements
|
||||||
|
|
||||||
|
hash=`./get_repo_branch_hash $BRANCH`
|
||||||
|
source_dir=`./get_commit_files $hash`
|
||||||
|
build_dir=`mktemp -d`
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "$source_dir"
|
||||||
|
rm -rf "$build_dir"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
./prepare_build -s "$source_dir" -o "$build_dir" -c $CHANNEL -m $hash
|
||||||
|
./build_and_deploy -d "$build_dir" -p $BUILD_PLATFORMS -c $CHANNEL -i 1
|
29
app/scripts/7.0_release_build_and_deploy
Executable file
29
app/scripts/7.0_release_build_and_deploy
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
CHANNEL="release"
|
||||||
|
BRANCH="main"
|
||||||
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
|
export SAFARI_APPEX="$ROOT_DIR/../safari-app-extension-builds/release/ZoteroSafariExtension.appex"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
./check_requirements
|
||||||
|
|
||||||
|
hash=`./get_repo_branch_hash $BRANCH`
|
||||||
|
source_dir=`./get_commit_files $hash`
|
||||||
|
build_dir=`mktemp -d`
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "$source_dir"
|
||||||
|
rm -rf "$build_dir"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
./prepare_build -s "$source_dir" -o "$build_dir" -c $CHANNEL -m $hash
|
||||||
|
./build_and_deploy -d "$build_dir" -p $BUILD_PLATFORMS -c $CHANNEL
|
27
app/scripts/7.0_test_build_and_deploy
Executable file
27
app/scripts/7.0_test_build_and_deploy
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
CHANNEL="test"
|
||||||
|
BRANCH="main"
|
||||||
|
export SAFARI_APPEX="$ROOT_DIR/../safari-app-extension-builds/test/ZoteroSafariExtension.appex"
|
||||||
|
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
./check_requirements
|
||||||
|
|
||||||
|
hash=`./get_repo_branch_hash $BRANCH`
|
||||||
|
source_dir=`./get_commit_files $hash`
|
||||||
|
build_dir=`mktemp -d`
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "$source_dir"
|
||||||
|
rm -rf "$build_dir"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
./prepare_build -s "$source_dir" -o "$build_dir" -c $CHANNEL -m $hash
|
||||||
|
./build_and_deploy -d "$build_dir" -p $BUILD_PLATFORMS -c $CHANNEL -i 1
|
52
app/scripts/add_omni_file
Executable file
52
app/scripts/add_omni_file
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
#
|
||||||
|
# Zip a file directly into app/omni.ja in staging/
|
||||||
|
#
|
||||||
|
# Zip paths are relative to the current directory, so this should be run from
|
||||||
|
# the client build/ directory
|
||||||
|
#
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat >&2 <<DONE
|
||||||
|
Usage: $0 path/to/file
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "${1:-}" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
files="$@"
|
||||||
|
|
||||||
|
for file in $files; do
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
echo "Error: $file not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
mac_path="$STAGE_DIR/Zotero.app/Contents/Resources"
|
||||||
|
win_path="$STAGE_DIR/Zotero_win-x64"
|
||||||
|
linux_path="$STAGE_DIR/Zotero_linux-x86_64"
|
||||||
|
|
||||||
|
added=0
|
||||||
|
for path in "$mac_path" "$win_path" "$linux_path"; do
|
||||||
|
if [ -d "$path" ]; then
|
||||||
|
echo "$path/app/omni.ja"
|
||||||
|
echo "Updating $(basename $(dirname $(dirname $path)))"
|
||||||
|
zip "$path/app/omni.ja" $files
|
||||||
|
added=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $added -eq 0 ]; then
|
||||||
|
echo "No directories found in staging!"
|
||||||
|
exit 1
|
||||||
|
fi
|
61
app/scripts/add_version_info
Executable file
61
app/scripts/add_version_info
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Update a builds manifest with info on a given build
|
||||||
|
"""
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import shutil
|
||||||
|
import json
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
MAJOR = None
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='Update a builds manifest with info on a given build',
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
|
||||||
|
parser.add_argument('-f', '--file', required=True, help="path to updates.json")
|
||||||
|
parser.add_argument('-v', '--version', required=True, help='version number of build')
|
||||||
|
parser.add_argument('-b', '--build_id', required=True, help="build ID ('20160801142343')")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
file = args.file
|
||||||
|
version = args.version
|
||||||
|
short_version = version[0:3]
|
||||||
|
|
||||||
|
# Back up JSON file
|
||||||
|
shutil.copy2(file, file + '.bak')
|
||||||
|
|
||||||
|
# Read in existing file
|
||||||
|
with open(file) as f:
|
||||||
|
updates = json.loads(f.read())
|
||||||
|
|
||||||
|
updates.append({
|
||||||
|
'version': version,
|
||||||
|
'buildID': args.build_id,
|
||||||
|
'detailsURL': f'https://www.zotero.org/support/{short_version}_changelog',
|
||||||
|
'major': MAJOR
|
||||||
|
})
|
||||||
|
|
||||||
|
# Keep last 5 entries
|
||||||
|
updates = updates[-5:]
|
||||||
|
|
||||||
|
# Write new file
|
||||||
|
updates = json.dumps(updates, indent=2)
|
||||||
|
with open(file, 'w') as f:
|
||||||
|
f.write(updates + "\n")
|
||||||
|
|
||||||
|
print(updates)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
except Exception as err:
|
||||||
|
sys.stderr.write("\n" + traceback.format_exc())
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
14
app/scripts/bootstrap.sh
Normal file
14
app/scripts/bootstrap.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
get_current_platform() {
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
echo l
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
echo m
|
||||||
|
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
||||||
|
echo w
|
||||||
|
elif [[ "$OSTYPE" == "msys" ]]; then
|
||||||
|
echo w
|
||||||
|
# Unknown, so probably Unix-y
|
||||||
|
else
|
||||||
|
echo l
|
||||||
|
fi
|
||||||
|
}
|
171
app/scripts/build_and_deploy
Executable file
171
app/scripts/build_and_deploy
Executable file
|
@ -0,0 +1,171 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Builds and deploys Zotero with full and incremental updates
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat >&2 <<DONE
|
||||||
|
Usage: $0 -d SOURCE_DIR -c CHANNEL -p PLATFORMS
|
||||||
|
-d SOURCE_DIR Source directory to build from
|
||||||
|
-c CHANNEL Release channel ('release', 'beta', 'dev')
|
||||||
|
-p PLATFORMS Platforms to build (m=Mac, w=Windows, l=Linux)
|
||||||
|
-i INCREMENTALS Number of incremental builds to create
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SOURCE_DIR=""
|
||||||
|
CHANNEL=""
|
||||||
|
PLATFORMS=""
|
||||||
|
while getopts "d:c:p:i:" opt; do
|
||||||
|
case $opt in
|
||||||
|
d)
|
||||||
|
SOURCE_DIR="$OPTARG"
|
||||||
|
if [ ! -d "$SOURCE_DIR" ]; then
|
||||||
|
echo "$SOURCE_DIR not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
CHANNEL="$OPTARG"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
PLATFORMS="$OPTARG"
|
||||||
|
;;
|
||||||
|
i)
|
||||||
|
NUM_INCREMENTALS="$OPTARG"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift $((OPTIND-1)); OPTIND=1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$SOURCE_DIR" ]] || [[ -z "$CHANNEL" ]] || [[ -z "$PLATFORMS" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$SCRIPT_DIR"/check_requirements
|
||||||
|
|
||||||
|
VERSION="`cat \"$SOURCE_DIR\"/version`"
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Error getting version from $SOURCE_DIR/version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enforce signing unless a test build
|
||||||
|
if [ "$CHANNEL" != "test" ]; then
|
||||||
|
SIGN="-e"
|
||||||
|
else
|
||||||
|
SIGN=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build Zotero
|
||||||
|
"$ROOT_DIR/build.sh" -d "$SOURCE_DIR" -p $PLATFORMS -c $CHANNEL $SIGN
|
||||||
|
|
||||||
|
BUILD_ID=`cat "$DIST_DIR/build_id"`
|
||||||
|
if [ -z "$BUILD_ID" ]; then
|
||||||
|
echo "Error getting build id"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TEMP_DIR=`mktemp -d`
|
||||||
|
# Clean up on exit
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "$TEMP_DIR"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
# Build full update
|
||||||
|
"$ROOT_DIR/update-packaging/build_autoupdate.sh" -f -c $CHANNEL -p $PLATFORMS -l $VERSION
|
||||||
|
|
||||||
|
# Build incremental updates for each platform
|
||||||
|
for i in `seq 0 1 $((${#PLATFORMS}-1))`
|
||||||
|
do
|
||||||
|
case ${PLATFORMS:i:1} in
|
||||||
|
m)
|
||||||
|
platform=mac
|
||||||
|
platform_name=Mac
|
||||||
|
;;
|
||||||
|
w)
|
||||||
|
platform=win
|
||||||
|
platform_name=Windows
|
||||||
|
;;
|
||||||
|
l)
|
||||||
|
platform=linux
|
||||||
|
platform_name=Linux
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$0: Invalid platform option ${PLATFORMS:i:1}"
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Getting $platform_name incrementals"
|
||||||
|
INCREMENTALS="`\"$SCRIPT_DIR/manage_incrementals\" -c $CHANNEL -p ${PLATFORMS:i:1} -n $NUM_INCREMENTALS`"
|
||||||
|
echo "$INCREMENTALS"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ -n "$INCREMENTALS" ]; then
|
||||||
|
for from in $INCREMENTALS; do
|
||||||
|
echo "Building incremental update for $platform_name from $from to $VERSION"
|
||||||
|
"$ROOT_DIR/update-packaging/build_autoupdate.sh" -i "$from" -c "$CHANNEL" -p ${PLATFORMS:i:1} -l $VERSION
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Upload builds to S3
|
||||||
|
"$SCRIPT_DIR/upload_builds" $CHANNEL $VERSION
|
||||||
|
|
||||||
|
# Upload file lists for each platform
|
||||||
|
channel_deploy_path="$DEPLOY_PATH/$CHANNEL"
|
||||||
|
mkdir "$TEMP_DIR/version_info"
|
||||||
|
chmod g+ws "$TEMP_DIR/version_info"
|
||||||
|
cp "$DIST_DIR"/files-* "$TEMP_DIR/version_info"
|
||||||
|
chmod g+w "$TEMP_DIR"/version_info/files-*
|
||||||
|
rsync -rv "$TEMP_DIR/version_info/" $DEPLOY_HOST:"$channel_deploy_path/$VERSION/"
|
||||||
|
|
||||||
|
# Download updates JSON for each platform, update it, and reupload it
|
||||||
|
for i in `seq 0 1 $((${#PLATFORMS}-1))`
|
||||||
|
do
|
||||||
|
case ${PLATFORMS:i:1} in
|
||||||
|
m)
|
||||||
|
architectures="mac"
|
||||||
|
;;
|
||||||
|
w)
|
||||||
|
architectures="win32 win-x64 win-arm64"
|
||||||
|
;;
|
||||||
|
l)
|
||||||
|
architectures="linux-i686 linux-x86_64"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for arch in $architectures;
|
||||||
|
do
|
||||||
|
jsonfile="updates-$arch.json"
|
||||||
|
|
||||||
|
scp $DEPLOY_HOST:"$channel_deploy_path/$jsonfile" "$TEMP_DIR/$jsonfile"
|
||||||
|
"$SCRIPT_DIR/add_version_info" -f "$TEMP_DIR/$jsonfile" -v $VERSION -b $BUILD_ID
|
||||||
|
scp "$TEMP_DIR/$jsonfile" $DEPLOY_HOST:"$channel_deploy_path/$jsonfile"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# Add version to incremental lists
|
||||||
|
echo
|
||||||
|
for i in `seq 0 1 $((${#PLATFORMS}-1))`
|
||||||
|
do
|
||||||
|
"$SCRIPT_DIR/manage_incrementals" -c $CHANNEL -p ${PLATFORMS:i:1} -a $VERSION
|
||||||
|
done
|
||||||
|
|
||||||
|
$DEPLOY_CMD
|
||||||
|
|
||||||
|
rm -rf "$STAGE_DIR"/*
|
85
app/scripts/build_and_run
Executable file
85
app/scripts/build_and_run
Executable file
|
@ -0,0 +1,85 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
ROOT_DIR="$(dirname $APP_ROOT_DIR)"
|
||||||
|
|
||||||
|
# Set ZOTERO_PROFILE environment variable to choose profile
|
||||||
|
if [ -n "${ZOTERO_PROFILE:-}" ]; then
|
||||||
|
profile="-p $ZOTERO_PROFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
REBUILD=0
|
||||||
|
SKIP_BUNDLED_FILES=0
|
||||||
|
DEBUGGER=0
|
||||||
|
while getopts "rbd" opt; do
|
||||||
|
case $opt in
|
||||||
|
r)
|
||||||
|
REBUILD=1
|
||||||
|
;;
|
||||||
|
|
||||||
|
b)
|
||||||
|
SKIP_BUNDLED_FILES=1
|
||||||
|
;;
|
||||||
|
|
||||||
|
d)
|
||||||
|
DEBUGGER=1
|
||||||
|
;;
|
||||||
|
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Remove options from $@
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
if [ $REBUILD -eq 1 ]; then
|
||||||
|
PARAMS=""
|
||||||
|
if [ $DEBUGGER -eq 1 ]; then
|
||||||
|
PARAMS="-t"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if build watch is running
|
||||||
|
# If not, run now
|
||||||
|
if ! ps u | grep js-build/build.js | grep -v grep > /dev/null; then
|
||||||
|
echo "Running JS build process"
|
||||||
|
echo
|
||||||
|
cd $ROOT_DIR
|
||||||
|
# TEMP: --openssl-legacy-provider avoids a build error in pdf.js
|
||||||
|
NODE_OPTIONS=--openssl-legacy-provider npm run build
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$SCRIPT_DIR/dir_build" -q $PARAMS
|
||||||
|
|
||||||
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
|
# Sign the Word dylib so it works on Apple Silicon
|
||||||
|
"$SCRIPT_DIR/codesign_local" "$APP_ROOT_DIR/staging/Zotero.app"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
PARAMS=""
|
||||||
|
if [ $SKIP_BUNDLED_FILES -eq 1 ]; then
|
||||||
|
PARAMS="$PARAMS -ZoteroSkipBundledFiles"
|
||||||
|
fi
|
||||||
|
if [ $DEBUGGER -eq 1 ]; then
|
||||||
|
PARAMS="$PARAMS -jsdebugger"
|
||||||
|
else
|
||||||
|
PARAMS="$PARAMS -jsconsole"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
|
command="Zotero.app/Contents/MacOS/zotero"
|
||||||
|
elif [ "`uname`" = "Linux" ]; then
|
||||||
|
command="Zotero_linux-x86_64/zotero"
|
||||||
|
elif [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
command="Zotero_win-x64/zotero.exe"
|
||||||
|
else
|
||||||
|
echo "Unknown platform" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$APP_ROOT_DIR/staging/$command" $profile -ZoteroDebugText -purgecaches $PARAMS "$@"
|
161
app/scripts/check_requirements
Executable file
161
app/scripts/check_requirements
Executable file
|
@ -0,0 +1,161 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -uo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
ROOT_DIR="$(dirname "$APP_ROOT_DIR")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
. "$SCRIPT_DIR/bootstrap.sh"
|
||||||
|
|
||||||
|
cd "$ROOT_DIR"
|
||||||
|
|
||||||
|
platform=`get_current_platform`
|
||||||
|
|
||||||
|
FAIL_CMD='echo -e \033[31;1mFAIL\033[0m'
|
||||||
|
FAIL_CMD_INLINE='echo -n -e \033[31;1mFAIL\033[0m'
|
||||||
|
FAILED=0
|
||||||
|
|
||||||
|
hdr_start=`tput smul`
|
||||||
|
hdr_stop=`tput rmul`
|
||||||
|
|
||||||
|
echo "${hdr_start}Checking build requirements:${hdr_stop}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n "Checking for Node.js: "
|
||||||
|
which node || { $FAIL_CMD_INLINE; FAILED=1; }
|
||||||
|
node_version=$(node -v | cut -c 2-)
|
||||||
|
echo -n "Checking Node version: $node_version"
|
||||||
|
if [ $(echo $node_version | cut -d '.' -f1 ) -ge "18" ]; then
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo -n " -- must be 18 or later "
|
||||||
|
{ $FAIL_CMD; FAILED=1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Checking for Git LFS: "
|
||||||
|
which git-lfs || { $FAIL_CMD_INLINE; FAILED=1; }
|
||||||
|
|
||||||
|
echo "Checking for Git LFS checkouts: "
|
||||||
|
lfs_files=$(git lfs ls-files -n 2> /dev/null) || { $FAIL_CMD; FAILED=1; }
|
||||||
|
for lfs_file in $lfs_files; do
|
||||||
|
echo -n " - $lfs_file: "
|
||||||
|
file_type=$(file -b $lfs_file)
|
||||||
|
echo -n $file_type" "
|
||||||
|
if [ -z "$(echo -n $file_type | grep XZ)" ]; then
|
||||||
|
{ $FAIL_CMD_INLINE; FAILED=1; echo " -- run 'git lfs pull'"; }
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -n "Checking for perl: "
|
||||||
|
which perl || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for python3: "
|
||||||
|
which python3 || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for curl: "
|
||||||
|
which curl || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for wget: "
|
||||||
|
which wget || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for zip: "
|
||||||
|
which zip || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for unzip: "
|
||||||
|
which unzip || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for xz: "
|
||||||
|
which xz || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for awk: "
|
||||||
|
which awk || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for rsync: "
|
||||||
|
which rsync || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
if [ $platform = "w" ]; then
|
||||||
|
echo -n "Checking for 7z: "
|
||||||
|
which 7z || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for rcedit: "
|
||||||
|
which rcedit || { $FAIL_CMD; FAILED=1; echo " -- Install with fetch_rcedit"; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $platform = "w" ]; then
|
||||||
|
echo
|
||||||
|
echo "${hdr_start}Checking Windows packaging requirements:${hdr_stop}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n "Checking for upx: "
|
||||||
|
which upx || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for uuidgen: "
|
||||||
|
which uuidgen || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for code-signing script: "
|
||||||
|
if [ -x "$APP_ROOT_DIR/win/codesign" ]; then
|
||||||
|
echo "$APP_ROOT_DIR/win/codesign"
|
||||||
|
else
|
||||||
|
$FAIL_CMD
|
||||||
|
FAILED=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Checking for Unicode NSIS: "
|
||||||
|
if [ -x "`cygpath -u \"${NSIS_DIR}makensis.exe\"`" ]; then
|
||||||
|
echo "`cygpath -u \"${NSIS_DIR}makensis.exe\"`"
|
||||||
|
else
|
||||||
|
$FAIL_CMD
|
||||||
|
FAILED=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
plugin_path=$(cd "$NSIS_DIR\\Plugins\\x86-unicode" && pwd)
|
||||||
|
plugins="AppAssocReg ApplicationID InvokeShellVerb ShellLink UAC"
|
||||||
|
echo "Checking for NSIS plugins in $plugin_path"
|
||||||
|
for i in $plugins; do
|
||||||
|
echo -n " $i.dll: "
|
||||||
|
if [ -f "$plugin_path/$i.dll" ]; then
|
||||||
|
echo OK
|
||||||
|
else
|
||||||
|
$FAIL_CMD
|
||||||
|
FAILED=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $platform = "m" ]; then
|
||||||
|
echo
|
||||||
|
echo "${hdr_start}Checking Mac packaging requirements:${hdr_stop}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n "Checking for codesign: "
|
||||||
|
which /usr/bin/codesign || { $FAIL_CMD; FAILED=1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "${hdr_start}Checking distribution requirements:${hdr_stop}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n "Checking for Mozilla ARchive (MAR) tool: "
|
||||||
|
which mar || { $FAIL_CMD; FAILED=1; echo " -- Install with fetch_mar_tools"; }
|
||||||
|
|
||||||
|
echo -n "Checking for mbsdiff: "
|
||||||
|
which mbsdiff || { $FAIL_CMD; FAILED=1; echo " -- Install with fetch_mar_tools"; }
|
||||||
|
|
||||||
|
echo -n "Checking for rsync: "
|
||||||
|
which rsync || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for sha512sum/shasum: "
|
||||||
|
which sha512sum 2>/dev/null || which shasum 2>/dev/null || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for AWS CLI: "
|
||||||
|
which aws || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for AWS S3 access: "
|
||||||
|
aws s3 ls $S3_BUCKET/$S3_DIST_PATH | sed 's/^[[:blank:]]*//' || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
echo -n "Checking for deploy host directory access: "
|
||||||
|
ssh $DEPLOY_HOST ls -d $DEPLOY_PATH || { $FAIL_CMD; FAILED=1; }
|
||||||
|
|
||||||
|
|
||||||
|
exit $FAILED
|
40
app/scripts/codesign_local
Executable file
40
app/scripts/codesign_local
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Perform ad-hoc code signing of Zotero.app for local usage
|
||||||
|
#
|
||||||
|
# Currently we sign only the Word dylib, since that's necessary for Zotero developers to work on
|
||||||
|
# Word integration on Apple Silicon. If we discover other problems, we can uncomment some of the
|
||||||
|
# other lines. If you're making a custom build, you can modify this file to sign the entire build
|
||||||
|
# instead of just the bare minimum needed for development.
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
if [ -z "${1:-}" ]; then
|
||||||
|
echo "Usage: $0 path/to/staging/Zotero.app"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
APPDIR=$1
|
||||||
|
DEVELOPER_ID="-"
|
||||||
|
|
||||||
|
entitlements_file="$ROOT_DIR/mac/entitlements.xml"
|
||||||
|
#/usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" \
|
||||||
|
# "$APPDIR/Contents/MacOS/XUL" \
|
||||||
|
# "$APPDIR/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater"
|
||||||
|
#find "$APPDIR/Contents" -name '*.dylib' -exec /usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" {} \;
|
||||||
|
#find "$APPDIR/Contents" -name '*.app' -exec /usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" {} \;
|
||||||
|
#/usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" "$APPDIR/Contents/MacOS/zotero"
|
||||||
|
|
||||||
|
# Skip signing of Safari extension, since it's not present for local builds
|
||||||
|
|
||||||
|
# Sign final app package
|
||||||
|
#echo
|
||||||
|
#/usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" "$APPDIR"
|
||||||
|
|
||||||
|
# Verify app
|
||||||
|
#/usr/bin/codesign --verify -vvvv "$APPDIR"
|
||||||
|
|
||||||
|
find "$APPDIR/Contents" -name 'libZoteroWordIntegration.dylib' -exec /usr/bin/codesign --force --options runtime --entitlements "$entitlements_file" --sign "$DEVELOPER_ID" {} \;
|
76
app/scripts/createprecomplete.py
Executable file
76
app/scripts/createprecomplete.py
Executable file
|
@ -0,0 +1,76 @@
|
||||||
|
# Any copyright is dedicated to the Public Domain.
|
||||||
|
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
|
||||||
|
# Creates the precomplete file containing the remove and rmdir application
|
||||||
|
# update instructions which is used to remove files and directories that are no
|
||||||
|
# longer present in a complete update. The current working directory is used for
|
||||||
|
# the location to enumerate and to create the precomplete file.
|
||||||
|
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def get_build_entries(root_path):
|
||||||
|
"""Iterates through the root_path, creating a list for each file and
|
||||||
|
directory. Excludes any file paths ending with channel-prefs.js.
|
||||||
|
"""
|
||||||
|
rel_file_path_set = set()
|
||||||
|
rel_dir_path_set = set()
|
||||||
|
for root, dirs, files in os.walk(root_path):
|
||||||
|
for file_name in files:
|
||||||
|
parent_dir_rel_path = root[len(root_path) + 1 :]
|
||||||
|
rel_path_file = os.path.join(parent_dir_rel_path, file_name)
|
||||||
|
rel_path_file = rel_path_file.replace("\\", "/")
|
||||||
|
if not (
|
||||||
|
rel_path_file.endswith("channel-prefs.js")
|
||||||
|
or rel_path_file.endswith("update-settings.ini")
|
||||||
|
or "/ChannelPrefs.framework/" in rel_path_file
|
||||||
|
or rel_path_file.startswith("ChannelPrefs.framework/")
|
||||||
|
or "/UpdateSettings.framework/" in rel_path_file
|
||||||
|
or rel_path_file.startswith("UpdateSettings.framework/")
|
||||||
|
or "distribution/" in rel_path_file
|
||||||
|
):
|
||||||
|
rel_file_path_set.add(rel_path_file)
|
||||||
|
|
||||||
|
for dir_name in dirs:
|
||||||
|
parent_dir_rel_path = root[len(root_path) + 1 :]
|
||||||
|
rel_path_dir = os.path.join(parent_dir_rel_path, dir_name)
|
||||||
|
rel_path_dir = rel_path_dir.replace("\\", "/") + "/"
|
||||||
|
if rel_path_dir.find("distribution/") == -1:
|
||||||
|
rel_dir_path_set.add(rel_path_dir)
|
||||||
|
|
||||||
|
rel_file_path_list = list(rel_file_path_set)
|
||||||
|
rel_file_path_list.sort(reverse=True)
|
||||||
|
rel_dir_path_list = list(rel_dir_path_set)
|
||||||
|
rel_dir_path_list.sort(reverse=True)
|
||||||
|
|
||||||
|
return rel_file_path_list, rel_dir_path_list
|
||||||
|
|
||||||
|
|
||||||
|
def generate_precomplete(root_path):
|
||||||
|
"""Creates the precomplete file containing the remove and rmdir
|
||||||
|
application update instructions. The given directory is used
|
||||||
|
for the location to enumerate and to create the precomplete file.
|
||||||
|
"""
|
||||||
|
rel_path_precomplete = "precomplete"
|
||||||
|
# If inside a Mac bundle use the root of the bundle for the path.
|
||||||
|
if os.path.basename(root_path) == "Resources":
|
||||||
|
root_path = os.path.abspath(os.path.join(root_path, "../../"))
|
||||||
|
rel_path_precomplete = "Contents/Resources/precomplete"
|
||||||
|
|
||||||
|
precomplete_file_path = os.path.join(root_path, rel_path_precomplete)
|
||||||
|
# Open the file so it exists before building the list of files and open it
|
||||||
|
# in binary mode to prevent OS specific line endings.
|
||||||
|
precomplete_file = io.open(precomplete_file_path, mode="wt", newline="\n")
|
||||||
|
rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)
|
||||||
|
for rel_file_path in rel_file_path_list:
|
||||||
|
precomplete_file.write('remove "' + rel_file_path + '"\n')
|
||||||
|
|
||||||
|
for rel_dir_path in rel_dir_path_list:
|
||||||
|
precomplete_file.write('rmdir "' + rel_dir_path + '"\n')
|
||||||
|
|
||||||
|
precomplete_file.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
generate_precomplete(os.getcwd())
|
88
app/scripts/dir_build
Executable file
88
app/scripts/dir_build
Executable file
|
@ -0,0 +1,88 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat >&2 <<DONE
|
||||||
|
Usage: $0 -p platforms
|
||||||
|
Options
|
||||||
|
-p PLATFORMS Platforms to build (m=Mac, w=Windows, l=Linux)
|
||||||
|
-t add devtools
|
||||||
|
-q quick build (skip compression and other optional steps for faster restarts during development)
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
DEVTOOLS=0
|
||||||
|
PLATFORM=""
|
||||||
|
quick_build=0
|
||||||
|
while getopts "tp:q" opt; do
|
||||||
|
case $opt in
|
||||||
|
t)
|
||||||
|
DEVTOOLS=1
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
for i in `seq 0 1 $((${#OPTARG}-1))`
|
||||||
|
do
|
||||||
|
case ${OPTARG:i:1} in
|
||||||
|
m) PLATFORM="m";;
|
||||||
|
w) PLATFORM="w";;
|
||||||
|
l) PLATFORM="l";;
|
||||||
|
*)
|
||||||
|
echo "$0: Invalid platform option ${OPTARG:i:1}"
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
q)
|
||||||
|
quick_build=1
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $PLATFORM ]]; then
|
||||||
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
|
PLATFORM="m"
|
||||||
|
elif [ "`uname`" = "Linux" ]; then
|
||||||
|
PLATFORM="l"
|
||||||
|
|
||||||
|
# If platform not given explicitly, skip 32-bit build if 64-bit system
|
||||||
|
if [ "$(arch)" = "x86_64" ]; then
|
||||||
|
export SKIP_32=1
|
||||||
|
fi
|
||||||
|
elif [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
PLATFORM="w"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHANNEL="source"
|
||||||
|
|
||||||
|
PARAMS=""
|
||||||
|
if [ $DEVTOOLS -eq 1 ]; then
|
||||||
|
PARAMS+=" -t"
|
||||||
|
fi
|
||||||
|
if [ $quick_build -eq 1 ]; then
|
||||||
|
PARAMS+=" -q"
|
||||||
|
fi
|
||||||
|
|
||||||
|
hash=`git -C "$ROOT_DIR" rev-parse --short HEAD`
|
||||||
|
|
||||||
|
build_dir=`mktemp -d`
|
||||||
|
function cleanup {
|
||||||
|
rm -rf $build_dir
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
"$SCRIPT_DIR/prepare_build" -s "$ROOT_DIR/build" -o "$build_dir" -c $CHANNEL -m $hash
|
||||||
|
"$APP_ROOT_DIR/build.sh" -d "$build_dir" -p $PLATFORM -c $CHANNEL -s $PARAMS
|
||||||
|
|
||||||
|
echo Done
|
22
app/scripts/fetch_mar_tools
Executable file
22
app/scripts/fetch_mar_tools
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
|
||||||
|
cd "$APP_ROOT_DIR"
|
||||||
|
|
||||||
|
mkdir -p "xulrunner/bin"
|
||||||
|
if [ "`uname`" = "Darwin" ]; then
|
||||||
|
# Mozilla has Linux executables where the Mac files should be, so supply our own Mac builds
|
||||||
|
curl -o "xulrunner/bin/mar" https://zotero-download.s3.us-east-1.amazonaws.com/tools/mac/102.11.0esr/mar
|
||||||
|
curl -o "xulrunner/bin/mbsdiff" https://zotero-download.s3.us-east-1.amazonaws.com/tools/mac/102.11.0esr/mbsdiff
|
||||||
|
elif [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
# Mozilla doesn't seem to provide Windows versions via its file server anymore, so supply our own
|
||||||
|
curl -o "xulrunner/bin/mar.exe" https://zotero-download.s3.us-east-1.amazonaws.com/tools/win/102.11.0esr/mar.exe
|
||||||
|
curl -o "xulrunner/bin/mbsdiff.exe" https://zotero-download.s3.us-east-1.amazonaws.com/tools/win/102.11.0esr/mbsdiff.exe
|
||||||
|
else
|
||||||
|
curl -o "xulrunner/bin/mar" https://ftp.mozilla.org/pub/firefox/nightly/2022/05/2022-05-30-09-39-43-mozilla-central/mar-tools/linux64/mar
|
||||||
|
curl -o "xulrunner/bin/mbsdiff" https://ftp.mozilla.org/pub/firefox/nightly/2022/05/2022-05-30-09-39-43-mozilla-central/mar-tools/linux64/mbsdiff
|
||||||
|
fi
|
||||||
|
chmod 755 xulrunner/bin/mar xulrunner/bin/mbsdiff
|
11
app/scripts/fetch_rcedit
Executable file
11
app/scripts/fetch_rcedit
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
|
||||||
|
cd "$ROOT_DIR"
|
||||||
|
|
||||||
|
mkdir -p "xulrunner/bin"
|
||||||
|
curl -L -o "xulrunner/bin/rcedit.exe" https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x86.exe
|
||||||
|
chmod 755 xulrunner/bin/rcedit
|
594
app/scripts/fetch_xulrunner
Executable file
594
app/scripts/fetch_xulrunner
Executable file
|
@ -0,0 +1,594 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Copyright (c) 2011 Zotero
|
||||||
|
# Center for History and New Media
|
||||||
|
# George Mason University, Fairfax, Virginia, USA
|
||||||
|
# http://zotero.org
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
cd "$APP_ROOT_DIR"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat >&2 <<DONE
|
||||||
|
Usage: $0 -p platforms [-s]
|
||||||
|
Options
|
||||||
|
-p PLATFORMS Platforms to build (m=Mac, w=Windows, l=Linux)
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
BUILD_MAC=0
|
||||||
|
BUILD_WIN=0
|
||||||
|
BUILD_LINUX=0
|
||||||
|
while getopts "p:s" opt; do
|
||||||
|
case $opt in
|
||||||
|
p)
|
||||||
|
for i in `seq 0 1 $((${#OPTARG}-1))`
|
||||||
|
do
|
||||||
|
case ${OPTARG:i:1} in
|
||||||
|
m) BUILD_MAC=1;;
|
||||||
|
w) BUILD_WIN=1;;
|
||||||
|
l) BUILD_LINUX=1;;
|
||||||
|
*)
|
||||||
|
echo "$0: Invalid platform option ${OPTARG:i:1}"
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift $((OPTIND-1)); OPTIND=1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Require at least one platform
|
||||||
|
if [[ $BUILD_MAC == 0 ]] && [[ $BUILD_WIN == 0 ]] && [[ $BUILD_LINUX == 0 ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
function replace_line {
|
||||||
|
pattern=$1
|
||||||
|
replacement=$2
|
||||||
|
file=$3
|
||||||
|
|
||||||
|
if egrep -q "$pattern" "$file"; then
|
||||||
|
perl -pi -e "s/$pattern/$replacement/" "$file"
|
||||||
|
else
|
||||||
|
echo "$pattern" not found in "$file" -- aborting 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_line {
|
||||||
|
pattern=$1
|
||||||
|
file=$2
|
||||||
|
|
||||||
|
if egrep -q "$pattern" "$file"; then
|
||||||
|
egrep -v "$pattern" "$file" > "$file.tmp"
|
||||||
|
mv "$file.tmp" "$file"
|
||||||
|
else
|
||||||
|
echo "$pattern" not found in "$file" -- aborting 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_utf16_chars {
|
||||||
|
str=$(echo -n "$1" | xxd -p | fold -w 2 | sed -r 's/(.+)/\\\\x{\1}\\\\x{00}/')
|
||||||
|
# Add NUL padding
|
||||||
|
if [ -n "${2:-}" ]; then
|
||||||
|
# Multiply characters x 2 for UTF-16
|
||||||
|
for i in `seq 1 $(($2 * 2))`; do
|
||||||
|
str+=$(echo '\\x{00}')
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
echo $str | xargs | sed 's/ //g'
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Make various modifications to the stock Firefox app
|
||||||
|
#
|
||||||
|
function modify_omni {
|
||||||
|
platform=$1
|
||||||
|
|
||||||
|
mkdir omni
|
||||||
|
mv omni.ja omni
|
||||||
|
cd omni
|
||||||
|
# omni.ja is an "optimized" ZIP file, so use a script from Mozilla to avoid a warning from unzip
|
||||||
|
# here and to make it work after rezipping below
|
||||||
|
python3 "$APP_ROOT_DIR/scripts/optimizejars.py" --deoptimize ./ ./ ./
|
||||||
|
rm -f omni.ja.log
|
||||||
|
unzip omni.ja
|
||||||
|
rm omni.ja
|
||||||
|
|
||||||
|
replace_line 'BROWSER_CHROME_URL:.+' 'BROWSER_CHROME_URL: "chrome:\/\/zotero\/content\/zoteroPane.xhtml",' modules/AppConstants.sys.mjs
|
||||||
|
|
||||||
|
# https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/internals/preferences.html
|
||||||
|
#
|
||||||
|
# It's not clear that most of these do anything anymore when not compiled in, but just in case
|
||||||
|
replace_line 'MOZ_REQUIRE_SIGNING:' 'MOZ_REQUIRE_SIGNING: false \&\&' modules/AppConstants.sys.mjs
|
||||||
|
replace_line 'MOZ_DATA_REPORTING:' 'MOZ_DATA_REPORTING: false \&\&' modules/AppConstants.sys.mjs
|
||||||
|
replace_line 'MOZ_SERVICES_HEALTHREPORT:' 'MOZ_SERVICES_HEALTHREPORT: false \&\&' modules/AppConstants.sys.mjs
|
||||||
|
replace_line 'MOZ_TELEMETRY_REPORTING:' 'MOZ_TELEMETRY_REPORTING: false \&\&' modules/AppConstants.sys.mjs
|
||||||
|
replace_line 'MOZ_TELEMETRY_ON_BY_DEFAULT:' 'MOZ_TELEMETRY_ON_BY_DEFAULT: false \&\&' modules/AppConstants.sys.mjs
|
||||||
|
replace_line 'MOZ_CRASHREPORTER:' 'MOZ_CRASHREPORTER: false \&\&' modules/AppConstants.sys.mjs
|
||||||
|
replace_line 'MOZ_UPDATE_CHANNEL:.+' 'MOZ_UPDATE_CHANNEL: "none",' modules/AppConstants.sys.mjs
|
||||||
|
replace_line '"https:\/\/[^\/]+mozilla.com.+"' '""' modules/AppConstants.sys.mjs
|
||||||
|
|
||||||
|
# Don't use Mozilla Maintenance Service on Windows
|
||||||
|
replace_line 'MOZ_MAINTENANCE_SERVICE:' 'MOZ_MAINTENANCE_SERVICE: false \&\&' modules/AppConstants.sys.mjs
|
||||||
|
# Continue using app.update.auto in prefs.js on Windows
|
||||||
|
replace_line 'PER_INSTALLATION_PREFS_PLATFORMS = \["win"\]' 'PER_INSTALLATION_PREFS_PLATFORMS = []' modules/UpdateUtils.sys.mjs
|
||||||
|
|
||||||
|
# Prompt if major update is available instead of installing automatically on restart
|
||||||
|
replace_line 'if \(!updateAuto\) \{' 'if (update.type == "major") {
|
||||||
|
LOG("UpdateService:_selectAndInstallUpdate - prompting because it is a major update");
|
||||||
|
AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_SHOWPROMPT_PREF);
|
||||||
|
Services.obs.notifyObservers(update, "update-available", "show-prompt");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!updateAuto) {' modules/UpdateService.sys.mjs
|
||||||
|
|
||||||
|
# Avoid console warning about resource://gre/modules/FxAccountsCommon.js
|
||||||
|
replace_line 'const logins = this._data.logins;' 'const logins = this._data.logins; if (this._data.logins.length != -1) return;' modules/LoginStore.sys.mjs
|
||||||
|
|
||||||
|
# Prevent error during network requests
|
||||||
|
replace_line 'async lazyInit\(\) \{' 'async lazyInit() { if (this.features) return false;' modules/UrlClassifierExceptionListService.sys.mjs
|
||||||
|
|
||||||
|
replace_line 'pref\("network.captive-portal-service.enabled".+' 'pref("network.captive-portal-service.enabled", false);' greprefs.js
|
||||||
|
replace_line 'pref\("network.connectivity-service.enabled".+' 'pref("network.connectivity-service.enabled", false);' greprefs.js
|
||||||
|
replace_line 'pref\("toolkit.telemetry.server".+' 'pref("toolkit.telemetry.server", "");' greprefs.js
|
||||||
|
replace_line 'pref\("toolkit.telemetry.unified".+' 'pref("toolkit.telemetry.unified", false);' greprefs.js
|
||||||
|
replace_line 'pref\("media.gmp-manager.url".+' 'pref("media.gmp-manager.url", "");' greprefs.js
|
||||||
|
|
||||||
|
#
|
||||||
|
# # Disable transaction timeout
|
||||||
|
# perl -pi -e 's/let timeoutPromise/\/*let timeoutPromise/' modules/Sqlite.jsm
|
||||||
|
# perl -pi -e 's/return Promise.race\(\[transactionPromise, timeoutPromise\]\);/*\/return transactionPromise;/' modules/Sqlite.jsm
|
||||||
|
# rm -f jsloader/resource/gre/modules/Sqlite.jsm
|
||||||
|
#
|
||||||
|
# Disable unwanted components
|
||||||
|
remove_line '(RemoteSettings|services-|telemetry|Telemetry|URLDecorationAnnotationsService)' components/components.manifest
|
||||||
|
|
||||||
|
# Do not trigger LoginManager event that logs an error on autocomplete submission
|
||||||
|
remove_line 'DOMInputPasswordAdded: \{\},' modules/ActorManagerParent.sys.mjs
|
||||||
|
|
||||||
|
# On Mac/Linux, ignore relative paths in PATH in Subprocess.pathSearch(), used when a bare command is passed to Utilities.Internal.subprocess()
|
||||||
|
if [[ $platform != win* ]]; then
|
||||||
|
replace_line 'let path = PathUtils.join\(dir, bin\);' 'if (!dir.startsWith("\/")) continue; let path = PathUtils.join(dir, bin);' modules/subprocess/subprocess_unix.sys.mjs
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove unwanted files
|
||||||
|
pushd modules
|
||||||
|
rm Bookmarks*
|
||||||
|
rm FxAccounts*
|
||||||
|
echo '' > PartitioningExceptionListService.sys.mjs
|
||||||
|
rm Places*
|
||||||
|
echo '' > PlacesExpiration.sys.mjs
|
||||||
|
echo '' > PlacesFrecencyRecalculator.sys.mjs
|
||||||
|
rm -rf services-settings/*
|
||||||
|
touch services-settings/remote-settings.sys.mjs
|
||||||
|
# Causes a startup error -- try an empty file or a shim instead?
|
||||||
|
#rm Telemetry*
|
||||||
|
rm URLDecorationAnnotationsService.sys.mjs
|
||||||
|
popd
|
||||||
|
pushd chrome/toolkit/content/mozapps/extensions
|
||||||
|
rm -rf default-theme
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Clear most WebExtension manifest properties
|
||||||
|
replace_line 'manifest = normalized.value;' 'manifest = normalized.value;
|
||||||
|
if (this.type == "extension") {
|
||||||
|
if (!manifest.applications?.zotero?.id) {
|
||||||
|
this.manifestError("applications.zotero.id not provided");
|
||||||
|
}
|
||||||
|
if (!manifest.applications?.zotero?.update_url) {
|
||||||
|
this.manifestError("applications.zotero.update_url not provided");
|
||||||
|
}
|
||||||
|
if (!manifest.applications?.zotero?.strict_max_version) {
|
||||||
|
this.manifestError("applications.zotero.strict_max_version not provided");
|
||||||
|
}
|
||||||
|
manifest.browser_specific_settings = undefined;
|
||||||
|
manifest.content_scripts = [];
|
||||||
|
manifest.permissions = [];
|
||||||
|
manifest.host_permissions = [];
|
||||||
|
manifest.web_accessible_resources = undefined;
|
||||||
|
manifest.experiment_apis = {};
|
||||||
|
}' modules/Extension.sys.mjs
|
||||||
|
|
||||||
|
# Use applications.zotero instead of applications.gecko
|
||||||
|
replace_line 'let bss = manifest.applications\?.gecko' 'let bss = manifest.applications?.zotero' modules/addons/XPIInstall.jsm
|
||||||
|
replace_line 'manifest.applications\?.gecko' 'manifest.applications?.zotero' modules/Extension.sys.mjs
|
||||||
|
|
||||||
|
# When installing addon, use app version instead of toolkit version for targetApplication
|
||||||
|
replace_line "id: TOOLKIT_ID," "id: '$APP_ID'," modules/addons/XPIInstall.jsm
|
||||||
|
|
||||||
|
# Accept zotero@chnm.gmu.edu for target application to allow Zotero 6 plugins to remain
|
||||||
|
# installed in Zotero 7
|
||||||
|
replace_line "if \(targetApp.id == Services.appinfo.ID\) \{" "if (targetApp.id == 'zotero\@chnm.gmu.edu') targetApp.id = '$APP_ID'; if (targetApp.id == Services.appinfo.ID) {" modules/addons/XPIDatabase.jsm
|
||||||
|
|
||||||
|
# TEMP: Skip addons without ids until we figure out what's going on with the default theme.
|
||||||
|
# This fixes plugin updating and other things.
|
||||||
|
replace_line 'return addons;' 'return addons.filter(addon => addon.id);' modules/addons/XPIDatabase.jsm
|
||||||
|
|
||||||
|
# For updates, look for applications.zotero instead of applications.gecko in manifest.json and
|
||||||
|
# use the app id and version for strict_min_version/strict_max_version comparisons
|
||||||
|
replace_line 'gecko: \{\},' 'zotero: {},' modules/addons/AddonUpdateChecker.sys.mjs
|
||||||
|
replace_line 'if \(!\("gecko" in applications\)\) \{' 'if (!("zotero" in applications)) {' modules/addons/AddonUpdateChecker.sys.mjs
|
||||||
|
replace_line '"gecko not in application entry' '"zotero not in application entry' modules/addons/AddonUpdateChecker.sys.mjs
|
||||||
|
replace_line 'let app = getProperty\(applications, "gecko", "object"\);' 'let app = getProperty(applications, "zotero", "object");' modules/addons/AddonUpdateChecker.sys.mjs
|
||||||
|
replace_line "id: TOOLKIT_ID," "id: '$APP_ID'," modules/addons/AddonUpdateChecker.sys.mjs
|
||||||
|
replace_line 'lazy.AddonManagerPrivate.webExtensionsMinPlatformVersion' '"7.0"' modules/addons/AddonUpdateChecker.sys.mjs
|
||||||
|
replace_line 'result.targetApplications.push' 'false && result.targetApplications.push' modules/addons/AddonUpdateChecker.sys.mjs
|
||||||
|
|
||||||
|
# Prevent automatic installation of default theme
|
||||||
|
# (chrome/toolkit/content/mozapps/extensions/default-theme, removed above)
|
||||||
|
replace_line 'this.maybeInstallBuiltinAddon\(' 'if (false) this.maybeInstallBuiltinAddon(' modules/addons/XPIProvider.jsm
|
||||||
|
|
||||||
|
# Don't log a warning when checking 'distribution/extensions' for addons
|
||||||
|
replace_line 'logger.warn\(`Checking' 'logger.debug(`Checking' modules/addons/XPIProvider.jsm
|
||||||
|
|
||||||
|
# Allow addon installation by bypassing confirmation dialogs. If we want a confirmation dialog,
|
||||||
|
# we need to either add gXPInstallObserver from browser-addons.js [1][2] or provide our own with
|
||||||
|
# Ci.amIWebInstallPrompt [3].
|
||||||
|
#
|
||||||
|
# [1] https://searchfox.org/mozilla-esr102/rev/5a6d529652045050c5cdedc0558238949b113741/browser/base/content/browser.js#1902-1923
|
||||||
|
# [2] https://searchfox.org/mozilla-esr102/rev/5a6d529652045050c5cdedc0558238949b113741/browser/base/content/browser-addons.js#201
|
||||||
|
# [3] https://searchfox.org/mozilla-esr102/rev/5a6d529652045050c5cdedc0558238949b113741/toolkit/mozapps/extensions/AddonManager.sys.mjs#3114-3124
|
||||||
|
replace_line 'if \(info.addon.userPermissions\) \{' 'if (false) {' modules/AddonManager.sys.mjs
|
||||||
|
replace_line '\} else if \(info.addon.sitePermissions\) \{' '} else if (false) {' modules/AddonManager.sys.mjs
|
||||||
|
replace_line '\} else if \(requireConfirm\) \{' '} else if (false) {' modules/AddonManager.sys.mjs
|
||||||
|
|
||||||
|
# Make addon listener methods wait for promises, to allow calling asynchronous plugin `shutdown`
|
||||||
|
# and `uninstall` methods in our `onInstalling` handler
|
||||||
|
replace_line 'callAddonListeners\(aMethod' 'async callAddonListeners(aMethod' modules/AddonManager.sys.mjs
|
||||||
|
# Don't need this one to be async, but we can't easily avoid modifying its `listener[aMethod].apply()` call
|
||||||
|
replace_line 'callManagerListeners\(aMethod' 'async callManagerListeners(aMethod' modules/AddonManager.sys.mjs
|
||||||
|
replace_line 'AddonManagerInternal.callAddonListeners.apply\(AddonManagerInternal, aArgs\);' \
|
||||||
|
'return AddonManagerInternal.callAddonListeners.apply(AddonManagerInternal, aArgs);' modules/AddonManager.sys.mjs
|
||||||
|
replace_line 'listener\[aMethod\].apply\(listener, aArgs\);' \
|
||||||
|
'let maybePromise = listener[aMethod].apply(listener, aArgs);
|
||||||
|
if (maybePromise && maybePromise.then) await maybePromise;' modules/AddonManager.sys.mjs
|
||||||
|
replace_line 'AddonManagerPrivate.callAddonListeners' 'await AddonManagerPrivate.callAddonListeners' modules/addons/XPIInstall.jsm
|
||||||
|
replace_line 'let uninstall = \(\) => \{' 'let uninstall = async () => {' modules/addons/XPIInstall.jsm
|
||||||
|
replace_line 'cancelUninstallAddon\(aAddon\)' 'async cancelUninstallAddon(aAddon)' modules/addons/XPIInstall.jsm
|
||||||
|
|
||||||
|
# No idea why this is necessary, but without it initialization fails with "TypeError: "constructor" is read-only"
|
||||||
|
replace_line 'LoginStore.prototype.constructor = LoginStore;' '\/\/LoginStore.prototype.constructor = LoginStore;' modules/LoginStore.sys.mjs
|
||||||
|
#
|
||||||
|
# # Allow proxy password saving
|
||||||
|
# perl -pi -e 's/get _inPrivateBrowsing\(\) \{/get _inPrivateBrowsing() {if (true) { return false; }/' components/nsLoginManagerPrompter.js
|
||||||
|
#
|
||||||
|
# # Change text in update dialog
|
||||||
|
# perl -pi -e 's/A security and stability update for/A new version of/' chrome/en-US/locale/en-US/mozapps/update/updates.properties
|
||||||
|
# perl -pi -e 's/updateType_major=New Version/updateType_major=New Major Version/' chrome/en-US/locale/en-US/mozapps/update/updates.properties
|
||||||
|
# perl -pi -e 's/updateType_minor=Security Update/updateType_minor=New Version/' chrome/en-US/locale/en-US/mozapps/update/updates.properties
|
||||||
|
# perl -pi -e 's/update for &brandShortName; as soon as possible/update as soon as possible/' chrome/en-US/locale/en-US/mozapps/update/updates.dtd
|
||||||
|
#
|
||||||
|
# Set available locales
|
||||||
|
cp "$APP_ROOT_DIR/assets/multilocale.txt" res/multilocale.txt
|
||||||
|
|
||||||
|
# Use Zotero URL opening in Mozilla dialogs (e.g., app update dialog)
|
||||||
|
replace_line 'function openURL\(aURL\) \{' 'function openURL(aURL) {let {Zotero} = ChromeUtils.importESModule("chrome:\/\/zotero\/content\/zotero.mjs"); Zotero.launchURL(aURL); if (true) { return; }' chrome/toolkit/content/global/contentAreaUtils.js
|
||||||
|
|
||||||
|
#
|
||||||
|
# Modify Add-ons window
|
||||||
|
#
|
||||||
|
|
||||||
|
# Prevent display: block from overriding display: none on <hr>s
|
||||||
|
replace_line 'display: block !important;' 'display: block;' chrome/toolkit/content/global/elements/panel-list.css
|
||||||
|
|
||||||
|
file="chrome/toolkit/content/mozapps/extensions/aboutaddons.css"
|
||||||
|
echo >> $file
|
||||||
|
# Hide search bar, Themes and Plugins tabs, and sidebar footer
|
||||||
|
echo '.main-search, button[name="theme"], button[name="plugin"], sidebar-footer { display: none; }' >> $file
|
||||||
|
echo '.main-heading { margin-top: 2em; }' >> $file
|
||||||
|
# Hide Details/Permissions tabs in addon details so we only show details
|
||||||
|
echo 'addon-details > button-group { display: none !important; }' >> $file
|
||||||
|
# Hide "Debug Addons" and "Manage Extension Shortcuts"
|
||||||
|
echo 'panel-item[action="debug-addons"], panel-item[action="reset-update-states"] + hr, panel-item[action="manage-shortcuts"] { display: none }' >> $file
|
||||||
|
# Show cursor feedback on plugin homepage links
|
||||||
|
echo '.addon-detail-row-homepage .text-link { cursor: pointer; color: -moz-nativehyperlinktext; }' >> $file
|
||||||
|
echo '.addon-detail-row-homepage .text-link:hover { text-decoration: underline; }' >> $file
|
||||||
|
|
||||||
|
file="chrome/toolkit/content/mozapps/extensions/aboutaddons.js"
|
||||||
|
# Hide unsigned-addon warning
|
||||||
|
replace_line 'if \(!isCorrectlySigned\(addon\)\) \{' 'if (!isCorrectlySigned(addon)) {return {};' $file
|
||||||
|
# Hide Private Browsing setting in addon details
|
||||||
|
replace_line 'pbRow\.' '\/\/pbRow.' $file
|
||||||
|
replace_line 'let isAllowed = await isAllowedInPrivateBrowsing' '\/\/let isAllowed = await isAllowedInPrivateBrowsing' $file
|
||||||
|
# Use our own strings for the removal prompt
|
||||||
|
replace_line 'let \{ BrowserAddonUI \} = windowRoot.ownerGlobal;' '' $file
|
||||||
|
replace_line 'await BrowserAddonUI.promptRemoveExtension' 'promptRemoveExtension' $file
|
||||||
|
|
||||||
|
# Customize empty-list message
|
||||||
|
replace_line 'createEmptyListMessage\(\) {' 'createEmptyListMessage() {
|
||||||
|
var p = document.createElement("p");
|
||||||
|
p.id = "empty-list-message";
|
||||||
|
return p;' $file
|
||||||
|
# Swap in include.js, which we need for Zotero.getString(), for abuse-reports.js, which we don't need
|
||||||
|
|
||||||
|
# Open plugin links in external browser
|
||||||
|
replace_line 'let homepageURL = homepageRow.querySelector\(\"a\"\);' 'let homepageURL = homepageRow.querySelector(\"\.text-link\");' $file
|
||||||
|
replace_line 'homepageURL.href = addon.homepageURL;' 'homepageURL.setAttribute("href", addon.homepageURL);' $file
|
||||||
|
replace_line '<a target="_blank" dir="ltr"><\/a>' \
|
||||||
|
'<label target="_blank" class="text-link" dir="ltr"><\/label>' \
|
||||||
|
chrome/toolkit/content/mozapps/extensions/aboutaddons.html
|
||||||
|
|
||||||
|
# TODO: Use our own strings, but for now fix the bundled English ones
|
||||||
|
replace_line 'Manage Your Extensions' 'Manage Your Plugins' localization/en-US/toolkit/about/aboutAddons.ftl
|
||||||
|
replace_line '= Extensions' '= Plugins' localization/en-US/toolkit/about/aboutAddons.ftl
|
||||||
|
replace_line 'Add-on' 'Plugin' localization/en-US/toolkit/about/aboutAddons.ftl
|
||||||
|
|
||||||
|
# Hide Recommendations tab in sidebar and recommendations in main pane
|
||||||
|
replace_line 'function isDiscoverEnabled\(\) \{' 'function isDiscoverEnabled() {return false;' chrome/toolkit/content/mozapps/extensions/aboutaddonsCommon.js
|
||||||
|
replace_line 'pref\("extensions.htmlaboutaddons.recommendations.enabled".+' 'pref("extensions.htmlaboutaddons.recommendations.enabled", false);' greprefs.js
|
||||||
|
|
||||||
|
# Hide Report option
|
||||||
|
replace_line 'pref\("extensions.abuseReport.enabled".+' 'pref("extensions.abuseReport.enabled", false);' greprefs.js
|
||||||
|
|
||||||
|
# The first displayed Services.prompt dialog's size jumps around because sizeToContent() is called twice
|
||||||
|
# Fix by preventing the first sizeToContent() call if the icon hasn't been loaded yet
|
||||||
|
replace_line 'window.sizeToContent\(\);' 'if (ui.infoIcon.complete) window.sizeToContent();' chrome/toolkit/content/global/commonDialog.js
|
||||||
|
replace_line 'ui.infoIcon.addEventListener' 'if (!ui.infoIcon.complete) ui.infoIcon.addEventListener' chrome/toolkit/content/global/commonDialog.js
|
||||||
|
|
||||||
|
# Import style into built-in dialogs
|
||||||
|
replace_line 'id=\"commonDialogWindow\"' \
|
||||||
|
'id=\"commonDialogWindow\" class=\"zotero-dialog\" drawintitlebar-platforms=\"mac\"' \
|
||||||
|
chrome/toolkit/content/global/commonDialog.xhtml
|
||||||
|
replace_line '<\?xml-stylesheet href=\"chrome:\/\/global\/skin\/commonDialog.css\" type=\"text\/css\"\?>' \
|
||||||
|
'<\?xml-stylesheet href=\"chrome:\/\/global\/skin\/commonDialog.css\" type=\"text\/css\"\?>
|
||||||
|
<\?xml-stylesheet href=\"chrome:\/\/zotero-platform\/content\/zotero.css\" type=\"text\/css\"\?>' \
|
||||||
|
chrome/toolkit/content/global/commonDialog.xhtml
|
||||||
|
# commonDialog.xhtml can be opened via Services.prompt in the Profile Manager, so check for a profile first
|
||||||
|
replace_line '<script>' \
|
||||||
|
'<script>
|
||||||
|
try {
|
||||||
|
Services.dirsvc.get(\"ProfD\", Ci.nsIFile);
|
||||||
|
Services.scriptloader.loadSubScript(\"chrome:\/\/zotero\/content\/include.js\", this);
|
||||||
|
Services.scriptloader.loadSubScript(\"chrome:\/\/zotero\/content\/titlebar.js\", this);
|
||||||
|
Services.scriptloader.loadSubScript(\"chrome:\/\/zotero\/content\/customElements.js\", this);
|
||||||
|
} catch (e) {}' \
|
||||||
|
chrome/toolkit/content/global/commonDialog.xhtml
|
||||||
|
|
||||||
|
# Use native checkbox instead of Firefox-themed version in prompt dialogs
|
||||||
|
replace_line '<xul:checkbox' '<xul:checkbox native=\"true\"' chrome/toolkit/content/global/commonDialog.xhtml
|
||||||
|
|
||||||
|
# The <browser> CE appends its autoscroll <popup> to document.documentElement, which doesn't work in zoteroPane.xhtml
|
||||||
|
# (in Firefox browser.xhtml, document.documentElement is <html>, which can contain <popup>s; in zoteroPane.xhtml, it's
|
||||||
|
# <window>, which can't)
|
||||||
|
# Fix by appending it to a <popupset> instead
|
||||||
|
replace_line 'document.documentElement.appendChild\(this._autoScrollPopup\);' 'let popupset = document.querySelector("popupset");
|
||||||
|
if (!popupset) {
|
||||||
|
popupset = document.createXULElement("popupset");
|
||||||
|
document.documentElement.appendChild(popupset);
|
||||||
|
}
|
||||||
|
popupset.appendChild(this._autoScrollPopup);' chrome/toolkit/content/global/elements/browser-custom-element.js
|
||||||
|
|
||||||
|
# Show Services menu on input fields
|
||||||
|
# (JS part of https://hg.mozilla.org/mozilla-central/rev/defc298879844981e7c1817f13e3fc2caf84f148 for input boxes)
|
||||||
|
replace_line '<menupopup class="textbox-contextmenu">' '<menupopup class="textbox-contextmenu" showservicesmenu="true">' chrome/toolkit/content/global/elements/moz-input-box.js
|
||||||
|
|
||||||
|
zip -qr9XD omni.ja *
|
||||||
|
mv omni.ja ..
|
||||||
|
cd ..
|
||||||
|
python3 "$APP_ROOT_DIR/scripts/optimizejars.py" --optimize ./ ./ ./
|
||||||
|
rm -rf omni
|
||||||
|
|
||||||
|
# Unzip browser/omni.ja and leave unzipped
|
||||||
|
cd browser
|
||||||
|
mkdir omni
|
||||||
|
mv omni.ja omni
|
||||||
|
cd omni
|
||||||
|
ls -la
|
||||||
|
set +e
|
||||||
|
unzip omni.ja
|
||||||
|
set -e
|
||||||
|
rm omni.ja
|
||||||
|
|
||||||
|
# Remove Firefox update URLs
|
||||||
|
remove_line 'pref\("app.update.url.(manual|details)' defaults/preferences/firefox-branding.js
|
||||||
|
|
||||||
|
# Remove Firefox overrides (e.g., to use Firefox-specific strings for connection errors)
|
||||||
|
remove_line '(override)' chrome/chrome.manifest
|
||||||
|
|
||||||
|
# Remove WebExtension APIs
|
||||||
|
remove_line ext-browser.json components/components.manifest
|
||||||
|
|
||||||
|
# Don't open a second window if app is already open when launching .exe (Windows) or running via
|
||||||
|
# command line (macOS)
|
||||||
|
replace_line 'function dch_handle\(cmdLine\) \{' 'function dch_handle(cmdLine) {
|
||||||
|
if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO) { return; }
|
||||||
|
' modules/BrowserContentHandler.sys.mjs
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir -p xulrunner
|
||||||
|
cd xulrunner
|
||||||
|
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
GECKO_VERSION="$GECKO_VERSION_MAC"
|
||||||
|
DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION"
|
||||||
|
rm -rf Firefox.app
|
||||||
|
|
||||||
|
if [ -e "Firefox $GECKO_VERSION.app.zip" ]; then
|
||||||
|
echo "Using Firefox $GECKO_VERSION.app.zip"
|
||||||
|
unzip "Firefox $GECKO_VERSION.app.zip"
|
||||||
|
else
|
||||||
|
curl -o Firefox.dmg "$DOWNLOAD_URL/mac/en-US/Firefox%20$GECKO_VERSION.dmg"
|
||||||
|
set +e
|
||||||
|
hdiutil detach -quiet /Volumes/Firefox 2>/dev/null
|
||||||
|
set -e
|
||||||
|
hdiutil attach -quiet Firefox.dmg
|
||||||
|
cp -a /Volumes/Firefox/Firefox.app .
|
||||||
|
hdiutil detach -quiet /Volumes/Firefox
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download custom components (e.g., XUL), as an xz-compressed tarball of the MacOS folder with
|
||||||
|
# custom files in it
|
||||||
|
echo
|
||||||
|
rm -rf MacOS
|
||||||
|
if [ -n "$custom_components_hash_mac" ]; then
|
||||||
|
if [ -e "Firefox $GECKO_VERSION MacOS.zip" ]; then
|
||||||
|
echo "Using Firefox $GECKO_VERSION MacOS.zip"
|
||||||
|
unzip "Firefox $GECKO_VERSION MacOS.zip"
|
||||||
|
else
|
||||||
|
echo "Downloading custom Firefox components"
|
||||||
|
echo
|
||||||
|
curl -o MacOS.tar.xz "${custom_components_url}mac/$custom_components_hash_mac.tar.xz"
|
||||||
|
|
||||||
|
# Verify hash
|
||||||
|
if [[ "`uname`" = "Darwin" ]]; then
|
||||||
|
shasum=shasum
|
||||||
|
else
|
||||||
|
shasum=sha256sum
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "$custom_components_hash_mac MacOS.tar.xz" | $shasum -c -
|
||||||
|
echo
|
||||||
|
|
||||||
|
tar xvf MacOS.tar.xz
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd Firefox.app/Contents/Resources
|
||||||
|
modify_omni mac
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Replace "FirefoxCP" with "ZoteroCP" for subprocesses ("Isolated Web Content", "Socket Process", "Web Content", etc.)
|
||||||
|
info_plist=Firefox.app/Contents/MacOS/plugin-container.app/Contents/Resources/English.lproj/InfoPlist.strings
|
||||||
|
from=$(get_utf16_chars "FirefoxCP")
|
||||||
|
to=$(get_utf16_chars "ZoteroCP")
|
||||||
|
perl -pi -e "s/$from/$to/" $info_plist
|
||||||
|
# Check for UTF-16 "ZoteroCP"
|
||||||
|
if ! grep -a -q "Z.o.t.e.r.o.C.P." $info_plist; then
|
||||||
|
echo '"ZoteroCP" not found in InfoPlist.strings after replacement'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "Firefox $GECKO_VERSION.app.zip" ]; then
|
||||||
|
rm "Firefox.dmg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#if [ ! -e "Firefox $GECKO_VERSION MacOS.zip" ]; then
|
||||||
|
# rm "MacOS.zip"
|
||||||
|
#fi
|
||||||
|
echo $("$SCRIPT_DIR/xulrunner_hash" -p m) > hash-mac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $BUILD_WIN == 1 ]; then
|
||||||
|
GECKO_VERSION="$GECKO_VERSION_WIN"
|
||||||
|
DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION"
|
||||||
|
|
||||||
|
for arch in win32 win-x64 win-arm64; do
|
||||||
|
xdir=firefox-$arch
|
||||||
|
|
||||||
|
rm -rf $xdir
|
||||||
|
mkdir $xdir
|
||||||
|
|
||||||
|
if [ -e "Firefox Setup $GECKO_VERSION-$arch.exe" ]; then
|
||||||
|
echo "Using Firefox Setup $GECKO_VERSION-$arch.exe"
|
||||||
|
cp "Firefox Setup $GECKO_VERSION-$arch.exe" "Firefox%20Setup%20$GECKO_VERSION.exe"
|
||||||
|
else
|
||||||
|
if [ $arch = "win-x64" ]; then
|
||||||
|
curl -O "$DOWNLOAD_URL/win64/en-US/Firefox%20Setup%20$GECKO_VERSION.exe"
|
||||||
|
elif [ $arch = "win-arm64" ]; then
|
||||||
|
curl -O "$DOWNLOAD_URL/win64-aarch64/en-US/Firefox%20Setup%20$GECKO_VERSION.exe"
|
||||||
|
else
|
||||||
|
curl -O "$DOWNLOAD_URL/$arch/en-US/Firefox%20Setup%20$GECKO_VERSION.exe"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
7z x Firefox%20Setup%20$GECKO_VERSION.exe -o$xdir 'core/*'
|
||||||
|
mv $xdir/core $xdir-core
|
||||||
|
rm -rf $xdir
|
||||||
|
mv $xdir-core $xdir
|
||||||
|
|
||||||
|
pushd $xdir
|
||||||
|
|
||||||
|
# Replace "Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38" with "Zotero" for C:\ProgramData directory
|
||||||
|
#
|
||||||
|
# Mozilla uses a UUID in the path because they previously used just "Mozilla" and needed to
|
||||||
|
# recreate the folder with correct permissions for security reasons, but we never had a folder in
|
||||||
|
# ProgramData, so we can just create it as "Zotero". Instead of using a custom xul.dll, just
|
||||||
|
# replace the hard-coded string with "Zotero" and add a bunch of NULs.
|
||||||
|
from=$(get_utf16_chars "Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38")
|
||||||
|
to=$(get_utf16_chars "Zotero" 38)
|
||||||
|
perl -pe "s/$from/$to/" < xul.dll > xul.dll.new
|
||||||
|
mv xul.dll.new xul.dll
|
||||||
|
|
||||||
|
# Check for UTF-16 "Zotero" in DLL
|
||||||
|
#
|
||||||
|
# (The macOS strings command doesn't have an encoding option, so skip on macOS. We could
|
||||||
|
# require binutils, which has GNU strings, but you need to build on Windows to make an
|
||||||
|
# installer, so a Windows build from macOS likely isn't being deployed, and there's no
|
||||||
|
# reason the Perl command above should fail anyway.)
|
||||||
|
if [[ "`uname`" != "Darwin" ]] && [[ -z "$(strings -e l xul.dll | grep -m 1 Zotero)" ]]; then
|
||||||
|
echo '"Zotero" not found in xul.dll after replacement'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
modify_omni $arch
|
||||||
|
# Disable skeleton UI window
|
||||||
|
# https://forums.zotero.org/discussion/comment/437636/#Comment_437636
|
||||||
|
replace_line 'pref\("browser\.startup\.preXulSkeletonUI", true\);' 'pref("browser.startup.preXulSkeletonUI", false);' defaults/preferences/firefox.js
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Uncomment to create local copies for reuse
|
||||||
|
#cp "Firefox%20Setup%20$GECKO_VERSION.exe" "Firefox Setup $GECKO_VERSION-$arch.exe"
|
||||||
|
rm "Firefox%20Setup%20$GECKO_VERSION.exe"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
echo $("$SCRIPT_DIR/xulrunner_hash" -p w) > hash-win
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $BUILD_LINUX == 1 ]; then
|
||||||
|
GECKO_VERSION="$GECKO_VERSION_LINUX"
|
||||||
|
DOWNLOAD_URL="https://ftp.mozilla.org/pub/firefox/releases/$GECKO_VERSION"
|
||||||
|
|
||||||
|
|
||||||
|
# Include 32-bit build if not in CI
|
||||||
|
if [[ "${CI:-}" = "1" ]] || [[ "${SKIP_32:-}" = "1" ]]; then
|
||||||
|
arches="x86_64"
|
||||||
|
else
|
||||||
|
arches="i686 x86_64"
|
||||||
|
fi
|
||||||
|
for arch in $arches; do
|
||||||
|
xdir="firefox-$arch"
|
||||||
|
rm -rf $xdir
|
||||||
|
|
||||||
|
archived_file="firefox-$GECKO_VERSION-$arch.tar.bz2"
|
||||||
|
if [ -e "$archived_file" ]; then
|
||||||
|
echo "Using $archived_file"
|
||||||
|
cp "$archived_file" "firefox-$GECKO_VERSION.tar.bz2"
|
||||||
|
else
|
||||||
|
curl -O "$DOWNLOAD_URL/linux-$arch/en-US/firefox-$GECKO_VERSION.tar.bz2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
tar xvf firefox-$GECKO_VERSION.tar.bz2
|
||||||
|
mv firefox firefox-$arch
|
||||||
|
|
||||||
|
pushd firefox-$arch
|
||||||
|
modify_omni $arch
|
||||||
|
popd
|
||||||
|
echo $($SCRIPT_DIR/xulrunner_hash -p l) > hash-linux
|
||||||
|
rm "firefox-$GECKO_VERSION.tar.bz2"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo Done
|
21
app/scripts/get_commit_files
Executable file
21
app/scripts/get_commit_files
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
if [ -z "${1:-}" ]; then
|
||||||
|
echo "Commit hash not provided"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
hash="$1"
|
||||||
|
|
||||||
|
tmpdir=`mktemp -d`
|
||||||
|
|
||||||
|
cd $tmpdir
|
||||||
|
wget -O build.zip "https://$S3_BUCKET.s3.amazonaws.com/$S3_CI_ZIP_PATH/$hash.zip" >&2 \
|
||||||
|
|| (echo "ZIP file not found for commit '$hash'" && exit 1)
|
||||||
|
unzip build.zip >&2
|
||||||
|
rm build.zip
|
||||||
|
echo $tmpdir
|
14
app/scripts/get_repo_branch_hash
Executable file
14
app/scripts/get_repo_branch_hash
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
if [ -z "${1:-}" ]; then
|
||||||
|
echo "Usage: $0 branch"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
branch=$1
|
||||||
|
|
||||||
|
git ls-remote --exit-code $SOURCE_REPO_URL $branch | cut -f 1
|
91
app/scripts/manage_incrementals
Executable file
91
app/scripts/manage_incrementals
Executable file
|
@ -0,0 +1,91 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Manage list of deployed version numbers for a channel in order to generate incremental builds
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat >&2 <<DONE
|
||||||
|
Usage:
|
||||||
|
-c CHANNEL Release channel (e.g., 'beta'); defaults to 'release'
|
||||||
|
-p PLATFORM Platform (m=Mac, w=Windows, l=Linux)
|
||||||
|
-a VERSION Add version to incrementals list; cannot be used with -n
|
||||||
|
-n NUM_VERSIONS Number of previous versions to return; cannot be used with -a
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
CHANNEL="release"
|
||||||
|
PLATFORM=""
|
||||||
|
VERSION=""
|
||||||
|
NUM_VERSIONS=""
|
||||||
|
while getopts "c:p:a:n:" opt; do
|
||||||
|
case $opt in
|
||||||
|
c)
|
||||||
|
CHANNEL="$OPTARG"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
case "$OPTARG" in
|
||||||
|
m) PLATFORM=mac;;
|
||||||
|
w) PLATFORM=win;;
|
||||||
|
l) PLATFORM=linux;;
|
||||||
|
*)
|
||||||
|
echo "$0: Invalid platform option $OPTARG"
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
a)
|
||||||
|
VERSION="$OPTARG"
|
||||||
|
;;
|
||||||
|
n)
|
||||||
|
NUM_VERSIONS="$OPTARG"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift $((OPTIND-1)); OPTIND=1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$PLATFORM" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$VERSION" ]] && [[ -z "$NUM_VERSIONS" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$VERSION" ]] && [[ "$NUM_VERSIONS" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
INCR_FILENAME="incrementals-$CHANNEL-$PLATFORM"
|
||||||
|
S3_URL="s3://$S3_BUCKET/$S3_DIST_PATH/$CHANNEL/incrementals-$PLATFORM"
|
||||||
|
INCR_PATH="$DIST_DIR/$INCR_FILENAME"
|
||||||
|
|
||||||
|
if [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
INCR_PATH=$(cygpath -w "$INCR_PATH")
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$DIST_DIR"
|
||||||
|
aws s3 cp $S3_URL "$INCR_PATH" >&2
|
||||||
|
|
||||||
|
# Add version to file and reupload
|
||||||
|
if [ "$VERSION" ]; then
|
||||||
|
echo "Adding $VERSION to incrementals-$PLATFORM"
|
||||||
|
echo $VERSION >> "$INCR_PATH"
|
||||||
|
aws s3 cp "$INCR_PATH" $S3_URL
|
||||||
|
# Show last n versions
|
||||||
|
elif [ "$NUM_VERSIONS" -gt 0 ]; then
|
||||||
|
# TEMP: Don't include 6.0 versions
|
||||||
|
#tail -n $NUM_VERSIONS "$INCR_PATH"
|
||||||
|
set +e
|
||||||
|
tail -n $NUM_VERSIONS "$INCR_PATH" | grep -v '^6\.0'
|
||||||
|
set -e
|
||||||
|
fi
|
||||||
|
rm "$INCR_PATH"
|
19
app/scripts/notarization_info
Executable file
19
app/scripts/notarization_info
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "Usage: $0 id"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
id=${1:-}
|
||||||
|
if [[ -z "$id" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
xcrun notarytool log "$id" --apple-id "$NOTARIZATION_USER" --team-id "$NOTARIZATION_TEAM_ID" --password "$NOTARIZATION_PASSWORD" notary_log.json
|
||||||
|
cat notary_log.json
|
19
app/scripts/notarization_stapler
Executable file
19
app/scripts/notarization_stapler
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "Usage: $0 file"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
file=${1:-}
|
||||||
|
if [[ -z "$file" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Stapling $file"
|
||||||
|
xcrun stapler staple $file
|
19
app/scripts/notarize_mac_app
Executable file
19
app/scripts/notarize_mac_app
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "Usage: $0 file"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
file=${1:-}
|
||||||
|
if [[ -z "$file" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Uploading ${file##*/} to Apple for notarization" >&2
|
||||||
|
xcrun notarytool submit $file --apple-id "$NOTARIZATION_USER" --team-id "$NOTARIZATION_TEAM_ID" --password="$NOTARIZATION_PASSWORD" --wait
|
376
app/scripts/optimizejars.py
Normal file
376
app/scripts/optimizejars.py
Normal file
|
@ -0,0 +1,376 @@
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
#
|
||||||
|
# The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
# the License. You may obtain a copy of the License at
|
||||||
|
# http://www.mozilla.org/MPL/
|
||||||
|
#
|
||||||
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
# for the specific language governing rights and limitations under the
|
||||||
|
# License.
|
||||||
|
#
|
||||||
|
# The Original Code is mozilla.org code
|
||||||
|
#
|
||||||
|
# The Initial Developer of the Original Code is
|
||||||
|
# Mozilla Foundation.
|
||||||
|
# Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
# the Initial Developer. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Contributor(s):
|
||||||
|
# Taras Glek <tglek@mozilla.com>
|
||||||
|
#
|
||||||
|
# Alternatively, the contents of this file may be used under the terms of
|
||||||
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
# of those above. If you wish to allow use of your version of this file only
|
||||||
|
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
# use your version of this file under the terms of the MPL, indicate your
|
||||||
|
# decision by deleting the provisions above and replace them with the notice
|
||||||
|
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
# the provisions above, a recipient may use your version of this file under
|
||||||
|
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
|
import sys, os, subprocess, struct, re
|
||||||
|
|
||||||
|
local_file_header = [
|
||||||
|
("signature", "uint32"),
|
||||||
|
("min_version", "uint16"),
|
||||||
|
("general_flag", "uint16"),
|
||||||
|
("compression", "uint16"),
|
||||||
|
("lastmod_time", "uint16"),
|
||||||
|
("lastmod_date", "uint16"),
|
||||||
|
("crc32", "uint32"),
|
||||||
|
("compressed_size", "uint32"),
|
||||||
|
("uncompressed_size", "uint32"),
|
||||||
|
("filename_size", "uint16"),
|
||||||
|
("extra_field_size", "uint16"),
|
||||||
|
("filename", "filename_size"),
|
||||||
|
("extra_field", "extra_field_size"),
|
||||||
|
("data", "compressed_size")
|
||||||
|
]
|
||||||
|
|
||||||
|
cdir_entry = [
|
||||||
|
("signature", "uint32"),
|
||||||
|
("creator_version", "uint16"),
|
||||||
|
("min_version", "uint16"),
|
||||||
|
("general_flag", "uint16"),
|
||||||
|
("compression", "uint16"),
|
||||||
|
("lastmod_time", "uint16"),
|
||||||
|
("lastmod_date", "uint16"),
|
||||||
|
("crc32", "uint32"),
|
||||||
|
("compressed_size", "uint32"),
|
||||||
|
("uncompressed_size", "uint32"),
|
||||||
|
("filename_size", "uint16"),
|
||||||
|
("extrafield_size", "uint16"),
|
||||||
|
("filecomment_size", "uint16"),
|
||||||
|
("disknum", "uint16"),
|
||||||
|
("internal_attr", "uint16"),
|
||||||
|
("external_attr", "uint32"),
|
||||||
|
("offset", "uint32"),
|
||||||
|
("filename", "filename_size"),
|
||||||
|
("extrafield", "extrafield_size"),
|
||||||
|
("filecomment", "filecomment_size"),
|
||||||
|
]
|
||||||
|
|
||||||
|
cdir_end = [
|
||||||
|
("signature", "uint32"),
|
||||||
|
("disk_num", "uint16"),
|
||||||
|
("cdir_disk", "uint16"),
|
||||||
|
("disk_entries", "uint16"),
|
||||||
|
("cdir_entries", "uint16"),
|
||||||
|
("cdir_size", "uint32"),
|
||||||
|
("cdir_offset", "uint32"),
|
||||||
|
("comment_size", "uint16"),
|
||||||
|
]
|
||||||
|
|
||||||
|
type_mapping = { "uint32":"I", "uint16":"H"}
|
||||||
|
|
||||||
|
def format_struct (format):
|
||||||
|
string_fields = {}
|
||||||
|
fmt = "<"
|
||||||
|
for (name,value) in iter(format):
|
||||||
|
try:
|
||||||
|
fmt += type_mapping[value][0]
|
||||||
|
except KeyError:
|
||||||
|
string_fields[name] = value
|
||||||
|
return (fmt, string_fields)
|
||||||
|
|
||||||
|
def size_of(format):
|
||||||
|
return struct.calcsize(format_struct(format)[0])
|
||||||
|
|
||||||
|
class MyStruct:
|
||||||
|
def __init__(self, format, string_fields):
|
||||||
|
self.__dict__["struct_members"] = {}
|
||||||
|
self.__dict__["format"] = format
|
||||||
|
self.__dict__["string_fields"] = string_fields
|
||||||
|
|
||||||
|
def addMember(self, name, value):
|
||||||
|
self.__dict__["struct_members"][name] = value
|
||||||
|
|
||||||
|
def __getattr__(self, item):
|
||||||
|
try:
|
||||||
|
return self.__dict__["struct_members"][item]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
print("no %s" %item)
|
||||||
|
print(self.__dict__["struct_members"])
|
||||||
|
raise AttributeError
|
||||||
|
|
||||||
|
def __setattr__(self, item, value):
|
||||||
|
if item in self.__dict__["struct_members"]:
|
||||||
|
self.__dict__["struct_members"][item] = value
|
||||||
|
else:
|
||||||
|
raise AttributeError
|
||||||
|
|
||||||
|
def pack(self):
|
||||||
|
extra_data = b""
|
||||||
|
values = []
|
||||||
|
string_fields = self.__dict__["string_fields"]
|
||||||
|
struct_members = self.__dict__["struct_members"]
|
||||||
|
format = self.__dict__["format"]
|
||||||
|
for (name,_) in format:
|
||||||
|
if name in string_fields:
|
||||||
|
if not isinstance(struct_members[name], bytes):
|
||||||
|
struct_members[name] = struct_members[name].encode('utf-8')
|
||||||
|
extra_data = extra_data + struct_members[name]
|
||||||
|
else:
|
||||||
|
values.append(struct_members[name]);
|
||||||
|
return struct.pack(format_struct(format)[0], *values) + extra_data
|
||||||
|
|
||||||
|
ENDSIG = 0x06054b50
|
||||||
|
|
||||||
|
def assert_true(cond, msg):
|
||||||
|
if not cond:
|
||||||
|
raise Exception(msg)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
class BinaryBlob:
|
||||||
|
def __init__(self, f):
|
||||||
|
self.data = open(f, "rb").read()
|
||||||
|
self.offset = 0
|
||||||
|
self.length = len(self.data)
|
||||||
|
|
||||||
|
def readAt(self, pos, length):
|
||||||
|
self.offset = pos + length
|
||||||
|
return self.data[pos:self.offset]
|
||||||
|
|
||||||
|
def read_struct (self, format, offset = None):
|
||||||
|
if offset == None:
|
||||||
|
offset = self.offset
|
||||||
|
(fstr, string_fields) = format_struct(format)
|
||||||
|
size = struct.calcsize(fstr)
|
||||||
|
data = self.readAt(offset, size)
|
||||||
|
ret = struct.unpack(fstr, data)
|
||||||
|
retstruct = MyStruct(format, string_fields)
|
||||||
|
i = 0
|
||||||
|
for (name,_) in iter(format):
|
||||||
|
member_desc = None
|
||||||
|
if not name in string_fields:
|
||||||
|
member_data = ret[i]
|
||||||
|
i = i + 1
|
||||||
|
else:
|
||||||
|
# zip has data fields which are described by other struct fields, this does
|
||||||
|
# additional reads to fill em in
|
||||||
|
member_desc = string_fields[name]
|
||||||
|
member_data = self.readAt(self.offset, retstruct.__getattr__(member_desc))
|
||||||
|
retstruct.addMember(name, member_data)
|
||||||
|
# sanity check serialization code
|
||||||
|
data = self.readAt(offset, self.offset - offset)
|
||||||
|
out_data = retstruct.pack()
|
||||||
|
assert_true(out_data == data, "Serialization fail %d !=%d"% (len(out_data), len(data)))
|
||||||
|
return retstruct
|
||||||
|
|
||||||
|
def optimizejar(jar, outjar, inlog = None):
|
||||||
|
if inlog is not None:
|
||||||
|
inlog = open(inlog).read().rstrip()
|
||||||
|
# in the case of an empty log still move the index forward
|
||||||
|
if len(inlog) == 0:
|
||||||
|
inlog = []
|
||||||
|
else:
|
||||||
|
inlog = inlog.split("\n")
|
||||||
|
outlog = []
|
||||||
|
jarblob = BinaryBlob(jar)
|
||||||
|
dirend = jarblob.read_struct(cdir_end, jarblob.length - size_of(cdir_end))
|
||||||
|
assert_true(dirend.signature == ENDSIG, "no signature in the end");
|
||||||
|
cdir_offset = dirend.cdir_offset
|
||||||
|
readahead = 0
|
||||||
|
if inlog is None and cdir_offset == 4:
|
||||||
|
readahead = struct.unpack("<I", jarblob.readAt(0, 4))[0]
|
||||||
|
print("%s: startup data ends at byte %d" % (outjar, readahead));
|
||||||
|
|
||||||
|
total_stripped = 0;
|
||||||
|
jarblob.offset = cdir_offset
|
||||||
|
central_directory = []
|
||||||
|
for i in range(0, dirend.cdir_entries):
|
||||||
|
entry = jarblob.read_struct(cdir_entry)
|
||||||
|
if entry.filename[-1:] == "/":
|
||||||
|
total_stripped += len(entry.pack())
|
||||||
|
else:
|
||||||
|
total_stripped += entry.extrafield_size
|
||||||
|
central_directory.append(entry)
|
||||||
|
|
||||||
|
reordered_count = 0
|
||||||
|
if inlog is not None:
|
||||||
|
dup_guard = set()
|
||||||
|
for ordered_name in inlog:
|
||||||
|
if ordered_name in dup_guard:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
dup_guard.add(ordered_name)
|
||||||
|
found = False
|
||||||
|
for i in range(reordered_count, len(central_directory)):
|
||||||
|
if central_directory[i].filename == ordered_name:
|
||||||
|
# swap the cdir entries
|
||||||
|
tmp = central_directory[i]
|
||||||
|
central_directory[i] = central_directory[reordered_count]
|
||||||
|
central_directory[reordered_count] = tmp
|
||||||
|
reordered_count = reordered_count + 1
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
if not found:
|
||||||
|
print( "Can't find '%s' in %s" % (ordered_name, jar))
|
||||||
|
|
||||||
|
outfd = open(outjar, "wb")
|
||||||
|
out_offset = 0
|
||||||
|
if inlog is not None:
|
||||||
|
# have to put central directory at offset 4 cos 0 confuses some tools.
|
||||||
|
# This also lets us specify how many entries should be preread
|
||||||
|
dirend.cdir_offset = 4
|
||||||
|
# make room for central dir + end of dir + 4 extra bytes at front
|
||||||
|
out_offset = dirend.cdir_offset + dirend.cdir_size + size_of(cdir_end) - total_stripped
|
||||||
|
outfd.seek(out_offset)
|
||||||
|
|
||||||
|
cdir_data = b""
|
||||||
|
written_count = 0
|
||||||
|
crc_mapping = {}
|
||||||
|
dups_found = 0
|
||||||
|
dupe_bytes = 0
|
||||||
|
# store number of bytes suggested for readahead
|
||||||
|
for entry in central_directory:
|
||||||
|
# read in the header twice..first for comparison, second time for convenience when writing out
|
||||||
|
jarfile = jarblob.read_struct(local_file_header, entry.offset)
|
||||||
|
assert_true(jarfile.filename == entry.filename, "Directory/Localheader mismatch")
|
||||||
|
# drop directory entries
|
||||||
|
if entry.filename[-1:] == "/":
|
||||||
|
total_stripped += len(jarfile.pack())
|
||||||
|
dirend.cdir_entries -= 1
|
||||||
|
continue
|
||||||
|
# drop extra field data
|
||||||
|
else:
|
||||||
|
total_stripped += jarfile.extra_field_size;
|
||||||
|
entry.extrafield = jarfile.extra_field = ""
|
||||||
|
entry.extrafield_size = jarfile.extra_field_size = 0
|
||||||
|
# January 1st, 2010
|
||||||
|
entry.lastmod_date = jarfile.lastmod_date = ((2010 - 1980) << 9) | (1 << 5) | 1
|
||||||
|
entry.lastmod_time = jarfile.lastmod_time = 0
|
||||||
|
data = jarfile.pack()
|
||||||
|
outfd.write(data)
|
||||||
|
old_entry_offset = entry.offset
|
||||||
|
entry.offset = out_offset
|
||||||
|
out_offset = out_offset + len(data)
|
||||||
|
entry_data = entry.pack()
|
||||||
|
cdir_data += entry_data
|
||||||
|
expected_len = entry.filename_size + entry.extrafield_size + entry.filecomment_size
|
||||||
|
assert_true(len(entry_data) != expected_len,
|
||||||
|
"%s entry size - expected:%d got:%d" % (entry.filename, len(entry_data), expected_len))
|
||||||
|
written_count += 1
|
||||||
|
|
||||||
|
if entry.crc32 in crc_mapping:
|
||||||
|
dups_found += 1
|
||||||
|
dupe_bytes += entry.compressed_size + len(data) + len(entry_data)
|
||||||
|
print("%s\n\tis a duplicate of\n%s\n---"%(entry.filename, crc_mapping[entry.crc32]))
|
||||||
|
else:
|
||||||
|
crc_mapping[entry.crc32] = entry.filename;
|
||||||
|
|
||||||
|
if inlog is not None:
|
||||||
|
if written_count == reordered_count:
|
||||||
|
readahead = out_offset
|
||||||
|
print("%s: startup data ends at byte %d"%( outjar, readahead));
|
||||||
|
elif written_count < reordered_count:
|
||||||
|
pass
|
||||||
|
#print("%s @ %d" % (entry.filename, out_offset))
|
||||||
|
elif readahead >= old_entry_offset + len(data):
|
||||||
|
outlog.append(entry.filename)
|
||||||
|
reordered_count += 1
|
||||||
|
|
||||||
|
if inlog is None:
|
||||||
|
dirend.cdir_offset = out_offset
|
||||||
|
|
||||||
|
if dups_found > 0:
|
||||||
|
print("WARNING: Found %d duplicate files taking %d bytes"%(dups_found, dupe_bytes))
|
||||||
|
|
||||||
|
dirend.cdir_size = len(cdir_data)
|
||||||
|
dirend.disk_entries = dirend.cdir_entries
|
||||||
|
dirend_data = dirend.pack()
|
||||||
|
assert_true(size_of(cdir_end) == len(dirend_data), "Failed to serialize directory end correctly. Serialized size;%d, expected:%d"%(len(dirend_data), size_of(cdir_end)));
|
||||||
|
|
||||||
|
outfd.seek(dirend.cdir_offset)
|
||||||
|
outfd.write(cdir_data)
|
||||||
|
outfd.write(dirend_data)
|
||||||
|
|
||||||
|
# for ordered jars the central directory is written in the begining of the file, so a second central-directory
|
||||||
|
# entry has to be written in the end of the file
|
||||||
|
if inlog is not None:
|
||||||
|
outfd.seek(0)
|
||||||
|
outfd.write(struct.pack("<I", readahead));
|
||||||
|
outfd.seek(out_offset)
|
||||||
|
outfd.write(dirend_data)
|
||||||
|
|
||||||
|
print("Stripped %d bytes" % total_stripped)
|
||||||
|
print("%s %d/%d in %s" % (("Ordered" if inlog is not None else "Deoptimized"),
|
||||||
|
reordered_count, len(central_directory), outjar))
|
||||||
|
outfd.close()
|
||||||
|
return outlog
|
||||||
|
|
||||||
|
if len(sys.argv) != 5:
|
||||||
|
print("Usage: --optimize|--deoptimize %s JAR_LOG_DIR IN_JAR_DIR OUT_JAR_DIR" % sys.argv[0])
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
jar_regex = re.compile("\\.jar?$")
|
||||||
|
|
||||||
|
def optimize(JAR_LOG_DIR, IN_JAR_DIR, OUT_JAR_DIR):
|
||||||
|
ls = os.listdir(IN_JAR_DIR)
|
||||||
|
for jarfile in ls:
|
||||||
|
if not re.search(jar_regex, jarfile):
|
||||||
|
continue
|
||||||
|
injarfile = os.path.join(IN_JAR_DIR, jarfile)
|
||||||
|
outjarfile = os.path.join(OUT_JAR_DIR, jarfile)
|
||||||
|
logfile = os.path.join(JAR_LOG_DIR, jarfile + ".log")
|
||||||
|
if not os.path.isfile(logfile):
|
||||||
|
logfile = None
|
||||||
|
optimizejar(injarfile, outjarfile, logfile)
|
||||||
|
|
||||||
|
def deoptimize(JAR_LOG_DIR, IN_JAR_DIR, OUT_JAR_DIR):
|
||||||
|
if not os.path.exists(JAR_LOG_DIR):
|
||||||
|
os.makedirs(JAR_LOG_DIR)
|
||||||
|
|
||||||
|
ls = os.listdir(IN_JAR_DIR)
|
||||||
|
for jarfile in ls:
|
||||||
|
if not re.search(jar_regex, jarfile):
|
||||||
|
continue
|
||||||
|
injarfile = os.path.join(IN_JAR_DIR, jarfile)
|
||||||
|
outjarfile = os.path.join(OUT_JAR_DIR, jarfile)
|
||||||
|
logfile = os.path.join(JAR_LOG_DIR, jarfile + ".log")
|
||||||
|
log = str(optimizejar(injarfile, outjarfile, None))
|
||||||
|
open(logfile, "wb").write("\n".join(log).encode('utf-8'))
|
||||||
|
|
||||||
|
def main():
|
||||||
|
MODE = sys.argv[1]
|
||||||
|
JAR_LOG_DIR = sys.argv[2]
|
||||||
|
IN_JAR_DIR = sys.argv[3]
|
||||||
|
OUT_JAR_DIR = sys.argv[4]
|
||||||
|
if MODE == "--optimize":
|
||||||
|
optimize(JAR_LOG_DIR, IN_JAR_DIR, OUT_JAR_DIR)
|
||||||
|
elif MODE == "--deoptimize":
|
||||||
|
deoptimize(JAR_LOG_DIR, IN_JAR_DIR, OUT_JAR_DIR)
|
||||||
|
else:
|
||||||
|
print("Unknown mode %s" % MODE)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
210
app/scripts/prepare_build
Executable file
210
app/scripts/prepare_build
Executable file
|
@ -0,0 +1,210 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
import tempfile
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import re
|
||||||
|
import fileinput
|
||||||
|
from collections import OrderedDict
|
||||||
|
import json
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
# Hack to combine two argparse formatters
|
||||||
|
class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter):
|
||||||
|
pass
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='Prepare build/ files for the app build process',
|
||||||
|
formatter_class=CustomFormatter)
|
||||||
|
|
||||||
|
parser.add_argument('--source-dir', '-s', required=True, metavar='BUILD_DIR', help='Directory to build from')
|
||||||
|
parser.add_argument('--output-dir', '-o', required=True, metavar='OUTPUT_DIR', help='Directory to write files to')
|
||||||
|
parser.add_argument('-c', '--channel', default='source', help='channel to add to dev build version number (e.g., "beta" for "5.0-beta.3+a5f28ca8"), or "release" or "source" to skip')
|
||||||
|
parser.add_argument('--commit-hash', '-m', metavar='HASH', help='Commit hash (required for non-release builds)')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
app_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
|
||||||
|
lastrev_dir = os.path.join(app_root_dir, 'lastrev')
|
||||||
|
if not os.path.exists(lastrev_dir):
|
||||||
|
os.mkdir(lastrev_dir)
|
||||||
|
tmp_dir = os.path.join(app_root_dir, 'tmp')
|
||||||
|
|
||||||
|
if args.commit_hash:
|
||||||
|
commit_hash = args.commit_hash[0:9]
|
||||||
|
elif args.channel != "release":
|
||||||
|
raise Exception("--commit-hash must be specified for non-release builds")
|
||||||
|
|
||||||
|
src_dir = args.source_dir
|
||||||
|
if not os.path.isdir(src_dir):
|
||||||
|
raise Exception(src_dir + " is not a directory")
|
||||||
|
|
||||||
|
output_dir = args.output_dir
|
||||||
|
if not os.path.isdir(output_dir):
|
||||||
|
raise Exception(output_dir + " is not a directory")
|
||||||
|
if os.listdir(output_dir):
|
||||||
|
raise Exception(output_dir + " is not empty")
|
||||||
|
|
||||||
|
log("Using source directory of " + src_dir)
|
||||||
|
os.chdir(src_dir)
|
||||||
|
|
||||||
|
if not os.path.exists('version'):
|
||||||
|
raise FileNotFoundError("version file not found in {0}".format(src_dir))
|
||||||
|
|
||||||
|
# Extract version number from version file
|
||||||
|
with open('version') as f:
|
||||||
|
rdf = f.read()
|
||||||
|
m = re.search('([0-9].+)\\.SOURCE', rdf)
|
||||||
|
if not m:
|
||||||
|
raise Exception("Version number not found in version file")
|
||||||
|
version = m.group(1)
|
||||||
|
|
||||||
|
# Remove tmp build directory if it already exists
|
||||||
|
if os.path.exists(tmp_dir):
|
||||||
|
shutil.rmtree(tmp_dir)
|
||||||
|
os.mkdir(tmp_dir)
|
||||||
|
|
||||||
|
tmp_src_dir = os.path.join(tmp_dir, 'zotero')
|
||||||
|
|
||||||
|
# Export a clean copy of the source tree
|
||||||
|
subprocess.check_call([
|
||||||
|
'rsync',
|
||||||
|
'-aL',
|
||||||
|
# Exclude hidden files
|
||||||
|
'--exclude', '.*',
|
||||||
|
'--exclude', '#*',
|
||||||
|
'--exclude', 'package.json',
|
||||||
|
'--exclude', 'package-lock.json',
|
||||||
|
'.' + os.sep,
|
||||||
|
tmp_src_dir + os.sep
|
||||||
|
])
|
||||||
|
|
||||||
|
# Make sure rsync worked
|
||||||
|
d = os.path.join(tmp_src_dir, 'chrome')
|
||||||
|
if not os.path.isdir(d):
|
||||||
|
raise FileNotFoundError(d + " not found")
|
||||||
|
|
||||||
|
# Delete CSL locale support files
|
||||||
|
subprocess.check_call([
|
||||||
|
'find',
|
||||||
|
os.path.normpath(tmp_src_dir + '/chrome/content/zotero/locale/csl/'),
|
||||||
|
'-mindepth', '1',
|
||||||
|
'!', '-name', '*.xml',
|
||||||
|
'!', '-name', 'locales.json',
|
||||||
|
#'-print',
|
||||||
|
'-delete'
|
||||||
|
])
|
||||||
|
|
||||||
|
# Delete styles build script
|
||||||
|
os.remove(os.path.join(tmp_src_dir, 'styles', 'update'))
|
||||||
|
|
||||||
|
translators_dir = os.path.join(tmp_src_dir, 'translators')
|
||||||
|
|
||||||
|
# Move deleted.txt out of translators directory
|
||||||
|
f = os.path.join(translators_dir, 'deleted.txt')
|
||||||
|
if os.path.exists(f):
|
||||||
|
shutil.move(f, tmp_src_dir)
|
||||||
|
|
||||||
|
# Build translator index
|
||||||
|
index = OrderedDict()
|
||||||
|
for fn in sorted((fn for fn in os.listdir(translators_dir)), key=str.lower):
|
||||||
|
if not fn.endswith('.js'):
|
||||||
|
continue
|
||||||
|
with open(os.path.join(translators_dir, fn), 'r', encoding='utf-8') as f:
|
||||||
|
contents = f.read()
|
||||||
|
# Parse out the JSON metadata block
|
||||||
|
m = re.match(r'^\s*{[\S\s]*?}\s*?[\r\n]', contents)
|
||||||
|
if not m:
|
||||||
|
raise Exception("Metadata block not found in " + f.name)
|
||||||
|
metadata = json.loads(m.group(0))
|
||||||
|
index[metadata["translatorID"]] = {
|
||||||
|
"fileName": fn,
|
||||||
|
"label": metadata["label"],
|
||||||
|
"lastUpdated": metadata["lastUpdated"]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Write translator index as JSON file
|
||||||
|
with open(os.path.join(tmp_src_dir, 'translators.json'), 'w', encoding='utf-8') as f:
|
||||||
|
json.dump(index, f, indent=True, ensure_ascii=False)
|
||||||
|
|
||||||
|
version_file = os.path.join(tmp_src_dir, 'version')
|
||||||
|
|
||||||
|
log('')
|
||||||
|
log_line()
|
||||||
|
log('Original version:\n')
|
||||||
|
dump_file(version_file)
|
||||||
|
|
||||||
|
# Modify version as necessary
|
||||||
|
|
||||||
|
# The dev build revision number is stored in lastrev/{version}-{channel}.
|
||||||
|
#
|
||||||
|
# If we're including it, get the current version number and increment it.
|
||||||
|
if args.channel not in ["release", "source"]:
|
||||||
|
lastrev_file = os.path.join(
|
||||||
|
lastrev_dir, '{0}-{1}'.format(version, args.channel)
|
||||||
|
)
|
||||||
|
if not os.path.exists(lastrev_file):
|
||||||
|
with open(lastrev_file, 'w') as f:
|
||||||
|
f.write("0")
|
||||||
|
rev = 1
|
||||||
|
else:
|
||||||
|
with open(lastrev_file, 'r') as f:
|
||||||
|
rev = f.read()
|
||||||
|
rev = int(rev if rev else 0) + 1
|
||||||
|
|
||||||
|
if args.channel == "release":
|
||||||
|
rev_sub_str = ""
|
||||||
|
elif args.channel == "source":
|
||||||
|
rev_sub_str = ".SOURCE.{0}".format(commit_hash)
|
||||||
|
else:
|
||||||
|
rev_sub_str = "-{0}.{1}+{2}".format(args.channel, str(rev), commit_hash)
|
||||||
|
# Update version
|
||||||
|
for line in fileinput.FileInput(version_file, inplace=1):
|
||||||
|
line = line.replace('.SOURCE', rev_sub_str)
|
||||||
|
print(line, file=sys.stdout, end='')
|
||||||
|
|
||||||
|
log('Modified version:\n')
|
||||||
|
dump_file(version_file)
|
||||||
|
log('')
|
||||||
|
log_line()
|
||||||
|
|
||||||
|
# Move source files to output directory
|
||||||
|
os.rmdir(output_dir)
|
||||||
|
shutil.move(tmp_src_dir, output_dir)
|
||||||
|
|
||||||
|
# Update lastrev file with new revision number
|
||||||
|
if args.channel not in ["release", "source"]:
|
||||||
|
with open(lastrev_file, 'w') as f:
|
||||||
|
f.write(str(rev))
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
except Exception as err:
|
||||||
|
sys.stderr.write("\n" + traceback.format_exc())
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
finally:
|
||||||
|
if 'tmp_src_dir' in locals() and os.path.exists(tmp_src_dir):
|
||||||
|
shutil.rmtree(tmp_src_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def dump_file(f):
|
||||||
|
with open(f, 'r') as f:
|
||||||
|
log(f.read())
|
||||||
|
|
||||||
|
|
||||||
|
def log(msg):
|
||||||
|
print(msg, file=sys.stdout)
|
||||||
|
|
||||||
|
|
||||||
|
def log_line():
|
||||||
|
log('======================================================\n\n')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
28
app/scripts/upload_builds
Executable file
28
app/scripts/upload_builds
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Upload build archives from 'dist' to S3 with the specified channel and version
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo Usage: $0 CHANNEL VERSION >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
CHANNEL="${1:-}"
|
||||||
|
VERSION="${2:-}"
|
||||||
|
|
||||||
|
if [[ -z "$CHANNEL" ]] || [[ -z "$VERSION" ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
source_dir="$DIST_DIR"
|
||||||
|
if [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
source_dir=$(cygpath -w "$source_dir")
|
||||||
|
fi
|
||||||
|
url="s3://$S3_BUCKET/$S3_DIST_PATH/$CHANNEL/$VERSION/"
|
||||||
|
aws s3 sync --exclude "files-*" --exclude build_id "$source_dir" $url
|
44
app/scripts/xulrunner_hash
Executable file
44
app/scripts/xulrunner_hash
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
cd "$APP_ROOT_DIR"
|
||||||
|
|
||||||
|
platform=""
|
||||||
|
while getopts ":p:" opt; do
|
||||||
|
case $opt in
|
||||||
|
p)
|
||||||
|
platform="$OPTARG"
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if [ $platform == "m" ]; then
|
||||||
|
GECKO_VERSION="$GECKO_VERSION_MAC"
|
||||||
|
elif [ $platform == "w" ]; then
|
||||||
|
GECKO_VERSION="$GECKO_VERSION_WIN"
|
||||||
|
elif [ $platform == "l" ]; then
|
||||||
|
GECKO_VERSION="$GECKO_VERSION_LINUX"
|
||||||
|
else
|
||||||
|
echo "Platform parameter incorrect. Usage: -p m(mac)/w(windows)/l(linux)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
xulrunner_content=$(< "$SCRIPT_DIR/fetch_xulrunner")
|
||||||
|
xulrunner_content+=$(< "$APP_ROOT_DIR/assets/multilocale.txt")
|
||||||
|
xulrunner_gecko_hash=$(echo -n "$GECKO_VERSION - '$xulrunner_content'" | openssl dgst -sha256)
|
||||||
|
|
||||||
|
echo "$xulrunner_gecko_hash"
|
||||||
|
|
||||||
|
|
333
app/update-packaging/build_autoupdate.sh
Executable file
333
app/update-packaging/build_autoupdate.sh
Executable file
|
@ -0,0 +1,333 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
UPDATE_STAGE_DIR="$SCRIPT_DIR/staging"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat >&2 <<DONE
|
||||||
|
Usage: $0 -c CHANNEL [-f] [-i FROM_VERSION] [-p PLATFORMS] [-l] VERSION
|
||||||
|
Options
|
||||||
|
-c CHANNEL Release channel ('release', 'beta')
|
||||||
|
-f Perform full build
|
||||||
|
-i FROM_VERSION Perform incremental build
|
||||||
|
-p PLATFORMS Platforms to build (m=Mac, w=Windows, l=Linux)
|
||||||
|
-l Use local TO directory instead of downloading TO files from S3
|
||||||
|
DONE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# From https://gist.github.com/cdown/1163649#gistcomment-1639097
|
||||||
|
urlencode() {
|
||||||
|
local LANG=C
|
||||||
|
local length="${#1}"
|
||||||
|
for (( i = 0; i < length; i++ )); do
|
||||||
|
local c="${1:i:1}"
|
||||||
|
case $c in
|
||||||
|
[a-zA-Z0-9.~_-]) printf "$c" ;;
|
||||||
|
*) printf '%%%02X' "'$c" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
BUILD_FULL=0
|
||||||
|
BUILD_INCREMENTAL=0
|
||||||
|
FROM=""
|
||||||
|
CHANNEL=""
|
||||||
|
BUILD_MAC=0
|
||||||
|
BUILD_WIN=0
|
||||||
|
BUILD_LINUX=0
|
||||||
|
USE_LOCAL_TO=0
|
||||||
|
while getopts "i:c:p:fl" opt; do
|
||||||
|
case $opt in
|
||||||
|
i)
|
||||||
|
FROM="$OPTARG"
|
||||||
|
BUILD_INCREMENTAL=1
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
CHANNEL="$OPTARG"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
for i in `seq 0 1 $((${#OPTARG}-1))`
|
||||||
|
do
|
||||||
|
case ${OPTARG:i:1} in
|
||||||
|
m) BUILD_MAC=1;;
|
||||||
|
w) BUILD_WIN=1;;
|
||||||
|
l) BUILD_LINUX=1;;
|
||||||
|
*)
|
||||||
|
echo "$0: Invalid platform option ${OPTARG:i:1}"
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
f)
|
||||||
|
BUILD_FULL=1
|
||||||
|
;;
|
||||||
|
l)
|
||||||
|
USE_LOCAL_TO=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift $((OPTIND-1)); OPTIND=1
|
||||||
|
done
|
||||||
|
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
TO=${1:-}
|
||||||
|
|
||||||
|
if [ -z "$TO" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$FROM" ] && [ $BUILD_FULL -eq 0 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$CHANNEL" ]]; then
|
||||||
|
echo "Channel not provided" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Require at least one platform
|
||||||
|
if [[ $BUILD_MAC == 0 ]] && [[ $BUILD_WIN == 0 ]] && [[ $BUILD_LINUX == 0 ]]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "$UPDATE_STAGE_DIR"
|
||||||
|
mkdir "$UPDATE_STAGE_DIR"
|
||||||
|
|
||||||
|
INCREMENTALS_FOUND=0
|
||||||
|
for version in "$FROM" "$TO"; do
|
||||||
|
if [[ $version == "$TO" ]] && [[ $INCREMENTALS_FOUND == 0 ]] && [[ $BUILD_FULL == 0 ]]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Getting Zotero version $version"
|
||||||
|
|
||||||
|
versiondir="$UPDATE_STAGE_DIR/$version"
|
||||||
|
|
||||||
|
#
|
||||||
|
# If -l passed, use main build script's staging directory for TO files rather than downloading
|
||||||
|
# the given version.
|
||||||
|
#
|
||||||
|
# The caller must ensure that the files in ../staging match the platforms and version given.
|
||||||
|
if [[ $version == $TO && $USE_LOCAL_TO == "1" ]]; then
|
||||||
|
if [ ! -d "$STAGE_DIR" ]; then
|
||||||
|
echo "Can't find local TO dir $STAGE_DIR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using files from $STAGE_DIR"
|
||||||
|
ln -s "$STAGE_DIR" "$versiondir"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Otherwise, download version from S3
|
||||||
|
#
|
||||||
|
mkdir -p "$versiondir"
|
||||||
|
cd "$versiondir"
|
||||||
|
|
||||||
|
MAC_ARCHIVE="Zotero-${version}.dmg"
|
||||||
|
WIN32_ARCHIVE="Zotero-${version}_win32.zip"
|
||||||
|
WIN_X64_ARCHIVE="Zotero-${version}_win-x64.zip"
|
||||||
|
WIN_ARM64_ARCHIVE="Zotero-${version}_win-arm64.zip"
|
||||||
|
LINUX_X86_ARCHIVE="Zotero-${version}_linux-i686.tar.bz2"
|
||||||
|
LINUX_X86_64_ARCHIVE="Zotero-${version}_linux-x86_64.tar.bz2"
|
||||||
|
|
||||||
|
CACHE_DIR="$ROOT_DIR/cache"
|
||||||
|
if [ ! -e "$CACHE_DIR" ]; then
|
||||||
|
mkdir "$CACHE_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for archive in "$MAC_ARCHIVE" "$WIN32_ARCHIVE" "$WIN_X64_ARCHIVE" "$WIN_ARM64_ARCHIVE" "$LINUX_X86_ARCHIVE" "$LINUX_X86_64_ARCHIVE"; do
|
||||||
|
if [[ $archive = "$MAC_ARCHIVE" ]] && [[ $BUILD_MAC != 1 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ $archive = "$WIN32_ARCHIVE" ]] && [[ $BUILD_WIN != 1 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ $archive = "$WIN_X64_ARCHIVE" ]] && [[ $BUILD_WIN != 1 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ $archive = "$WIN_ARM64_ARCHIVE" ]] && [[ $BUILD_WIN != 1 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ $archive = "$LINUX_X86_ARCHIVE" ]] && [[ $BUILD_LINUX != 1 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ $archive = "$LINUX_X86_64_ARCHIVE" ]] && [[ $BUILD_LINUX != 1 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
ETAG_FILE="$CACHE_DIR/$archive.etag"
|
||||||
|
|
||||||
|
# Check cache for archive
|
||||||
|
if [[ -f "$CACHE_DIR/$archive" ]] && [[ -f "$CACHE_DIR/$archive.etag" ]]; then
|
||||||
|
ETAG="`cat $ETAG_FILE | tr '\n' ' '`"
|
||||||
|
else
|
||||||
|
ETAG=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f $archive
|
||||||
|
# URL-encode '+' in beta version numbers
|
||||||
|
ENCODED_VERSION=`urlencode $version`
|
||||||
|
ENCODED_ARCHIVE=`urlencode $archive`
|
||||||
|
URL="https://$S3_BUCKET.s3.amazonaws.com/$S3_DIST_PATH/$CHANNEL/$ENCODED_VERSION/$ENCODED_ARCHIVE"
|
||||||
|
echo "Fetching $URL"
|
||||||
|
set +e
|
||||||
|
# Cached version is available
|
||||||
|
if [ -n "$ETAG" ]; then
|
||||||
|
NEW_ETAG=$(wget -nv -S --header "If-None-Match: $ETAG" $URL 2>&1 | awk '/ *ETag: */ {print $2}')
|
||||||
|
|
||||||
|
# If ETag didn't match, cache newly downloaded version
|
||||||
|
if [ -f $archive ]; then
|
||||||
|
echo "ETag for $archive didn't match! -- using new version"
|
||||||
|
rm -f "$CACHE_DIR/$archive.etag"
|
||||||
|
cp $archive "$CACHE_DIR/"
|
||||||
|
echo "$NEW_ETAG" > "$CACHE_DIR/$archive.etag"
|
||||||
|
# If ETag matched (or there was another error), use cached version
|
||||||
|
else
|
||||||
|
echo "Using cached $archive"
|
||||||
|
cp "$CACHE_DIR/$archive" .
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
NEW_ETAG=$(wget -nv -S $URL 2>&1 | awk '/ *ETag: */ {print $2}')
|
||||||
|
|
||||||
|
# Save archive to cache
|
||||||
|
rm -f "$CACHE_DIR/$archive.etag"
|
||||||
|
cp $archive "$CACHE_DIR/"
|
||||||
|
echo "$NEW_ETAG" > "$CACHE_DIR/$archive.etag"
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
done
|
||||||
|
|
||||||
|
# Delete cached files older than 14 days
|
||||||
|
find "$CACHE_DIR" -ctime +14 -delete
|
||||||
|
|
||||||
|
# Unpack Zotero.app
|
||||||
|
if [ $BUILD_MAC == 1 ]; then
|
||||||
|
if [ -f "$MAC_ARCHIVE" ]; then
|
||||||
|
set +e
|
||||||
|
hdiutil detach -quiet /Volumes/Zotero 2>/dev/null
|
||||||
|
set -e
|
||||||
|
hdiutil attach -quiet "$MAC_ARCHIVE"
|
||||||
|
cp -R /Volumes/Zotero/Zotero.app "$versiondir"
|
||||||
|
rm "$MAC_ARCHIVE"
|
||||||
|
hdiutil detach -quiet /Volumes/Zotero
|
||||||
|
INCREMENTALS_FOUND=1
|
||||||
|
else
|
||||||
|
echo "$MAC_ARCHIVE not found"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Unpack Windows zips
|
||||||
|
if [ $BUILD_WIN == 1 ]; then
|
||||||
|
if [[ -f "$WIN32_ARCHIVE" ]] && [[ -f "$WIN_X64_ARCHIVE" ]] && [[ -f "$WIN_ARM64_ARCHIVE" ]]; then
|
||||||
|
for build in "$WIN32_ARCHIVE" "$WIN_X64_ARCHIVE" "$WIN_ARM64_ARCHIVE"; do
|
||||||
|
unzip -q "$build"
|
||||||
|
rm "$build"
|
||||||
|
done
|
||||||
|
INCREMENTALS_FOUND=1
|
||||||
|
else
|
||||||
|
echo "$WIN32_ARCHIVE/$WIN_X64_ARCHIVE/$WIN_ARM64_ARCHIVE not found"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Unpack Linux tarballs
|
||||||
|
if [ $BUILD_LINUX == 1 ]; then
|
||||||
|
if [[ -f "$LINUX_X86_ARCHIVE" ]] && [[ -f "$LINUX_X86_64_ARCHIVE" ]]; then
|
||||||
|
for build in "$LINUX_X86_ARCHIVE" "$LINUX_X86_64_ARCHIVE"; do
|
||||||
|
tar -xjf "$build"
|
||||||
|
rm "$build"
|
||||||
|
done
|
||||||
|
INCREMENTALS_FOUND=1
|
||||||
|
else
|
||||||
|
echo "$LINUX_X86_ARCHIVE/$LINUX_X86_64_ARCHIVE not found"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
# Set variables for mar command in make_(incremental|full)_update.sh
|
||||||
|
export MOZ_PRODUCT_VERSION="$TO"
|
||||||
|
export MAR_CHANNEL_ID="$CHANNEL"
|
||||||
|
|
||||||
|
CHANGES_MADE=0
|
||||||
|
for build in "mac" "win32" "win-x64" "win-arm64" "linux-i686" "linux-x86_64"; do
|
||||||
|
if [[ $build == "mac" ]]; then
|
||||||
|
if [[ $BUILD_MAC == 0 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
dir="Zotero.app"
|
||||||
|
else
|
||||||
|
if ([[ $build == "win32" ]] || [[ $build == "win-x64" ]] || [[ $build == "win-arm64" ]]) && [[ $BUILD_WIN == 0 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ([[ $build == "linux-i686" ]] || [[ $build == "linux-x86_64" ]]) && [[ $BUILD_LINUX == 0 ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
dir="Zotero_$build"
|
||||||
|
fi
|
||||||
|
if [[ $BUILD_INCREMENTAL == 1 ]] && [[ -d "$UPDATE_STAGE_DIR/$FROM/$dir" ]]; then
|
||||||
|
echo
|
||||||
|
echo "Building incremental $build update from $FROM to $TO"
|
||||||
|
"$SCRIPT_DIR/make_incremental_update.sh" "$DIST_DIR/Zotero-${TO}-${FROM}_$build.mar" "$UPDATE_STAGE_DIR/$FROM/$dir" "$UPDATE_STAGE_DIR/$TO/$dir"
|
||||||
|
CHANGES_MADE=1
|
||||||
|
|
||||||
|
# If it's an incremental patch from a 6.0 build, use bzip instead of xz
|
||||||
|
if [[ $FROM = 6.0* ]]; then
|
||||||
|
echo "Building bzip2 version of incremental $build update from $FROM to $TO"
|
||||||
|
"$SCRIPT_DIR/xz_to_bzip" "$DIST_DIR/Zotero-${TO}-${FROM}_$build.mar" "$DIST_DIR/Zotero-${TO}-${FROM}_${build}_bz.mar"
|
||||||
|
rm "$DIST_DIR/Zotero-${TO}-${FROM}_$build.mar"
|
||||||
|
mv "$DIST_DIR/Zotero-${TO}-${FROM}_${build}_bz.mar" "$DIST_DIR/Zotero-${TO}-${FROM}_$build.mar"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ $BUILD_FULL == 1 ]]; then
|
||||||
|
echo
|
||||||
|
echo "Building full $build update for $TO"
|
||||||
|
"$SCRIPT_DIR/make_full_update.sh" "$DIST_DIR/Zotero-${TO}-full_$build.mar" "$UPDATE_STAGE_DIR/$TO/$dir"
|
||||||
|
CHANGES_MADE=1
|
||||||
|
|
||||||
|
# Make a bzip version of all complete patches for serving to <7.0 builds. Don't bother with
|
||||||
|
# architectures that didn't exist in Z6.
|
||||||
|
#
|
||||||
|
# We can stop this once we do a waterfall build that all older versions get updated to.
|
||||||
|
if [[ $build != "win-x64" ]] && [[ $build != "win-arm64" ]]; then
|
||||||
|
echo "Building bzip2 version of full $build update for $TO"
|
||||||
|
"$SCRIPT_DIR/xz_to_bzip" "$DIST_DIR/Zotero-${TO}-full_$build.mar" "$DIST_DIR/Zotero-${TO}-full_bz_${build}.mar"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -rf "$UPDATE_STAGE_DIR"
|
||||||
|
|
||||||
|
# Update file manifests
|
||||||
|
if [ $CHANGES_MADE -eq 1 ]; then
|
||||||
|
# Cygwin has sha512sum, macOS has shasum, Linux has both
|
||||||
|
if [[ -n "`which sha512sum 2> /dev/null`" ]]; then
|
||||||
|
SHACMD="sha512sum"
|
||||||
|
else
|
||||||
|
SHACMD="shasum -a 512"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$DIST_DIR"
|
||||||
|
for platform in "mac" "win" "linux"; do
|
||||||
|
file=files-$platform
|
||||||
|
rm -f $file
|
||||||
|
for fn in `find . -name "*$platform*.mar" -exec basename {} \;`; do
|
||||||
|
size=`wc -c "$fn" | awk '{print $1}'`
|
||||||
|
hash=`$SHACMD "$fn" | awk '{print $1}'`
|
||||||
|
echo $fn $hash $size >> $file
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
216
app/update-packaging/common.sh
Normal file
216
app/update-packaging/common.sh
Normal file
|
@ -0,0 +1,216 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Code shared by update packaging scripts.
|
||||||
|
# Author: Darin Fisher
|
||||||
|
#
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
QUIET=0
|
||||||
|
|
||||||
|
# By default just assume that these tools exist on our path
|
||||||
|
MAR=${MAR:-mar}
|
||||||
|
MBSDIFF=${MBSDIFF:-mbsdiff}
|
||||||
|
XZ=${XZ:-xz}
|
||||||
|
$XZ --version > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
# If $XZ is not set and not found on the path then this is probably
|
||||||
|
# running on a windows buildbot. Some of the Windows build systems have
|
||||||
|
# xz.exe in topsrcdir/xz/. Look in the places this would be in both a
|
||||||
|
# mozilla-central and comm-central build.
|
||||||
|
XZ="$(dirname "$(dirname "$(dirname "$0")")")/xz/xz.exe"
|
||||||
|
$XZ --version > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
XZ="$(dirname "$(dirname "$(dirname "$(dirname "$0")")")")/xz/xz.exe"
|
||||||
|
$XZ --version > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "xz was not found on this system!"
|
||||||
|
echo "exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Ensure that we're always using the right compression settings
|
||||||
|
export XZ_OPT="-T1 -7e"
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Helper routines
|
||||||
|
|
||||||
|
notice() {
|
||||||
|
echo "$*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
verbose_notice() {
|
||||||
|
if [ $QUIET -eq 0 ]; then
|
||||||
|
notice "$*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_file_size() {
|
||||||
|
info=($(ls -ln "$1"))
|
||||||
|
echo ${info[4]}
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_perm() {
|
||||||
|
reference="$1"
|
||||||
|
target="$2"
|
||||||
|
|
||||||
|
if [ -x "$reference" ]; then
|
||||||
|
chmod 0755 "$target"
|
||||||
|
else
|
||||||
|
chmod 0644 "$target"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
make_add_instruction() {
|
||||||
|
f="$1"
|
||||||
|
filev3="$2"
|
||||||
|
|
||||||
|
# Used to log to the console
|
||||||
|
if [ $4 ]; then
|
||||||
|
forced=" (forced)"
|
||||||
|
else
|
||||||
|
forced=
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Changed by Zotero for -e
|
||||||
|
is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/') || true
|
||||||
|
if [ $is_extension = "1" ]; then
|
||||||
|
# Use the subdirectory of the extensions folder as the file to test
|
||||||
|
# before performing this add instruction.
|
||||||
|
testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
|
||||||
|
verbose_notice " add-if \"$testdir\" \"$f\""
|
||||||
|
echo "add-if \"$testdir\" \"$f\"" >> "$filev3"
|
||||||
|
else
|
||||||
|
verbose_notice " add \"$f\"$forced"
|
||||||
|
echo "add \"$f\"" >> "$filev3"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_for_add_if_not_update() {
|
||||||
|
add_if_not_file_chk="$1"
|
||||||
|
|
||||||
|
# XXX unconditional add-if for channel-prefs.js to fix mac signature on old installs (bug 1804303)
|
||||||
|
if [ "$add_if_not_file_chk" = "Contents/Resources/defaults/pref/channel-prefs.js" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ `basename $add_if_not_file_chk` = "channel-prefs.js" -o \
|
||||||
|
`basename $add_if_not_file_chk` = "update-settings.ini" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
## 'false'... because this is bash. Oh yay!
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
make_add_if_not_instruction() {
|
||||||
|
f="$1"
|
||||||
|
filev3="$2"
|
||||||
|
|
||||||
|
verbose_notice " add-if-not \"$f\" \"$f\""
|
||||||
|
echo "add-if-not \"$f\" \"$f\"" >> "$filev3"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_patch_instruction() {
|
||||||
|
f="$1"
|
||||||
|
filev3="$2"
|
||||||
|
|
||||||
|
# Changed by Zotero for -e
|
||||||
|
is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/') || true
|
||||||
|
if [ $is_extension = "1" ]; then
|
||||||
|
# Use the subdirectory of the extensions folder as the file to test
|
||||||
|
# before performing this add instruction.
|
||||||
|
testdir=$(echo "$f" | sed 's/\(.*distribution\/extensions\/[^\/]*\)\/.*/\1/')
|
||||||
|
verbose_notice " patch-if \"$testdir\" \"$f.patch\" \"$f\""
|
||||||
|
echo "patch-if \"$testdir\" \"$f.patch\" \"$f\"" >> "$filev3"
|
||||||
|
else
|
||||||
|
verbose_notice " patch \"$f.patch\" \"$f\""
|
||||||
|
echo "patch \"$f.patch\" \"$f\"" >> "$filev3"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
append_remove_instructions() {
|
||||||
|
dir="$1"
|
||||||
|
filev3="$2"
|
||||||
|
|
||||||
|
if [ -f "$dir/removed-files" ]; then
|
||||||
|
listfile="$dir/removed-files"
|
||||||
|
elif [ -f "$dir/Contents/Resources/removed-files" ]; then
|
||||||
|
listfile="$dir/Contents/Resources/removed-files"
|
||||||
|
fi
|
||||||
|
if [ -n "$listfile" ]; then
|
||||||
|
# Changed by Zotero: Use subshell and disable filename globbing to prevent bash from expanding
|
||||||
|
# entries in removed-files with paths from the root (e.g., 'xulrunner/*')
|
||||||
|
(
|
||||||
|
set -f
|
||||||
|
# Map spaces to pipes so that we correctly handle filenames with spaces.
|
||||||
|
files=($(cat "$listfile" | tr " " "|" | sort -r))
|
||||||
|
num_files=${#files[*]}
|
||||||
|
for ((i=0; $i<$num_files; i=$i+1)); do
|
||||||
|
# Map pipes back to whitespace and remove carriage returns
|
||||||
|
f=$(echo ${files[$i]} | tr "|" " " | tr -d '\r')
|
||||||
|
# Trim whitespace
|
||||||
|
f=$(echo $f)
|
||||||
|
# Exclude blank lines.
|
||||||
|
if [ -n "$f" ]; then
|
||||||
|
# Exclude comments
|
||||||
|
if [ ! $(echo "$f" | grep -c '^#') = 1 ]; then
|
||||||
|
if [ $(echo "$f" | grep -c '\/$') = 1 ]; then
|
||||||
|
verbose_notice " rmdir \"$f\""
|
||||||
|
echo "rmdir \"$f\"" >> "$filev3"
|
||||||
|
elif [ $(echo "$f" | grep -c '\/\*$') = 1 ]; then
|
||||||
|
# Remove the *
|
||||||
|
f=$(echo "$f" | sed -e 's:\*$::')
|
||||||
|
verbose_notice " rmrfdir \"$f\""
|
||||||
|
echo "rmrfdir \"$f\"" >> "$filev3"
|
||||||
|
else
|
||||||
|
verbose_notice " remove \"$f\""
|
||||||
|
echo "remove \"$f\"" >> "$filev3"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# List all files in the current directory, stripping leading "./"
|
||||||
|
# Pass a variable name and it will be filled as an array.
|
||||||
|
list_files() {
|
||||||
|
count=0
|
||||||
|
temp_filelist=$(mktemp)
|
||||||
|
find . -type f \
|
||||||
|
! -name "update.manifest" \
|
||||||
|
! -name "updatev2.manifest" \
|
||||||
|
! -name "updatev3.manifest" \
|
||||||
|
| sed 's/\.\/\(.*\)/\1/' \
|
||||||
|
| sort -r > "${temp_filelist}"
|
||||||
|
while read file; do
|
||||||
|
eval "${1}[$count]=\"$file\""
|
||||||
|
# Changed for Zotero to avoid eval as 1
|
||||||
|
#(( count++ ))
|
||||||
|
(( ++count ))
|
||||||
|
done < "${temp_filelist}"
|
||||||
|
rm "${temp_filelist}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# List all directories in the current directory, stripping leading "./"
|
||||||
|
list_dirs() {
|
||||||
|
count=0
|
||||||
|
temp_dirlist=$(mktemp)
|
||||||
|
find . -type d \
|
||||||
|
! -name "." \
|
||||||
|
! -name ".." \
|
||||||
|
| sed 's/\.\/\(.*\)/\1/' \
|
||||||
|
| sort -r > "${temp_dirlist}"
|
||||||
|
while read dir; do
|
||||||
|
eval "${1}[$count]=\"$dir\""
|
||||||
|
# Changed for Zotero
|
||||||
|
#(( count++ ))
|
||||||
|
(( ++count ))
|
||||||
|
done < "${temp_dirlist}"
|
||||||
|
rm "${temp_dirlist}"
|
||||||
|
}
|
127
app/update-packaging/make_full_update.sh
Executable file
127
app/update-packaging/make_full_update.sh
Executable file
|
@ -0,0 +1,127 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#
|
||||||
|
# This tool generates full update packages for the update system.
|
||||||
|
# Author: Darin Fisher
|
||||||
|
#
|
||||||
|
|
||||||
|
# Added for Zotero
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
. $(dirname "$0")/common.sh
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
notice "Usage: $(basename $0) [OPTIONS] ARCHIVE DIRECTORY"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# = 0 ]; then
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $1 = -h ]; then
|
||||||
|
print_usage
|
||||||
|
notice ""
|
||||||
|
notice "The contents of DIRECTORY will be stored in ARCHIVE."
|
||||||
|
notice ""
|
||||||
|
notice "Options:"
|
||||||
|
notice " -h show this help text"
|
||||||
|
notice " -q be less verbose"
|
||||||
|
notice ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $1 = -q ]; then
|
||||||
|
QUIET=1
|
||||||
|
export QUIET
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mar_command="$MAR -V ${MOZ_PRODUCT_VERSION:?} -H ${MAR_CHANNEL_ID:?}"
|
||||||
|
|
||||||
|
archive="$1"
|
||||||
|
targetdir="$2"
|
||||||
|
# Prevent the workdir from being inside the targetdir so it isn't included in
|
||||||
|
# the update mar.
|
||||||
|
if [ $(echo "$targetdir" | grep -c '\/$') = 1 ]; then
|
||||||
|
# Remove the /
|
||||||
|
targetdir=$(echo "$targetdir" | sed -e 's:\/$::')
|
||||||
|
fi
|
||||||
|
workdir="$targetdir.work"
|
||||||
|
updatemanifestv3="$workdir/updatev3.manifest"
|
||||||
|
targetfiles="updatev3.manifest"
|
||||||
|
|
||||||
|
mkdir -p "$workdir"
|
||||||
|
|
||||||
|
# Generate a list of all files in the target directory.
|
||||||
|
pushd "$targetdir"
|
||||||
|
if test $? -ne 0 ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "precomplete" ]; then
|
||||||
|
if [ ! -f "Contents/Resources/precomplete" ]; then
|
||||||
|
notice "precomplete file is missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
list_files files
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Add the type of update to the beginning of the update manifests.
|
||||||
|
> "$updatemanifestv3"
|
||||||
|
notice ""
|
||||||
|
notice "Adding type instruction to update manifests"
|
||||||
|
notice " type complete"
|
||||||
|
echo "type \"complete\"" >> "$updatemanifestv3"
|
||||||
|
|
||||||
|
notice ""
|
||||||
|
notice "Adding file add instructions to update manifests"
|
||||||
|
num_files=${#files[*]}
|
||||||
|
|
||||||
|
for ((i=0; $i<$num_files; i=$i+1)); do
|
||||||
|
f="${files[$i]}"
|
||||||
|
|
||||||
|
if check_for_add_if_not_update "$f"; then
|
||||||
|
make_add_if_not_instruction "$f" "$updatemanifestv3"
|
||||||
|
else
|
||||||
|
make_add_instruction "$f" "$updatemanifestv3"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir=$(dirname "$f")
|
||||||
|
mkdir -p "$workdir/$dir"
|
||||||
|
$XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$targetdir/$f" > "$workdir/$f"
|
||||||
|
copy_perm "$targetdir/$f" "$workdir/$f"
|
||||||
|
|
||||||
|
targetfiles="$targetfiles \"$f\""
|
||||||
|
done
|
||||||
|
|
||||||
|
# Append remove instructions for any dead files.
|
||||||
|
notice ""
|
||||||
|
notice "Adding file and directory remove instructions from file 'removed-files'"
|
||||||
|
append_remove_instructions "$targetdir" "$updatemanifestv3"
|
||||||
|
|
||||||
|
$XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
|
||||||
|
|
||||||
|
# Changed for Zotero -- -C is unreliable
|
||||||
|
pushd "$workdir" > /dev/null
|
||||||
|
mar_command="$mar_command -c output.mar"
|
||||||
|
eval "$mar_command $targetfiles"
|
||||||
|
popd > /dev/null
|
||||||
|
mv -f "$workdir/output.mar" "$archive"
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm -fr "$workdir"
|
||||||
|
|
||||||
|
notice ""
|
||||||
|
notice "Finished"
|
||||||
|
notice ""
|
337
app/update-packaging/make_incremental_update.sh
Executable file
337
app/update-packaging/make_incremental_update.sh
Executable file
|
@ -0,0 +1,337 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
#
|
||||||
|
# This tool generates incremental update packages for the update system.
|
||||||
|
# Author: Darin Fisher
|
||||||
|
#
|
||||||
|
|
||||||
|
# Added for Zotero
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
. $(dirname "$0")/common.sh
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
notice "Usage: $(basename $0) [OPTIONS] ARCHIVE FROMDIR TODIR"
|
||||||
|
notice ""
|
||||||
|
notice "The differences between FROMDIR and TODIR will be stored in ARCHIVE."
|
||||||
|
notice ""
|
||||||
|
notice "Options:"
|
||||||
|
notice " -h show this help text"
|
||||||
|
notice " -f clobber this file in the installation"
|
||||||
|
notice " Must be a path to a file to clobber in the partial update."
|
||||||
|
notice " -q be less verbose"
|
||||||
|
notice ""
|
||||||
|
}
|
||||||
|
|
||||||
|
check_for_forced_update() {
|
||||||
|
force_list="$1"
|
||||||
|
forced_file_chk="$2"
|
||||||
|
|
||||||
|
local f
|
||||||
|
|
||||||
|
if [ "$forced_file_chk" = "precomplete" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$forced_file_chk" = "Contents/Resources/precomplete" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$forced_file_chk" = "removed-files" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$forced_file_chk" = "Contents/Resources/removed-files" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# notarization ticket
|
||||||
|
if [ "$forced_file_chk" = "Contents/CodeResources" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${forced_file_chk##*.}" = "chk" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
for f in $force_list; do
|
||||||
|
#echo comparing $forced_file_chk to $f
|
||||||
|
if [ "$forced_file_chk" = "$f" ]; then
|
||||||
|
## "true" *giggle*
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
## 'false'... because this is bash. Oh yay!
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# = 0 ]; then
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# channel-prefs.js removed for Zotero
|
||||||
|
requested_forced_updates='Contents/MacOS/firefox'
|
||||||
|
|
||||||
|
while getopts "hqf:" flag
|
||||||
|
do
|
||||||
|
case "$flag" in
|
||||||
|
h) print_usage; exit 0
|
||||||
|
;;
|
||||||
|
q) QUIET=1
|
||||||
|
;;
|
||||||
|
f) requested_forced_updates="$requested_forced_updates $OPTARG"
|
||||||
|
;;
|
||||||
|
?) print_usage; exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mar_command="$MAR -V ${MOZ_PRODUCT_VERSION:?} -H ${MAR_CHANNEL_ID:?}"
|
||||||
|
|
||||||
|
# Added for -e for Zotero
|
||||||
|
set +e
|
||||||
|
let arg_start=$OPTIND-1
|
||||||
|
shift $arg_start
|
||||||
|
set -e
|
||||||
|
|
||||||
|
archive="$1"
|
||||||
|
olddir="$2"
|
||||||
|
newdir="$3"
|
||||||
|
# Prevent the workdir from being inside the targetdir so it isn't included in
|
||||||
|
# the update mar.
|
||||||
|
if [ $(echo "$newdir" | grep -c '\/$') = 1 ]; then
|
||||||
|
# Remove the /
|
||||||
|
newdir=$(echo "$newdir" | sed -e 's:\/$::')
|
||||||
|
fi
|
||||||
|
workdir="$(mktemp -d)"
|
||||||
|
updatemanifestv3="$workdir/updatev3.manifest"
|
||||||
|
archivefiles="updatev3.manifest"
|
||||||
|
|
||||||
|
mkdir -p "$workdir"
|
||||||
|
|
||||||
|
# Generate a list of all files in the target directory.
|
||||||
|
pushd "$olddir"
|
||||||
|
if test $? -ne 0 ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
list_files oldfiles
|
||||||
|
list_dirs olddirs
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd "$newdir"
|
||||||
|
if test $? -ne 0 ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "precomplete" ]; then
|
||||||
|
if [ ! -f "Contents/Resources/precomplete" ]; then
|
||||||
|
notice "precomplete file is missing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
list_dirs newdirs
|
||||||
|
list_files newfiles
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Add the type of update to the beginning of the update manifests.
|
||||||
|
notice ""
|
||||||
|
notice "Adding type instruction to update manifests"
|
||||||
|
> $updatemanifestv3
|
||||||
|
notice " type partial"
|
||||||
|
echo "type \"partial\"" >> $updatemanifestv3
|
||||||
|
|
||||||
|
notice ""
|
||||||
|
notice "Adding file patch and add instructions to update manifests"
|
||||||
|
|
||||||
|
num_oldfiles=${#oldfiles[*]}
|
||||||
|
remove_array=
|
||||||
|
num_removes=0
|
||||||
|
|
||||||
|
for ((i=0; $i<$num_oldfiles; i=$i+1)); do
|
||||||
|
f="${oldfiles[$i]}"
|
||||||
|
|
||||||
|
# If this file exists in the new directory as well, then check if it differs.
|
||||||
|
if [ -f "$newdir/$f" ]; then
|
||||||
|
|
||||||
|
if check_for_add_if_not_update "$f"; then
|
||||||
|
# The full workdir may not exist yet, so create it if necessary.
|
||||||
|
mkdir -p `dirname "$workdir/$f"`
|
||||||
|
$XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
|
||||||
|
copy_perm "$newdir/$f" "$workdir/$f"
|
||||||
|
make_add_if_not_instruction "$f" "$updatemanifestv3"
|
||||||
|
archivefiles="$archivefiles \"$f\""
|
||||||
|
continue 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if check_for_forced_update "$requested_forced_updates" "$f"; then
|
||||||
|
# The full workdir may not exist yet, so create it if necessary.
|
||||||
|
mkdir -p `dirname "$workdir/$f"`
|
||||||
|
$XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
|
||||||
|
copy_perm "$newdir/$f" "$workdir/$f"
|
||||||
|
make_add_instruction "$f" "$updatemanifestv3" 1
|
||||||
|
archivefiles="$archivefiles \"$f\""
|
||||||
|
continue 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! diff "$olddir/$f" "$newdir/$f" > /dev/null; then
|
||||||
|
# Compute both the compressed binary diff and the compressed file, and
|
||||||
|
# compare the sizes. Then choose the smaller of the two to package.
|
||||||
|
dir=$(dirname "$workdir/$f")
|
||||||
|
mkdir -p "$dir"
|
||||||
|
verbose_notice "diffing \"$f\""
|
||||||
|
# MBSDIFF_HOOK represents the communication interface with funsize and,
|
||||||
|
# if enabled, caches the intermediate patches for future use and
|
||||||
|
# compute avoidance
|
||||||
|
#
|
||||||
|
# An example of MBSDIFF_HOOK env variable could look like this:
|
||||||
|
# export MBSDIFF_HOOK="myscript.sh -A https://funsize/api -c /home/user"
|
||||||
|
# where myscript.sh has the following usage:
|
||||||
|
# myscript.sh -A SERVER-URL [-c LOCAL-CACHE-DIR-PATH] [-g] [-u] \
|
||||||
|
# PATH-FROM-URL PATH-TO-URL PATH-PATCH SERVER-URL
|
||||||
|
#
|
||||||
|
# Note: patches are bzipped or xz stashed in funsize to gain more speed
|
||||||
|
|
||||||
|
# if service is not enabled then default to old behavior
|
||||||
|
# Disabled for Zotero
|
||||||
|
#if [ -z "$MBSDIFF_HOOK" ]; then
|
||||||
|
if true; then
|
||||||
|
# mbsdiff doesn't like POSIX paths on Windows
|
||||||
|
if [ $WIN_NATIVE -eq 1 ]; then
|
||||||
|
oldfile_path=$(cygpath -m "$olddir/$f")
|
||||||
|
newfile_path=$(cygpath -m "$newdir/$f")
|
||||||
|
patch_path=$(cygpath -m "$workdir/$f.patch")
|
||||||
|
else
|
||||||
|
oldfile_path="$olddir/$f"
|
||||||
|
newfile_path="$newdir/$f"
|
||||||
|
patch_path="$workdir/$f.patch"
|
||||||
|
fi
|
||||||
|
$MBSDIFF "$oldfile_path" "$newfile_path" "$patch_path"
|
||||||
|
$XZ $XZ_OPT --compress --lzma2 --format=xz --check=crc64 --force "$workdir/$f.patch"
|
||||||
|
else
|
||||||
|
# if service enabled then check patch existence for retrieval
|
||||||
|
if $MBSDIFF_HOOK -g "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.xz"; then
|
||||||
|
verbose_notice "file \"$f\" found in funsize, diffing skipped"
|
||||||
|
else
|
||||||
|
# if not found already - compute it and cache it for future use
|
||||||
|
$MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
|
||||||
|
$XZ $XZ_OPT --compress --lzma2 --format=xz --check=crc64 --force "$workdir/$f.patch"
|
||||||
|
$MBSDIFF_HOOK -u "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.xz"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
$XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
|
||||||
|
copy_perm "$newdir/$f" "$workdir/$f"
|
||||||
|
patchfile="$workdir/$f.patch.xz"
|
||||||
|
patchsize=$(get_file_size "$patchfile")
|
||||||
|
fullsize=$(get_file_size "$workdir/$f")
|
||||||
|
|
||||||
|
if [ $patchsize -lt $fullsize ]; then
|
||||||
|
make_patch_instruction "$f" "$updatemanifestv3"
|
||||||
|
mv -f "$patchfile" "$workdir/$f.patch"
|
||||||
|
rm -f "$workdir/$f"
|
||||||
|
archivefiles="$archivefiles \"$f.patch\""
|
||||||
|
else
|
||||||
|
make_add_instruction "$f" "$updatemanifestv3"
|
||||||
|
rm -f "$patchfile"
|
||||||
|
archivefiles="$archivefiles \"$f\""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# remove instructions are added after add / patch instructions for
|
||||||
|
# consistency with make_incremental_updates.py
|
||||||
|
remove_array[$num_removes]=$f
|
||||||
|
# Changed by Zotero for -e
|
||||||
|
#(( num_removes++ ))
|
||||||
|
(( ++num_removes ))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Newly added files
|
||||||
|
notice ""
|
||||||
|
notice "Adding file add instructions to update manifests"
|
||||||
|
num_newfiles=${#newfiles[*]}
|
||||||
|
|
||||||
|
for ((i=0; $i<$num_newfiles; i=$i+1)); do
|
||||||
|
f="${newfiles[$i]}"
|
||||||
|
|
||||||
|
# If we've already tested this file, then skip it
|
||||||
|
for ((j=0; $j<$num_oldfiles; j=$j+1)); do
|
||||||
|
if [ "$f" = "${oldfiles[j]}" ]; then
|
||||||
|
continue 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
dir=$(dirname "$workdir/$f")
|
||||||
|
mkdir -p "$dir"
|
||||||
|
|
||||||
|
$XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
|
||||||
|
copy_perm "$newdir/$f" "$workdir/$f"
|
||||||
|
|
||||||
|
if check_for_add_if_not_update "$f"; then
|
||||||
|
make_add_if_not_instruction "$f" "$updatemanifestv3"
|
||||||
|
else
|
||||||
|
make_add_instruction "$f" "$updatemanifestv3"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
archivefiles="$archivefiles \"$f\""
|
||||||
|
done
|
||||||
|
|
||||||
|
notice ""
|
||||||
|
notice "Adding file remove instructions to update manifests"
|
||||||
|
for ((i=0; $i<$num_removes; i=$i+1)); do
|
||||||
|
f="${remove_array[$i]}"
|
||||||
|
verbose_notice " remove \"$f\""
|
||||||
|
echo "remove \"$f\"" >> $updatemanifestv3
|
||||||
|
done
|
||||||
|
|
||||||
|
# Add remove instructions for any dead files.
|
||||||
|
notice ""
|
||||||
|
notice "Adding file and directory remove instructions from file 'removed-files'"
|
||||||
|
append_remove_instructions "$newdir" "$updatemanifestv3"
|
||||||
|
|
||||||
|
notice ""
|
||||||
|
notice "Adding directory remove instructions for directories that no longer exist"
|
||||||
|
num_olddirs=${#olddirs[*]}
|
||||||
|
|
||||||
|
for ((i=0; $i<$num_olddirs; i=$i+1)); do
|
||||||
|
f="${olddirs[$i]}"
|
||||||
|
# If this dir doesn't exist in the new directory remove it.
|
||||||
|
if [ ! -d "$newdir/$f" ]; then
|
||||||
|
verbose_notice " rmdir $f/"
|
||||||
|
echo "rmdir \"$f/\"" >> $updatemanifestv3
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
$XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
|
||||||
|
|
||||||
|
# Changed for Zotero -- -C is unreliable
|
||||||
|
pushd "$workdir" > /dev/null
|
||||||
|
mar_command="$mar_command -c output.mar"
|
||||||
|
eval "$mar_command $archivefiles"
|
||||||
|
popd > /dev/null
|
||||||
|
mv -f "$workdir/output.mar" "$archive"
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
rm -fr "$workdir"
|
||||||
|
|
||||||
|
notice ""
|
||||||
|
notice "Finished"
|
||||||
|
notice ""
|
24
app/update-packaging/removed-files_linux-i686
Normal file
24
app/update-packaging/removed-files_linux-i686
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
application.ini
|
||||||
|
chrome.manifest
|
||||||
|
chrome/*
|
||||||
|
components/*
|
||||||
|
defaults/*
|
||||||
|
deleted.txt
|
||||||
|
dictionaries/*
|
||||||
|
extensions/*
|
||||||
|
fonts/EmojiOneMozilla.ttf
|
||||||
|
gtk2/*
|
||||||
|
icudt58l.dat
|
||||||
|
install.rdf
|
||||||
|
libnssdbm3.chk
|
||||||
|
libnssdbm3.so
|
||||||
|
libsoftokn3.chk
|
||||||
|
pingsender
|
||||||
|
resource/*
|
||||||
|
run-zotero.sh
|
||||||
|
styles.zip
|
||||||
|
test/*
|
||||||
|
translators.index
|
||||||
|
translators.zip
|
||||||
|
xulrunner/*
|
||||||
|
zotero.jar
|
24
app/update-packaging/removed-files_linux-x86_64
Normal file
24
app/update-packaging/removed-files_linux-x86_64
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
application.ini
|
||||||
|
chrome.manifest
|
||||||
|
chrome/*
|
||||||
|
components/*
|
||||||
|
defaults/*
|
||||||
|
deleted.txt
|
||||||
|
dictionaries/*
|
||||||
|
extensions/*
|
||||||
|
fonts/EmojiOneMozilla.ttf
|
||||||
|
gtk2/*
|
||||||
|
icudt58l.dat
|
||||||
|
install.rdf
|
||||||
|
libnssdbm3.chk
|
||||||
|
libnssdbm3.so
|
||||||
|
libsoftokn3.chk
|
||||||
|
pingsender
|
||||||
|
resource/*
|
||||||
|
run-zotero.sh
|
||||||
|
styles.zip
|
||||||
|
test/*
|
||||||
|
translators.index
|
||||||
|
translators.zip
|
||||||
|
xulrunner/*
|
||||||
|
zotero.jar
|
73
app/update-packaging/removed-files_mac
Normal file
73
app/update-packaging/removed-files_mac
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
Contents/Frameworks/*
|
||||||
|
Contents/MacOS/Info.plist
|
||||||
|
Contents/MacOS/LICENSE
|
||||||
|
Contents/MacOS/README.xulrunner
|
||||||
|
Contents/MacOS/Resources/*
|
||||||
|
Contents/MacOS/active-update.xml
|
||||||
|
Contents/MacOS/chrome.manifest
|
||||||
|
Contents/MacOS/components/
|
||||||
|
Contents/MacOS/crashreporter.app/*
|
||||||
|
Contents/MacOS/defaults/*
|
||||||
|
Contents/MacOS/dependentlibs.list
|
||||||
|
Contents/MacOS/dictionaries/
|
||||||
|
Contents/MacOS/gmp-fake/*
|
||||||
|
Contents/MacOS/js-gdb.py
|
||||||
|
Contents/MacOS/libc++.1.dylib
|
||||||
|
Contents/MacOS/libfreebl.chk
|
||||||
|
Contents/MacOS/libmozsqlite3.dylib
|
||||||
|
Contents/MacOS/libnspr4.dylib
|
||||||
|
Contents/MacOS/libnssdbm3.chk
|
||||||
|
Contents/MacOS/libnssdbm3.dylib
|
||||||
|
Contents/MacOS/libnssutil3.dylib
|
||||||
|
Contents/MacOS/libplc4.dylib
|
||||||
|
Contents/MacOS/libplds4.dylib
|
||||||
|
Contents/MacOS/libplugin_child_interpose.dylib
|
||||||
|
Contents/MacOS/libsmime3.dylib
|
||||||
|
Contents/MacOS/libsoftokn3.chk
|
||||||
|
Contents/MacOS/libssl3.dylib
|
||||||
|
Contents/MacOS/libxpcom.dylib
|
||||||
|
Contents/MacOS/omni.ja
|
||||||
|
Contents/MacOS/pdfinfo
|
||||||
|
Contents/MacOS/pdftotext
|
||||||
|
Contents/MacOS/pingsender
|
||||||
|
Contents/MacOS/platform.ini
|
||||||
|
Contents/MacOS/precomplete
|
||||||
|
Contents/MacOS/res/*
|
||||||
|
Contents/MacOS/update-settings.ini
|
||||||
|
Contents/MacOS/updater.app/Contents/MacOS/updater-bin
|
||||||
|
Contents/MacOS/updates.xml
|
||||||
|
Contents/MacOS/updates/*
|
||||||
|
Contents/MacOS/zotero-bin
|
||||||
|
Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Resources/safari/inject/translate_inject.js
|
||||||
|
Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Resources/safari/node_modules.js
|
||||||
|
Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Resources/safari/test/*
|
||||||
|
Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Resources/safari/translate/cachedTypes.js
|
||||||
|
Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Resources/safari/translate/resource/README.md
|
||||||
|
Contents/PlugIns/ZoteroSafariExtension.appex/Contents/Resources/safari/translate/resource/zoteroTypeSchemaData.js
|
||||||
|
Contents/Resources/CONTRIBUTING.md
|
||||||
|
Contents/Resources/COPYING
|
||||||
|
Contents/Resources/README.md
|
||||||
|
Contents/Resources/application.ini
|
||||||
|
Contents/Resources/chrome.manifest
|
||||||
|
Contents/Resources/chrome/*
|
||||||
|
Contents/Resources/components/*
|
||||||
|
Contents/Resources/defaults/*
|
||||||
|
Contents/Resources/deleted.txt
|
||||||
|
Contents/Resources/devtools.jar
|
||||||
|
Contents/Resources/dictionaries/*
|
||||||
|
Contents/Resources/extensions/*
|
||||||
|
Contents/Resources/gmp-clearkey/0.1/clearkey.info
|
||||||
|
Contents/Resources/icudt56l.dat
|
||||||
|
Contents/Resources/install.rdf
|
||||||
|
Contents/Resources/poppler-data/*
|
||||||
|
Contents/Resources/resource/*
|
||||||
|
Contents/Resources/styles.zip
|
||||||
|
Contents/Resources/test/*
|
||||||
|
Contents/Resources/translators.index
|
||||||
|
Contents/Resources/translators.zip
|
||||||
|
Contents/Resources/voucher.bin
|
||||||
|
Contents/Resources/zotero.jar
|
||||||
|
Contents/XPCServices/*
|
||||||
|
Contents/_CodeSignature/CodeDirectory
|
||||||
|
Contents/_CodeSignature/CodeRequirements
|
||||||
|
Contents/_CodeSignature/CodeSignature
|
0
app/update-packaging/removed-files_win-arm64
Normal file
0
app/update-packaging/removed-files_win-arm64
Normal file
0
app/update-packaging/removed-files_win-x64
Normal file
0
app/update-packaging/removed-files_win-x64
Normal file
58
app/update-packaging/removed-files_win32
Normal file
58
app/update-packaging/removed-files_win32
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
Accessible.tlb
|
||||||
|
AccessibleHandler.dll
|
||||||
|
IA2Marshal.dll
|
||||||
|
Microsoft.VC80.CRT.manifest
|
||||||
|
api-ms-win-core-console-l1-1-0.dll
|
||||||
|
api-ms-win-core-datetime-l1-1-0.dll
|
||||||
|
api-ms-win-core-debug-l1-1-0.dll
|
||||||
|
api-ms-win-core-errorhandling-l1-1-0.dll
|
||||||
|
api-ms-win-core-file-l1-1-0.dll
|
||||||
|
api-ms-win-core-handle-l1-1-0.dll
|
||||||
|
api-ms-win-core-heap-l1-1-0.dll
|
||||||
|
api-ms-win-core-interlocked-l1-1-0.dll
|
||||||
|
api-ms-win-core-libraryloader-l1-1-0.dll
|
||||||
|
api-ms-win-core-memory-l1-1-0.dll
|
||||||
|
api-ms-win-core-namedpipe-l1-1-0.dll
|
||||||
|
api-ms-win-core-processenvironment-l1-1-0.dll
|
||||||
|
api-ms-win-core-processthreads-l1-1-0.dll
|
||||||
|
api-ms-win-core-profile-l1-1-0.dll
|
||||||
|
api-ms-win-core-rtlsupport-l1-1-0.dll
|
||||||
|
api-ms-win-core-string-l1-1-0.dll
|
||||||
|
api-ms-win-core-synch-l1-1-0.dll
|
||||||
|
api-ms-win-core-sysinfo-l1-1-0.dll
|
||||||
|
api-ms-win-core-util-l1-1-0.dll
|
||||||
|
application.ini
|
||||||
|
chrome.manifest
|
||||||
|
chrome/*
|
||||||
|
components/*
|
||||||
|
defaults/*
|
||||||
|
deleted.txt
|
||||||
|
dictionaries/*
|
||||||
|
extensions/*
|
||||||
|
firefox.*
|
||||||
|
fonts/EmojiOneMozilla.ttf
|
||||||
|
freebl3.chk
|
||||||
|
gkmedias.dll
|
||||||
|
install.rdf
|
||||||
|
minidump-analyzer.exe
|
||||||
|
mozcrt19.dll
|
||||||
|
mozutils.dll
|
||||||
|
msvcp80.dll
|
||||||
|
msvcp120.dll
|
||||||
|
msvcr80.dll
|
||||||
|
msvcr120.dll
|
||||||
|
nssdbm3.chk
|
||||||
|
nssdbm3.dll
|
||||||
|
pdfinfo.exe
|
||||||
|
pdftotext.exe
|
||||||
|
pingsender.exe
|
||||||
|
plugin-hang-ui.exe
|
||||||
|
poppler-data/*
|
||||||
|
resource/*
|
||||||
|
softokn3.chk
|
||||||
|
styles.zip
|
||||||
|
test/*
|
||||||
|
translators.index
|
||||||
|
translators.zip
|
||||||
|
xulrunner/*
|
||||||
|
zotero.jar
|
66
app/update-packaging/xz_to_bzip
Executable file
66
app/update-packaging/xz_to_bzip
Executable file
|
@ -0,0 +1,66 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
infile=${1:-}
|
||||||
|
outfile=${2:-}
|
||||||
|
if [[ -z "$infile" ]] || [[ -z "$infile" ]]; then
|
||||||
|
echo "Usage: $0 infile.mar outfile.mar"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mar="$APP_ROOT_DIR/xulrunner/bin/mar"
|
||||||
|
if [ ! -f "$mar" ]; then
|
||||||
|
echo "$mar not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp_dir=`mktemp -d`
|
||||||
|
function cleanup {
|
||||||
|
rm -rf $tmp_dir
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
cd "$tmp_dir"
|
||||||
|
mkdir in
|
||||||
|
cd in
|
||||||
|
|
||||||
|
if [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
|
||||||
|
infile=$(cygpath -w "$infile")
|
||||||
|
outfile=$(cygpath -w "$outfile")
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Extracting MAR"
|
||||||
|
$mar -x "$infile"
|
||||||
|
|
||||||
|
echo "Renaming all files to .xz"
|
||||||
|
find . -type f -exec mv {} {}.xz \;
|
||||||
|
echo "Uncompressing files"
|
||||||
|
find . -type f -exec unxz {} \;
|
||||||
|
echo "Recompressing files with bzip2"
|
||||||
|
find . -type f -exec bzip2 {} \;
|
||||||
|
echo "Removing .bz extension"
|
||||||
|
find . -type f | while read f; do mv "$f" "${f%.bz2}"; done
|
||||||
|
|
||||||
|
channel=$($mar -T "$infile" | sed -n -r 's/.+MAR channel name: ([^\s]+)/\1/p')
|
||||||
|
version=$($mar -T "$infile" | sed -n -r 's/.+Product version: ([^\s]+)/\1/p')
|
||||||
|
|
||||||
|
if [ -z "$channel" ]; then
|
||||||
|
echo "Could not detect channel"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "Could not detect version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "MAR channel name: $channel"
|
||||||
|
echo "Product version: $version"
|
||||||
|
|
||||||
|
echo "Creating new MAR"
|
||||||
|
$mar -V $version -H $channel -c "$outfile" `find . -type f | sed 's/^\.\///'`
|
||||||
|
echo
|
||||||
|
$mar -T "$outfile"
|
BIN
app/win/VersionInfo1-updater.rc
Normal file
BIN
app/win/VersionInfo1-updater.rc
Normal file
Binary file not shown.
BIN
app/win/VersionInfo1.rc
Normal file
BIN
app/win/VersionInfo1.rc
Normal file
Binary file not shown.
39
app/win/build
Normal file
39
app/win/build
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
APP_ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$APP_ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "Usage: $0 /path/to/mozilla-unified x86_64|i686" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gecko_path=$1
|
||||||
|
arch=$2
|
||||||
|
|
||||||
|
if [ ! -d "$gecko_path" ]; then
|
||||||
|
echo "$gecko_path is not a directory" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install required Rust version
|
||||||
|
rustup toolchain install $RUST_VERSION
|
||||||
|
if [[ $arch = "x86_64" ]] || [[ $arch == "i686" ]]; then
|
||||||
|
rustup target add $arch-pc-windows-msvc
|
||||||
|
else
|
||||||
|
echo "Unknown architecture $arch" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rustup default $RUST_VERSION
|
||||||
|
|
||||||
|
cp "$SCRIPT_DIR/mozconfig" "$gecko_path"
|
||||||
|
|
||||||
|
if [ $arch = "i686" ]; then
|
||||||
|
export Z_ARCH=win32
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$gecko_path"
|
||||||
|
./mach build
|
||||||
|
./mach package
|
53
app/win/download-nsis-plugins
Executable file
53
app/win/download-nsis-plugins
Executable file
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
. "$ROOT_DIR/config.sh"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Turns out we need older versions from Mozilla, not the official ZIPs
|
||||||
|
#
|
||||||
|
#plugins=$(cat <<EOF
|
||||||
|
#http://nsis.sourceforge.net/mediawiki/images/d/d4/AppAssocReg-0.4.zip
|
||||||
|
#https://github.com/connectiblutz/NSIS-ApplicationID/releases/download/1.1/NSIS-ApplicationID.zip
|
||||||
|
#http://nsis.sourceforge.net/mediawiki/images/c/ca/InvokeShellVerb-1.0.zip
|
||||||
|
#http://nsis.sourceforge.net/mediawiki/images/6/6c/Shelllink.zip
|
||||||
|
#http://nsis.sourceforge.net/mediawiki/images/8/8f/UAC.zip
|
||||||
|
#EOF
|
||||||
|
#)
|
||||||
|
#
|
||||||
|
#mkdir -p nsis
|
||||||
|
#cd nsis
|
||||||
|
#for plugin in $plugins; do
|
||||||
|
# wget $plugin
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#unzip_cmd="unzip -d Plugins -j"
|
||||||
|
#for zip in AppAssocReg*.zip InvokeShellVerb*.zip; do
|
||||||
|
# $unzip_cmd $zip 'Plugins/Unicode/*.dll'
|
||||||
|
#done
|
||||||
|
#$unzip_cmd Shelllink*.zip Unicode/Plugins/ShellLink.dll
|
||||||
|
#$unzip_cmd NSIS-ApplicationID*.zip 'ReleaseUnicode/ApplicationID*'
|
||||||
|
#$unzip_cmd UAC.zip Plugins/x86-unicode/UAC.dll
|
||||||
|
#
|
||||||
|
#rm *.zip
|
||||||
|
#
|
||||||
|
#echo
|
||||||
|
#echo
|
||||||
|
#echo "Files extracted to ./nsis/Plugins -- move to ${NSIS_DIR}Plugins"
|
||||||
|
#echo
|
||||||
|
#ls -la Plugins
|
||||||
|
|
||||||
|
mkdir -p Plugins
|
||||||
|
cd Plugins
|
||||||
|
plugins="AccessControl AppAssocReg ApplicationID InvokeShellVerb ShellLink UAC"
|
||||||
|
for plugin in $plugins; do
|
||||||
|
curl https://hg.mozilla.org/mozilla-central/raw-file/052d53200cf8/other-licenses/nsis/Plugins/$plugin.dll > $plugin.dll
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "Files downloaded to ./Plugins -- move to ${NSIS_DIR}Plugins"
|
||||||
|
echo
|
||||||
|
ls -la
|
BIN
app/win/installer/7zstub/firefox/7zSD.sfx
Normal file
BIN
app/win/installer/7zstub/firefox/7zSD.sfx
Normal file
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
// CompressionMethod.cpp
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
|
@ -0,0 +1,64 @@
|
||||||
|
// 7zCompressionMode.h
|
||||||
|
|
||||||
|
#ifndef __7Z_COMPRESSION_MODE_H
|
||||||
|
#define __7Z_COMPRESSION_MODE_H
|
||||||
|
|
||||||
|
#include "../../../Windows/PropVariant.h"
|
||||||
|
|
||||||
|
#include "7zMethodID.h"
|
||||||
|
|
||||||
|
namespace NArchive {
|
||||||
|
namespace N7z {
|
||||||
|
|
||||||
|
struct CProperty
|
||||||
|
{
|
||||||
|
PROPID PropID;
|
||||||
|
NWindows::NCOM::CPropVariant Value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CMethodFull
|
||||||
|
{
|
||||||
|
CMethodID MethodID;
|
||||||
|
UInt32 NumInStreams;
|
||||||
|
UInt32 NumOutStreams;
|
||||||
|
bool IsSimpleCoder() const
|
||||||
|
{ return (NumInStreams == 1) && (NumOutStreams == 1); }
|
||||||
|
|
||||||
|
#ifdef EXCLUDE_COM
|
||||||
|
#else
|
||||||
|
CLSID EncoderClassID;
|
||||||
|
CSysString FilePath;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CObjectVector<CProperty> CoderProperties;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBind
|
||||||
|
{
|
||||||
|
UInt32 InCoder;
|
||||||
|
UInt32 InStream;
|
||||||
|
UInt32 OutCoder;
|
||||||
|
UInt32 OutStream;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CCompressionMethodMode
|
||||||
|
{
|
||||||
|
CObjectVector<CMethodFull> Methods;
|
||||||
|
CRecordVector<CBind> Binds;
|
||||||
|
#ifdef COMPRESS_MT
|
||||||
|
UInt32 NumThreads;
|
||||||
|
#endif
|
||||||
|
bool PasswordIsDefined;
|
||||||
|
UString Password;
|
||||||
|
|
||||||
|
bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); }
|
||||||
|
CCompressionMethodMode(): PasswordIsDefined(false)
|
||||||
|
#ifdef COMPRESS_MT
|
||||||
|
, NumThreads(1)
|
||||||
|
#endif
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
443
app/win/installer/7zstub/src/7zip/Archive/7z/7zDecode.cpp
Normal file
443
app/win/installer/7zstub/src/7zip/Archive/7z/7zDecode.cpp
Normal file
|
@ -0,0 +1,443 @@
|
||||||
|
// 7zDecode.cpp
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#include "7zDecode.h"
|
||||||
|
|
||||||
|
#include "../../IPassword.h"
|
||||||
|
#include "../../Common/LockedStream.h"
|
||||||
|
#include "../../Common/StreamObjects.h"
|
||||||
|
#include "../../Common/ProgressUtils.h"
|
||||||
|
#include "../../Common/LimitedStreams.h"
|
||||||
|
#include "../Common/FilterCoder.h"
|
||||||
|
|
||||||
|
#include "7zMethods.h"
|
||||||
|
|
||||||
|
#ifdef COMPRESS_LZMA
|
||||||
|
#include "../../Compress/LZMA/LZMADecoder.h"
|
||||||
|
static NArchive::N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_PPMD
|
||||||
|
#include "../../Compress/PPMD/PPMDDecoder.h"
|
||||||
|
static NArchive::N7z::CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_BCJ_X86
|
||||||
|
#include "../../Compress/Branch/x86.h"
|
||||||
|
static NArchive::N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_BCJ2
|
||||||
|
#include "../../Compress/Branch/x86_2.h"
|
||||||
|
static NArchive::N7z::CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_DEFLATE
|
||||||
|
#ifndef COMPRESS_DEFLATE_DECODER
|
||||||
|
#define COMPRESS_DEFLATE_DECODER
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_DEFLATE_DECODER
|
||||||
|
#include "../../Compress/Deflate/DeflateDecoder.h"
|
||||||
|
static NArchive::N7z::CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_BZIP2
|
||||||
|
#ifndef COMPRESS_BZIP2_DECODER
|
||||||
|
#define COMPRESS_BZIP2_DECODER
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_BZIP2_DECODER
|
||||||
|
#include "../../Compress/BZip2/BZip2Decoder.h"
|
||||||
|
static NArchive::N7z::CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_COPY
|
||||||
|
#include "../../Compress/Copy/CopyCoder.h"
|
||||||
|
static NArchive::N7z::CMethodID k_Copy = { { 0x0 }, 1 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CRYPTO_7ZAES
|
||||||
|
#include "../../Crypto/7zAES/7zAES.h"
|
||||||
|
static NArchive::N7z::CMethodID k_7zAES = { { 0x6, 0xF1, 0x07, 0x01 }, 4 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace NArchive {
|
||||||
|
namespace N7z {
|
||||||
|
|
||||||
|
static void ConvertFolderItemInfoToBindInfo(const CFolder &folder,
|
||||||
|
CBindInfoEx &bindInfo)
|
||||||
|
{
|
||||||
|
bindInfo.Clear();
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < folder.BindPairs.Size(); i++)
|
||||||
|
{
|
||||||
|
NCoderMixer2::CBindPair bindPair;
|
||||||
|
bindPair.InIndex = (UInt32)folder.BindPairs[i].InIndex;
|
||||||
|
bindPair.OutIndex = (UInt32)folder.BindPairs[i].OutIndex;
|
||||||
|
bindInfo.BindPairs.Add(bindPair);
|
||||||
|
}
|
||||||
|
UInt32 outStreamIndex = 0;
|
||||||
|
for (i = 0; i < folder.Coders.Size(); i++)
|
||||||
|
{
|
||||||
|
NCoderMixer2::CCoderStreamsInfo coderStreamsInfo;
|
||||||
|
const CCoderInfo &coderInfo = folder.Coders[i];
|
||||||
|
coderStreamsInfo.NumInStreams = (UInt32)coderInfo.NumInStreams;
|
||||||
|
coderStreamsInfo.NumOutStreams = (UInt32)coderInfo.NumOutStreams;
|
||||||
|
bindInfo.Coders.Add(coderStreamsInfo);
|
||||||
|
const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front();
|
||||||
|
bindInfo.CoderMethodIDs.Add(altCoderInfo.MethodID);
|
||||||
|
for (UInt32 j = 0; j < coderStreamsInfo.NumOutStreams; j++, outStreamIndex++)
|
||||||
|
if (folder.FindBindPairForOutStream(outStreamIndex) < 0)
|
||||||
|
bindInfo.OutStreams.Add(outStreamIndex);
|
||||||
|
}
|
||||||
|
for (i = 0; i < folder.PackStreams.Size(); i++)
|
||||||
|
bindInfo.InStreams.Add((UInt32)folder.PackStreams[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool AreCodersEqual(const NCoderMixer2::CCoderStreamsInfo &a1,
|
||||||
|
const NCoderMixer2::CCoderStreamsInfo &a2)
|
||||||
|
{
|
||||||
|
return (a1.NumInStreams == a2.NumInStreams) &&
|
||||||
|
(a1.NumOutStreams == a2.NumOutStreams);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool AreBindPairsEqual(const NCoderMixer2::CBindPair &a1, const NCoderMixer2::CBindPair &a2)
|
||||||
|
{
|
||||||
|
return (a1.InIndex == a2.InIndex) &&
|
||||||
|
(a1.OutIndex == a2.OutIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool AreBindInfoExEqual(const CBindInfoEx &a1, const CBindInfoEx &a2)
|
||||||
|
{
|
||||||
|
if (a1.Coders.Size() != a2.Coders.Size())
|
||||||
|
return false;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < a1.Coders.Size(); i++)
|
||||||
|
if (!AreCodersEqual(a1.Coders[i], a2.Coders[i]))
|
||||||
|
return false;
|
||||||
|
if (a1.BindPairs.Size() != a2.BindPairs.Size())
|
||||||
|
return false;
|
||||||
|
for (i = 0; i < a1.BindPairs.Size(); i++)
|
||||||
|
if (!AreBindPairsEqual(a1.BindPairs[i], a2.BindPairs[i]))
|
||||||
|
return false;
|
||||||
|
for (i = 0; i < a1.CoderMethodIDs.Size(); i++)
|
||||||
|
if (a1.CoderMethodIDs[i] != a2.CoderMethodIDs[i])
|
||||||
|
return false;
|
||||||
|
if (a1.InStreams.Size() != a2.InStreams.Size())
|
||||||
|
return false;
|
||||||
|
if (a1.OutStreams.Size() != a2.OutStreams.Size())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CDecoder::CDecoder(bool multiThread)
|
||||||
|
{
|
||||||
|
#ifndef _ST_MODE
|
||||||
|
multiThread = true;
|
||||||
|
#endif
|
||||||
|
_multiThread = multiThread;
|
||||||
|
_bindInfoExPrevIsDefinded = false;
|
||||||
|
#ifndef EXCLUDE_COM
|
||||||
|
LoadMethodMap();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT CDecoder::Decode(IInStream *inStream,
|
||||||
|
UInt64 startPos,
|
||||||
|
const UInt64 *packSizes,
|
||||||
|
const CFolder &folderInfo,
|
||||||
|
ISequentialOutStream *outStream,
|
||||||
|
ICompressProgressInfo *compressProgress
|
||||||
|
#ifndef _NO_CRYPTO
|
||||||
|
, ICryptoGetTextPassword *getTextPassword
|
||||||
|
#endif
|
||||||
|
#ifdef COMPRESS_MT
|
||||||
|
, bool mtMode, UInt32 numThreads
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CObjectVector< CMyComPtr<ISequentialInStream> > inStreams;
|
||||||
|
|
||||||
|
CLockedInStream lockedInStream;
|
||||||
|
lockedInStream.Init(inStream);
|
||||||
|
|
||||||
|
for (int j = 0; j < folderInfo.PackStreams.Size(); j++)
|
||||||
|
{
|
||||||
|
CLockedSequentialInStreamImp *lockedStreamImpSpec = new
|
||||||
|
CLockedSequentialInStreamImp;
|
||||||
|
CMyComPtr<ISequentialInStream> lockedStreamImp = lockedStreamImpSpec;
|
||||||
|
lockedStreamImpSpec->Init(&lockedInStream, startPos);
|
||||||
|
startPos += packSizes[j];
|
||||||
|
|
||||||
|
CLimitedSequentialInStream *streamSpec = new
|
||||||
|
CLimitedSequentialInStream;
|
||||||
|
CMyComPtr<ISequentialInStream> inStream = streamSpec;
|
||||||
|
streamSpec->Init(lockedStreamImp, packSizes[j]);
|
||||||
|
inStreams.Add(inStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
int numCoders = folderInfo.Coders.Size();
|
||||||
|
|
||||||
|
CBindInfoEx bindInfo;
|
||||||
|
ConvertFolderItemInfoToBindInfo(folderInfo, bindInfo);
|
||||||
|
bool createNewCoders;
|
||||||
|
if (!_bindInfoExPrevIsDefinded)
|
||||||
|
createNewCoders = true;
|
||||||
|
else
|
||||||
|
createNewCoders = !AreBindInfoExEqual(bindInfo, _bindInfoExPrev);
|
||||||
|
if (createNewCoders)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
_decoders.Clear();
|
||||||
|
// _decoders2.Clear();
|
||||||
|
|
||||||
|
_mixerCoder.Release();
|
||||||
|
|
||||||
|
if (_multiThread)
|
||||||
|
{
|
||||||
|
_mixerCoderMTSpec = new NCoderMixer2::CCoderMixer2MT;
|
||||||
|
_mixerCoder = _mixerCoderMTSpec;
|
||||||
|
_mixerCoderCommon = _mixerCoderMTSpec;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef _ST_MODE
|
||||||
|
_mixerCoderSTSpec = new NCoderMixer2::CCoderMixer2ST;
|
||||||
|
_mixerCoder = _mixerCoderSTSpec;
|
||||||
|
_mixerCoderCommon = _mixerCoderSTSpec;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
_mixerCoderCommon->SetBindInfo(bindInfo);
|
||||||
|
|
||||||
|
for (i = 0; i < numCoders; i++)
|
||||||
|
{
|
||||||
|
const CCoderInfo &coderInfo = folderInfo.Coders[i];
|
||||||
|
const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front();
|
||||||
|
#ifndef EXCLUDE_COM
|
||||||
|
CMethodInfo methodInfo;
|
||||||
|
if (!GetMethodInfo(altCoderInfo.MethodID, methodInfo))
|
||||||
|
return E_NOTIMPL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (coderInfo.IsSimpleCoder())
|
||||||
|
{
|
||||||
|
CMyComPtr<ICompressCoder> decoder;
|
||||||
|
CMyComPtr<ICompressFilter> filter;
|
||||||
|
|
||||||
|
#ifdef COMPRESS_LZMA
|
||||||
|
if (altCoderInfo.MethodID == k_LZMA)
|
||||||
|
decoder = new NCompress::NLZMA::CDecoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_PPMD
|
||||||
|
if (altCoderInfo.MethodID == k_PPMD)
|
||||||
|
decoder = new NCompress::NPPMD::CDecoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_BCJ_X86
|
||||||
|
if (altCoderInfo.MethodID == k_BCJ_X86)
|
||||||
|
filter = new CBCJ_x86_Decoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_DEFLATE_DECODER
|
||||||
|
if (altCoderInfo.MethodID == k_Deflate)
|
||||||
|
decoder = new NCompress::NDeflate::NDecoder::CCOMCoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_BZIP2_DECODER
|
||||||
|
if (altCoderInfo.MethodID == k_BZip2)
|
||||||
|
decoder = new NCompress::NBZip2::CDecoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPRESS_COPY
|
||||||
|
if (altCoderInfo.MethodID == k_Copy)
|
||||||
|
decoder = new NCompress::CCopyCoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CRYPTO_7ZAES
|
||||||
|
if (altCoderInfo.MethodID == k_7zAES)
|
||||||
|
filter = new NCrypto::NSevenZ::CDecoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (filter)
|
||||||
|
{
|
||||||
|
CFilterCoder *coderSpec = new CFilterCoder;
|
||||||
|
decoder = coderSpec;
|
||||||
|
coderSpec->Filter = filter;
|
||||||
|
}
|
||||||
|
#ifndef EXCLUDE_COM
|
||||||
|
if (decoder == 0)
|
||||||
|
{
|
||||||
|
RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath,
|
||||||
|
methodInfo.Decoder, &decoder));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (decoder == 0)
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
|
_decoders.Add((IUnknown *)decoder);
|
||||||
|
|
||||||
|
if (_multiThread)
|
||||||
|
_mixerCoderMTSpec->AddCoder(decoder);
|
||||||
|
#ifdef _ST_MODE
|
||||||
|
else
|
||||||
|
_mixerCoderSTSpec->AddCoder(decoder, false);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CMyComPtr<ICompressCoder2> decoder;
|
||||||
|
|
||||||
|
#ifdef COMPRESS_BCJ2
|
||||||
|
if (altCoderInfo.MethodID == k_BCJ2)
|
||||||
|
decoder = new CBCJ2_x86_Decoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EXCLUDE_COM
|
||||||
|
if (decoder == 0)
|
||||||
|
{
|
||||||
|
RINOK(_libraries.CreateCoder2(methodInfo.FilePath,
|
||||||
|
methodInfo.Decoder, &decoder));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (decoder == 0)
|
||||||
|
return E_NOTIMPL;
|
||||||
|
|
||||||
|
_decoders.Add((IUnknown *)decoder);
|
||||||
|
if (_multiThread)
|
||||||
|
_mixerCoderMTSpec->AddCoder2(decoder);
|
||||||
|
#ifdef _ST_MODE
|
||||||
|
else
|
||||||
|
_mixerCoderSTSpec->AddCoder2(decoder, false);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_bindInfoExPrev = bindInfo;
|
||||||
|
_bindInfoExPrevIsDefinded = true;
|
||||||
|
}
|
||||||
|
int i;
|
||||||
|
_mixerCoderCommon->ReInit();
|
||||||
|
|
||||||
|
UInt32 packStreamIndex = 0, unPackStreamIndex = 0;
|
||||||
|
UInt32 coderIndex = 0;
|
||||||
|
// UInt32 coder2Index = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < numCoders; i++)
|
||||||
|
{
|
||||||
|
const CCoderInfo &coderInfo = folderInfo.Coders[i];
|
||||||
|
const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front();
|
||||||
|
CMyComPtr<IUnknown> &decoder = _decoders[coderIndex];
|
||||||
|
|
||||||
|
{
|
||||||
|
CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
|
||||||
|
HRESULT result = decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
|
||||||
|
if (setDecoderProperties)
|
||||||
|
{
|
||||||
|
const CByteBuffer &properties = altCoderInfo.Properties;
|
||||||
|
size_t size = properties.GetCapacity();
|
||||||
|
if (size > 0xFFFFFFFF)
|
||||||
|
return E_NOTIMPL;
|
||||||
|
if (size > 0)
|
||||||
|
{
|
||||||
|
RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)properties, (UInt32)size));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef COMPRESS_MT
|
||||||
|
if (mtMode)
|
||||||
|
{
|
||||||
|
CMyComPtr<ICompressSetCoderMt> setCoderMt;
|
||||||
|
decoder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
|
||||||
|
if (setCoderMt)
|
||||||
|
{
|
||||||
|
RINOK(setCoderMt->SetNumberOfThreads(numThreads));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _NO_CRYPTO
|
||||||
|
{
|
||||||
|
CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
|
||||||
|
HRESULT result = decoder.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword);
|
||||||
|
if (cryptoSetPassword)
|
||||||
|
{
|
||||||
|
if (getTextPassword == 0)
|
||||||
|
return E_FAIL;
|
||||||
|
CMyComBSTR password;
|
||||||
|
RINOK(getTextPassword->CryptoGetTextPassword(&password));
|
||||||
|
CByteBuffer buffer;
|
||||||
|
UString unicodePassword(password);
|
||||||
|
const UInt32 sizeInBytes = unicodePassword.Length() * 2;
|
||||||
|
buffer.SetCapacity(sizeInBytes);
|
||||||
|
for (int i = 0; i < unicodePassword.Length(); i++)
|
||||||
|
{
|
||||||
|
wchar_t c = unicodePassword[i];
|
||||||
|
((Byte *)buffer)[i * 2] = (Byte)c;
|
||||||
|
((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
|
||||||
|
}
|
||||||
|
RINOK(cryptoSetPassword->CryptoSetPassword(
|
||||||
|
(const Byte *)buffer, sizeInBytes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
coderIndex++;
|
||||||
|
|
||||||
|
UInt32 numInStreams = (UInt32)coderInfo.NumInStreams;
|
||||||
|
UInt32 numOutStreams = (UInt32)coderInfo.NumOutStreams;
|
||||||
|
CRecordVector<const UInt64 *> packSizesPointers;
|
||||||
|
CRecordVector<const UInt64 *> unPackSizesPointers;
|
||||||
|
packSizesPointers.Reserve(numInStreams);
|
||||||
|
unPackSizesPointers.Reserve(numOutStreams);
|
||||||
|
UInt32 j;
|
||||||
|
for (j = 0; j < numOutStreams; j++, unPackStreamIndex++)
|
||||||
|
unPackSizesPointers.Add(&folderInfo.UnPackSizes[unPackStreamIndex]);
|
||||||
|
|
||||||
|
for (j = 0; j < numInStreams; j++, packStreamIndex++)
|
||||||
|
{
|
||||||
|
int bindPairIndex = folderInfo.FindBindPairForInStream(packStreamIndex);
|
||||||
|
if (bindPairIndex >= 0)
|
||||||
|
packSizesPointers.Add(
|
||||||
|
&folderInfo.UnPackSizes[(UInt32)folderInfo.BindPairs[bindPairIndex].OutIndex]);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int index = folderInfo.FindPackStreamArrayIndex(packStreamIndex);
|
||||||
|
if (index < 0)
|
||||||
|
return E_FAIL;
|
||||||
|
packSizesPointers.Add(&packSizes[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_mixerCoderCommon->SetCoderInfo(i,
|
||||||
|
&packSizesPointers.Front(),
|
||||||
|
&unPackSizesPointers.Front());
|
||||||
|
}
|
||||||
|
UInt32 mainCoder, temp;
|
||||||
|
bindInfo.FindOutStream(bindInfo.OutStreams[0], mainCoder, temp);
|
||||||
|
|
||||||
|
if (_multiThread)
|
||||||
|
_mixerCoderMTSpec->SetProgressCoderIndex(mainCoder);
|
||||||
|
/*
|
||||||
|
else
|
||||||
|
_mixerCoderSTSpec->SetProgressCoderIndex(mainCoder);;
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (numCoders == 0)
|
||||||
|
return 0;
|
||||||
|
CRecordVector<ISequentialInStream *> inStreamPointers;
|
||||||
|
inStreamPointers.Reserve(inStreams.Size());
|
||||||
|
for (i = 0; i < inStreams.Size(); i++)
|
||||||
|
inStreamPointers.Add(inStreams[i]);
|
||||||
|
ISequentialOutStream *outStreamPointer = outStream;
|
||||||
|
return _mixerCoder->Code(&inStreamPointers.Front(), NULL,
|
||||||
|
inStreams.Size(), &outStreamPointer, NULL, 1, compressProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
71
app/win/installer/7zstub/src/7zip/Archive/7z/7zDecode.h
Normal file
71
app/win/installer/7zstub/src/7zip/Archive/7z/7zDecode.h
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
// 7zDecode.h
|
||||||
|
|
||||||
|
#ifndef __7Z_DECODE_H
|
||||||
|
#define __7Z_DECODE_H
|
||||||
|
|
||||||
|
#include "../../IStream.h"
|
||||||
|
#include "../../IPassword.h"
|
||||||
|
|
||||||
|
#include "../Common/CoderMixer2.h"
|
||||||
|
#include "../Common/CoderMixer2MT.h"
|
||||||
|
#ifdef _ST_MODE
|
||||||
|
#include "../Common/CoderMixer2ST.h"
|
||||||
|
#endif
|
||||||
|
#ifndef EXCLUDE_COM
|
||||||
|
#include "../Common/CoderLoader.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "7zItem.h"
|
||||||
|
|
||||||
|
namespace NArchive {
|
||||||
|
namespace N7z {
|
||||||
|
|
||||||
|
struct CBindInfoEx: public NCoderMixer2::CBindInfo
|
||||||
|
{
|
||||||
|
CRecordVector<CMethodID> CoderMethodIDs;
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
CBindInfo::Clear();
|
||||||
|
CoderMethodIDs.Clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class CDecoder
|
||||||
|
{
|
||||||
|
#ifndef EXCLUDE_COM
|
||||||
|
CCoderLibraries _libraries;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool _bindInfoExPrevIsDefinded;
|
||||||
|
CBindInfoEx _bindInfoExPrev;
|
||||||
|
|
||||||
|
bool _multiThread;
|
||||||
|
#ifdef _ST_MODE
|
||||||
|
NCoderMixer2::CCoderMixer2ST *_mixerCoderSTSpec;
|
||||||
|
#endif
|
||||||
|
NCoderMixer2::CCoderMixer2MT *_mixerCoderMTSpec;
|
||||||
|
NCoderMixer2::CCoderMixer2 *_mixerCoderCommon;
|
||||||
|
|
||||||
|
CMyComPtr<ICompressCoder2> _mixerCoder;
|
||||||
|
CObjectVector<CMyComPtr<IUnknown> > _decoders;
|
||||||
|
// CObjectVector<CMyComPtr<ICompressCoder2> > _decoders2;
|
||||||
|
public:
|
||||||
|
CDecoder(bool multiThread);
|
||||||
|
HRESULT Decode(IInStream *inStream,
|
||||||
|
UInt64 startPos,
|
||||||
|
const UInt64 *packSizes,
|
||||||
|
const CFolder &folder,
|
||||||
|
ISequentialOutStream *outStream,
|
||||||
|
ICompressProgressInfo *compressProgress
|
||||||
|
#ifndef _NO_CRYPTO
|
||||||
|
, ICryptoGetTextPassword *getTextPasswordSpec
|
||||||
|
#endif
|
||||||
|
#ifdef COMPRESS_MT
|
||||||
|
, bool mtMode, UInt32 numThreads
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
265
app/win/installer/7zstub/src/7zip/Archive/7z/7zExtract.cpp
Normal file
265
app/win/installer/7zstub/src/7zip/Archive/7z/7zExtract.cpp
Normal file
|
@ -0,0 +1,265 @@
|
||||||
|
// 7zExtract.cpp
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#include "7zHandler.h"
|
||||||
|
#include "7zFolderOutStream.h"
|
||||||
|
#include "7zMethods.h"
|
||||||
|
#include "7zDecode.h"
|
||||||
|
// #include "7z1Decode.h"
|
||||||
|
|
||||||
|
#include "../../../Common/ComTry.h"
|
||||||
|
#include "../../Common/StreamObjects.h"
|
||||||
|
#include "../../Common/ProgressUtils.h"
|
||||||
|
#include "../../Common/LimitedStreams.h"
|
||||||
|
|
||||||
|
namespace NArchive {
|
||||||
|
namespace N7z {
|
||||||
|
|
||||||
|
struct CExtractFolderInfo
|
||||||
|
{
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
int VolumeIndex;
|
||||||
|
#endif
|
||||||
|
CNum FileIndex;
|
||||||
|
CNum FolderIndex;
|
||||||
|
CBoolVector ExtractStatuses;
|
||||||
|
UInt64 UnPackSize;
|
||||||
|
CExtractFolderInfo(
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
int volumeIndex,
|
||||||
|
#endif
|
||||||
|
CNum fileIndex, CNum folderIndex):
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
VolumeIndex(volumeIndex),
|
||||||
|
#endif
|
||||||
|
FileIndex(fileIndex),
|
||||||
|
FolderIndex(folderIndex),
|
||||||
|
UnPackSize(0)
|
||||||
|
{
|
||||||
|
if (fileIndex != kNumNoIndex)
|
||||||
|
{
|
||||||
|
ExtractStatuses.Reserve(1);
|
||||||
|
ExtractStatuses.Add(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||||
|
Int32 testModeSpec, IArchiveExtractCallback *extractCallbackSpec)
|
||||||
|
{
|
||||||
|
COM_TRY_BEGIN
|
||||||
|
bool testMode = (testModeSpec != 0);
|
||||||
|
CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
|
||||||
|
UInt64 importantTotalUnPacked = 0;
|
||||||
|
|
||||||
|
bool allFilesMode = (numItems == UInt32(-1));
|
||||||
|
if (allFilesMode)
|
||||||
|
numItems =
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
_refs.Size();
|
||||||
|
#else
|
||||||
|
_database.Files.Size();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(numItems == 0)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(_volumes.Size() != 1)
|
||||||
|
return E_FAIL;
|
||||||
|
const CVolume &volume = _volumes.Front();
|
||||||
|
const CArchiveDatabaseEx &_database = volume.Database;
|
||||||
|
IInStream *_inStream = volume.Stream;
|
||||||
|
*/
|
||||||
|
|
||||||
|
CObjectVector<CExtractFolderInfo> extractFolderInfoVector;
|
||||||
|
for(UInt32 ii = 0; ii < numItems; ii++)
|
||||||
|
{
|
||||||
|
// UInt32 fileIndex = allFilesMode ? indexIndex : indices[indexIndex];
|
||||||
|
UInt32 ref2Index = allFilesMode ? ii : indices[ii];
|
||||||
|
// const CRef2 &ref2 = _refs[ref2Index];
|
||||||
|
|
||||||
|
// for(UInt32 ri = 0; ri < ref2.Refs.Size(); ri++)
|
||||||
|
{
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
// const CRef &ref = ref2.Refs[ri];
|
||||||
|
const CRef &ref = _refs[ref2Index];
|
||||||
|
|
||||||
|
int volumeIndex = ref.VolumeIndex;
|
||||||
|
const CVolume &volume = _volumes[volumeIndex];
|
||||||
|
const CArchiveDatabaseEx &database = volume.Database;
|
||||||
|
UInt32 fileIndex = ref.ItemIndex;
|
||||||
|
#else
|
||||||
|
const CArchiveDatabaseEx &database = _database;
|
||||||
|
UInt32 fileIndex = ref2Index;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CNum folderIndex = database.FileIndexToFolderIndexMap[fileIndex];
|
||||||
|
if (folderIndex == kNumNoIndex)
|
||||||
|
{
|
||||||
|
extractFolderInfoVector.Add(CExtractFolderInfo(
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
volumeIndex,
|
||||||
|
#endif
|
||||||
|
fileIndex, kNumNoIndex));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (extractFolderInfoVector.IsEmpty() ||
|
||||||
|
folderIndex != extractFolderInfoVector.Back().FolderIndex
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
|| volumeIndex != extractFolderInfoVector.Back().VolumeIndex
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
extractFolderInfoVector.Add(CExtractFolderInfo(
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
volumeIndex,
|
||||||
|
#endif
|
||||||
|
kNumNoIndex, folderIndex));
|
||||||
|
const CFolder &folderInfo = database.Folders[folderIndex];
|
||||||
|
UInt64 unPackSize = folderInfo.GetUnPackSize();
|
||||||
|
importantTotalUnPacked += unPackSize;
|
||||||
|
extractFolderInfoVector.Back().UnPackSize = unPackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
CExtractFolderInfo &efi = extractFolderInfoVector.Back();
|
||||||
|
|
||||||
|
// const CFolderInfo &folderInfo = m_dam_Folders[folderIndex];
|
||||||
|
CNum startIndex = database.FolderStartFileIndex[folderIndex];
|
||||||
|
for (CNum index = efi.ExtractStatuses.Size();
|
||||||
|
index <= fileIndex - startIndex; index++)
|
||||||
|
{
|
||||||
|
// UInt64 unPackSize = _database.Files[startIndex + index].UnPackSize;
|
||||||
|
// Count partial_folder_size
|
||||||
|
// efi.UnPackSize += unPackSize;
|
||||||
|
// importantTotalUnPacked += unPackSize;
|
||||||
|
efi.ExtractStatuses.Add(index == fileIndex - startIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extractCallback->SetTotal(importantTotalUnPacked);
|
||||||
|
|
||||||
|
CDecoder decoder(
|
||||||
|
#ifdef _ST_MODE
|
||||||
|
false
|
||||||
|
#else
|
||||||
|
true
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
// CDecoder1 decoder;
|
||||||
|
|
||||||
|
UInt64 currentImportantTotalUnPacked = 0;
|
||||||
|
UInt64 totalFolderUnPacked;
|
||||||
|
|
||||||
|
for(int i = 0; i < extractFolderInfoVector.Size(); i++,
|
||||||
|
currentImportantTotalUnPacked += totalFolderUnPacked)
|
||||||
|
{
|
||||||
|
const CExtractFolderInfo &efi = extractFolderInfoVector[i];
|
||||||
|
totalFolderUnPacked = efi.UnPackSize;
|
||||||
|
|
||||||
|
RINOK(extractCallback->SetCompleted(¤tImportantTotalUnPacked));
|
||||||
|
|
||||||
|
CFolderOutStream *folderOutStream = new CFolderOutStream;
|
||||||
|
CMyComPtr<ISequentialOutStream> outStream(folderOutStream);
|
||||||
|
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
const CVolume &volume = _volumes[efi.VolumeIndex];
|
||||||
|
const CArchiveDatabaseEx &database = volume.Database;
|
||||||
|
#else
|
||||||
|
const CArchiveDatabaseEx &database = _database;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CNum startIndex;
|
||||||
|
if (efi.FileIndex != kNumNoIndex)
|
||||||
|
startIndex = efi.FileIndex;
|
||||||
|
else
|
||||||
|
startIndex = database.FolderStartFileIndex[efi.FolderIndex];
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT result = folderOutStream->Init(&database,
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
volume.StartRef2Index,
|
||||||
|
#else
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
startIndex,
|
||||||
|
&efi.ExtractStatuses, extractCallback, testMode);
|
||||||
|
|
||||||
|
RINOK(result);
|
||||||
|
|
||||||
|
if (efi.FileIndex != kNumNoIndex)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CNum folderIndex = efi.FolderIndex;
|
||||||
|
const CFolder &folderInfo = database.Folders[folderIndex];
|
||||||
|
|
||||||
|
CLocalProgress *localProgressSpec = new CLocalProgress;
|
||||||
|
CMyComPtr<ICompressProgressInfo> progress = localProgressSpec;
|
||||||
|
localProgressSpec->Init(extractCallback, false);
|
||||||
|
|
||||||
|
CLocalCompressProgressInfo *localCompressProgressSpec =
|
||||||
|
new CLocalCompressProgressInfo;
|
||||||
|
CMyComPtr<ICompressProgressInfo> compressProgress = localCompressProgressSpec;
|
||||||
|
localCompressProgressSpec->Init(progress, NULL, ¤tImportantTotalUnPacked);
|
||||||
|
|
||||||
|
CNum packStreamIndex = database.FolderStartPackStreamIndex[folderIndex];
|
||||||
|
UInt64 folderStartPackPos = database.GetFolderStreamPos(folderIndex, 0);
|
||||||
|
|
||||||
|
#ifndef _NO_CRYPTO
|
||||||
|
CMyComPtr<ICryptoGetTextPassword> getTextPassword;
|
||||||
|
if (extractCallback)
|
||||||
|
extractCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HRESULT result = decoder.Decode(
|
||||||
|
#ifdef _7Z_VOL
|
||||||
|
volume.Stream,
|
||||||
|
#else
|
||||||
|
_inStream,
|
||||||
|
#endif
|
||||||
|
folderStartPackPos,
|
||||||
|
&database.PackSizes[packStreamIndex],
|
||||||
|
folderInfo,
|
||||||
|
outStream,
|
||||||
|
compressProgress
|
||||||
|
#ifndef _NO_CRYPTO
|
||||||
|
, getTextPassword
|
||||||
|
#endif
|
||||||
|
#ifdef COMPRESS_MT
|
||||||
|
, true, _numThreads
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == S_FALSE)
|
||||||
|
{
|
||||||
|
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (result == E_NOTIMPL)
|
||||||
|
{
|
||||||
|
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (result != S_OK)
|
||||||
|
return result;
|
||||||
|
if (folderOutStream->WasWritingFinished() != S_OK)
|
||||||
|
{
|
||||||
|
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
COM_TRY_END
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue