├── .gitignore
├── CODEOWNERS
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── config.json.sample
├── hooks
├── after.sh
├── after_build.sh
└── before.sh
├── nwjs-build.sh
├── pack.sh
└── resources
├── linux
├── .gitkeep
└── PKGNAME-VERSION-Linux
│ ├── PKGNAME
│ └── PKGNAME
│ ├── README
│ ├── setup
│ └── share
│ ├── applications
│ └── PKGNAME.desktop
│ └── menu
│ └── PKGNAME
├── osx
└── .gitkeep
└── windows
└── app.nsi
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .gitignore support plugin (hsz.mobi)
2 | ### OSX template
3 | .DS_Store
4 | .AppleDouble
5 | .LSOverride
6 |
7 | # Icon must end with two \r
8 | Icon
9 |
10 | # Thumbnails
11 | ._*
12 |
13 | # Files that might appear on external disk
14 | .Spotlight-V100
15 | .Trashes
16 |
17 | # Directories potentially created on remote AFP share
18 | .AppleDB
19 | .AppleDesktop
20 | Network Trash Folder
21 | Temporary Items
22 | .apdisk
23 |
24 |
25 | ### Node template
26 | # Logs
27 | logs
28 | *.log
29 |
30 | # Runtime data
31 | pids
32 | *.pid
33 | *.seed
34 |
35 | # Directory for instrumented libs generated by jscoverage/JSCover
36 | lib-cov
37 |
38 | # Coverage directory used by tools like istanbul
39 | coverage
40 |
41 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
42 | .grunt
43 |
44 | # node-waf configuration
45 | .lock-wscript
46 |
47 | # Compiled binary addons (http://nodejs.org/api/addons.html)
48 | build/Release
49 |
50 | # Dependency directory
51 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
52 | node_modules
53 |
54 |
55 | ### JetBrains template
56 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
57 |
58 | *.iml
59 |
60 | ## Directory-based project format:
61 | .idea/
62 | # if you remove the above rule, at least ignore the following:
63 |
64 | # User-specific stuff:
65 | # .idea/workspace.xml
66 | # .idea/tasks.xml
67 | # .idea/dictionaries
68 |
69 | # Sensitive or high-churn files:
70 | # .idea/dataSources.ids
71 | # .idea/dataSources.xml
72 | # .idea/sqlDataSources.xml
73 | # .idea/dynamic.xml
74 | # .idea/uiDesigner.xml
75 |
76 | # Gradle:
77 | # .idea/gradle.xml
78 | # .idea/libraries
79 |
80 | # Mongo Explorer plugin:
81 | # .idea/mongoSettings.xml
82 |
83 | ## File-based project format:
84 | *.ipr
85 | *.iws
86 |
87 | ## Plugin-specific files:
88 |
89 | # IntelliJ
90 | out/
91 |
92 | # mpeltonen/sbt-idea plugin
93 | .idea_modules/
94 |
95 | # JIRA plugin
96 | atlassian-ide-plugin.xml
97 |
98 | # Crashlytics plugin (for Android Studio and IntelliJ)
99 | com_crashlytics_export_strings.xml
100 | crashlytics.properties
101 | crashlytics-build.properties
102 |
103 |
104 | ### Linux template
105 | *~
106 |
107 | # KDE directory preferences
108 | .directory
109 |
110 | # project related
111 | TMP/
112 | nwjs_download_cache
113 | releases/
114 |
115 | config.json
116 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @ayushmanchhabra
2 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # "No Ideologies" Code of Conduct
2 |
3 | The following are the guidelines we expect our community members and maintainers to follow.
4 |
5 | * * *
6 |
7 | ## Terminology and Scope
8 |
9 | **What defines a "maintainer"?**
10 |
11 | * A maintainer is anyone that interacts with the community on behalf of this project. Amount of code written is not a qualifier. A maintainer may include those who solely help in support roles such as in resolving issues, improving documentation, administrating or moderating forums/chatrooms, or any other non-coding specific roles. Maintainers also include those that are responsible for the building and upkeep of the project.
12 |
13 | **What defines a "community member"?**
14 |
15 | * Anyone interacting with this project directly, including maintainers.
16 |
17 | **What is the scope of these guidelines?**
18 |
19 | * These guidelines apply only to this project and forms of communication directly related to it, such as issue trackers, forums, chatrooms, and in person events specific to this project. If a member is violating these guidelines outside of this project or on other platforms, that is beyond our scope and any grievances should be handled on those platforms.
20 |
21 | **Discussing the guidelines:**
22 |
23 | * Discussions around these guidelines, improving, updating, or altering them, is permitted so long as the discussions do not violate any existing guidelines.
24 |
25 | * * *
26 |
27 | ## Guidelines
28 |
29 | ### Guidelines for community members
30 |
31 | This project is technical in nature and not based around any particular non-technical ideology. As such, communication that is based primarily around ideologies unrelated to the technologies used by this repository are not permitted.
32 |
33 | Any discussion or communication that is primarily focused around an ideology, be it about race, gender, politics, religion, or anything else non-technical, is not allowed. Everyone has their own ideological preferences, beliefs, and opinions. We do not seek to marginalize, exclude, or judge anyone for their ideologies. To prevent conflict between those with differing or opposing ideologies, all communication on these subjects are prohibited. Some discussions around these topics may be important, however this project is not the proper channel for these discussions.
34 |
35 | ### Guidelines for maintainers
36 |
37 | * Maintainers must abide by the same rules as all other community members mentioned above. However, in addition, maintainers are held to a higher standard, explained below.
38 | * Maintainers should answer all questions politely.
39 | * If someone is upset or angry about something, it's probably because it's difficult to use, so thank them for bringing it to your attention and address ways to solve the problem. Maintainers should focus on the content of the message, and not on how it was delivered.
40 | * A maintainer should seek to update members when an issue they brought up is resolved.
41 |
42 | * * *
43 |
44 | ## Appropriate response to violations
45 |
46 | How to respond to a community member or maintainer violating a guideline.
47 |
48 | 1. If an issue is created that violates a guideline a maintainer should close and lock the issue, explaining "This issue is in violation of our code of conduct. Please review it before posting again." with a link to this document.
49 | 1. If a member repeatedly violates the guidelines established in this document, they should be politely warned that continuing to violate the rules may result in being banned from the community. This means revoking access and support to interactions relating directly to the project (issue trackers, chatrooms, forums, in person events, etc.). However, they may continue to use the technology in accordance with its license.
50 | 1. If a maintainer is in violation of a guideline, they should be informed of such with a link to this document. If additional actions are required of the maintainer but not taken, then other maintainers should be informed of these inactions.
51 | 1. If a maintainer repeatedly violates the guidelines established in this document, they should be politely warned that continuing to violate the rules may result in being banned from the community. This means revoking access and support to interactions relating directly to the project (issue trackers, chatrooms, forums, in person events, etc.). However, they may continue to use the technology in accordance with its license. In addition, future contributions to this project may be ignored as well.
52 |
53 | * * *
54 |
55 | Based on version 1.0.3 from https://github.com/CodifiedConduct/coc-no-ideologies
56 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | > This repository is in maintainance mode. Bug fixes will be provided on a best effort basis. If you use this project, please consider contributing back.
2 |
3 | # nwjs application shell builder and packager
4 |
5 | What's in here:
6 |
7 | - [Builder script](#nwjs-shell-builder-script)
8 | - [How it works](#how-it-works)
9 | - [How we use it](#how-we-use-it)
10 | - [Usage](#usage)
11 | - [Options](#options)
12 | - [Examples](#examples)
13 | - [The bare minimum to build](#the-bare-minimum-to-build)
14 | - [Clean working dir](#clean-working-dir)
15 | - [Build for all targets](#build-for-all-targets)
16 | - [Build only for windows 64 and 32 bit targets](#build-only-for-windows-64-and-32-bit-targets)
17 | - [build only for OSX 32 bit target](#build-only-for-osx-32-bit-target)
18 | - [Build for all 64 bit](#build-only-for-all-64-bit)
19 | - [Packaging script](#nwjs-packaging-script-currently-in-beta) _(currently in **BETA**)_
20 | - [Hooks](#hooks)
21 | - [Usage](#usage-1)
22 | - [License](#license)
23 | - [Thanks](#thanks)
24 |
25 | ## nwjs shell builder script
26 | nwjs shell script builder for nwjs (node-webkit) applications.
27 |
28 | This script can be easily integrated into your build process.
29 |
30 | ### How it works
31 | It will download nwjs 32/64bit for Linux, Windows and OSX and build for all 3 platforms from given source directory
32 |
33 | ### How we use it
34 | This script was made to help us automate nightly builds of [Gisto](http://www.gistoapp.com)
35 |
36 | You can see example usage in the CI script in Gisto repository: [drone.io script](https://github.com/Gisto/Gisto/blob/master/droneIO.sh)
37 |
38 | ### Usage:
39 | > If you want/have to build on Windows machine, use: [Babun](http://babun.github.io/) as your shell. Tested on Windows 8 but should work on Windows 7 too. If you're missing an package (like ZIP), just install it via Babun with `pact` - a Babun provided package manager.
40 |
41 | `$ /path/to/nwjs-build.sh --help`
42 |
43 | #### Options:
44 |
45 | Option | Description
46 | :------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
47 | `-h, --help` | Show help and usage
48 | `--version=PACKAGE_VERSION` | Set package version (defaults to 1.0.0)
49 | `--name=NAME` | Set package name (if not set - default will be used)
50 | `--src=/PATH/TO/DIR` | Set path to source dir
51 | `--target="2 3"` | Build for particular OS or all (default is to build for all targets)
Available targets:
- 0 - linux-ia32
- 1 - linux-x64
- 2 - win-ia32
- 3 - win-x64
- 4 - osx-ia32
- 5 - osx-x64
52 | `--nw=VERSION` | Set nwjs version to use (if not set - default will be used)
53 | `--output-dir=/PATH/TO/DIR` | Change output directory (if not set - default will be used)
54 | `--win-icon=/PATH/TO/FILE` | (For Windows target only) Path to .ico file (if not set - default will be used)
55 | `--osx-icon=/PATH/TO/FILE` | (For OSX target only) Path to .icns file (if not set - default will be used)
56 | `--CFBundleIdentifier=com.bundle.name` | (For OSX target only) Name of the [bundle’s Identifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) (if not set - default will be used)
57 | `--libudev` | (For Linux target only) Use if you want the script to handle the lack of _libudev.so.0_ (linux targets) as mentioned [here](https://github.com/nwjs/nw.js/wiki/The-solution-of-lacking-libudev.so.0)
58 | `--build` | Start the build process (**IMPORTANT!** Must be the last parameter of the command)
59 | `--clean` | Clean and remove TMP directory
60 |
61 | #### Examples
62 | ========================
63 |
64 | ##### The bare minimum to build:
65 |
66 | ```
67 | $ ./path/to/nwjs-build.sh \
68 | --src=/home/projects/PACKAGE_NAME/src \
69 | --build
70 | ```
71 |
72 | ##### Clean working dir:
73 |
74 | ```
75 | $ ./path/to/nwjs-build.sh \
76 | --clean
77 | ```
78 |
79 | ##### Build for all targets:
80 |
81 | ```
82 | $ ./path/to/nwjs-build.sh \
83 | --src=/home/projects/PACKAGE_NAME/src \
84 | --output-dir=/path/to/output/the/builds \
85 | --name=PACKAGE_NAME \
86 | --win-icon=/home/projects/resorses/icon.ico \
87 | --osx-icon=/home/projects/resorses/icon.icns \
88 | --CFBundleIdentifier=com.bundle.name \
89 | --target="0 1 2 3 4 5" \
90 | --version="1.0.0" \
91 | --libudev \
92 | --nw=0.11.6 \
93 | --build
94 | ```
95 |
96 | ##### Build only for windows 64 and 32 bit targets:
97 |
98 | ```
99 | $ ./path/to/nwjs-build.sh \
100 | --src=/home/projects/PACKAGE_NAME/src \
101 | --output-dir=/path/to/output/the/builds \
102 | --name=PACKAGE_NAME \
103 | --win-icon=/home/projects/resorses/icon.ico \
104 | --target="2 3" \
105 | --version="1.0.0" \
106 | --build
107 | ```
108 |
109 | ##### Build only for osx 32 bit target:
110 |
111 | ```
112 | $ ./path/to/nwjs-build.sh \
113 | --src=/home/projects/PACKAGE_NAME/src \
114 | --output-dir=/path/to/output/the/builds \
115 | --name=PACKAGE_NAME \
116 | --osx-icon=/home/projects/resorses/icon.icns \
117 | --CFBundleIdentifier=com.bundle.name \
118 | --target="4" \
119 | --version="1.0.0" \
120 | --build
121 | ```
122 |
123 | ##### Build for all 64 bit:
124 |
125 | ```
126 | $ ./path/to/nwjs-build.sh \
127 | --src=/home/projects/PACKAGE_NAME/src \
128 | --output-dir=/path/to/output/the/builds \
129 | --name=PACKAGE_NAME \
130 | --osx-icon=/home/projects/resorses/icon.icns \
131 | --win-icon=/home/projects/resorses/icon.ico \
132 | --CFBundleIdentifier=com.bundle.name \
133 | --target="1 3 5 " \
134 | --version="1.0.0" \
135 | --libudev \
136 | --build
137 | ```
138 |
139 | ## NWJS packaging script _(currently in **BETA**)_
140 |
141 | > :exclamation: Please note that this is currently in BETA and it is not affecting the `build` script. You may off course use it but beta warning applies with all consequenses, so don't expect it to work out-of-the-box.
142 |
143 | - install if not present zip, unzip, tar, git, NSIS, libxml2
144 | - rename `config.json.sample` to `config.json` and adjust correct paths or generate with `./pack.sh init` or specify location of the `config.json` by adding `--config=/path/to/config.json`
145 |
146 | ### Usage:
147 |
148 | `./pack.sh init` - generate `config.json` with interactive CMD
149 |
150 | `./pack.sh --windows` - to build Windows installers
151 |
152 | `./pack.sh --linux` - to build Linux installers
153 |
154 | `./pack.sh --osx` - to build OSX installers
155 |
156 | `./pack.sh --all` - to build installers for all systems
157 |
158 | `./pack.sh --all --config=/path/to/config.json` - to build installers for all systems but using `config.json` located in any other path than in root directory
159 |
160 | `./pack.sh --clean` - removes the `./TMP` working directory
161 |
162 | `./pack.sh --clean all` - removes the `./TMP` working directory and `releases` directory (with all the content)
163 |
164 | ### Hooks:
165 |
166 | Place hooks in `./hooks/` directory
167 |
168 | - file name `before.sh` will be executed before each build start
169 | - file name `after.sh` will be executed after packaging script is finished
170 | - file name `after_build.sh` will be executed after each platform build is finished
171 |
172 | #### License
173 | [MIT](https://github.com/Gisto/nwjs-shell-builder/blob/master/LICENSE)
174 |
175 | # Thanks
176 | Huge thanks to @SchizoDuckie for assisting with OSX build
177 |
--------------------------------------------------------------------------------
/config.json.sample:
--------------------------------------------------------------------------------
1 | {
2 | "name": "MyApp",
3 | "version": "1.0.0",
4 | "description": "My app description",
5 | "src": "/path/to/app/dist",
6 | "nwjsVersion": "0.12.2",
7 | "iconPath": "/path/to/png/icon/file/icon.png",
8 | "windowsIconPath": "/path/to/ico/icon/file/icon.ico",
9 | "osxIconPath": "/path/to/icns/icon/file/gisto.icns",
10 | "osxBgPath": "/path/to/background.png/file",
11 | "CFBundleIdentifier": "com.myapp.app",
12 | "license": "/path/to/LICENSE"
13 | }
14 |
--------------------------------------------------------------------------------
/hooks/after.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # echo 'I am "after" hook in action';
--------------------------------------------------------------------------------
/hooks/after_build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # echo 'I am "after_build" hook in action';
--------------------------------------------------------------------------------
/hooks/before.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # echo 'I am "before" hook in action';
--------------------------------------------------------------------------------
/nwjs-build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | ######################################################################
3 | # nwjs shell build script #
4 | ######################################################################
5 | # For usage see: ./nwjs-build.sh --help #
6 | ######################################################################
7 |
8 | SCRIPT_VER='1.0.4'
9 |
10 | # Current working directory
11 | WORKING_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)";
12 |
13 | # LOCAL mode is usefull when:
14 | # * You're testing the script and you don't want to download NW archives every time
15 | # * You have the archives localy
16 | # default is "FALSE"
17 | LOCAL_NW_ARCHIVES_MODE=false
18 | LOCAL_NW_ARCHIVES_PATH="${WORKING_DIR}/nwjs_download_cache"
19 |
20 | # Default nwjs version
21 | NW_VERSION='0.11.6';
22 |
23 | # Base domain for nwjs download server
24 | DL_URL="http://dl.nwjs.io"
25 |
26 | # Temporary directory where all happens (relative to current directory where this script running from)
27 | # This directory will be auto created
28 | TMP="TMP"
29 |
30 | # Sorces directory path
31 | PKG_SRC="../../dist"
32 |
33 | # Build target(s)
34 | # 0 - linux-ia32
35 | # 1 - linux-x64
36 | # 2 - win-ia32
37 | # 3 - win-x64
38 | # 4 - osx-x64
39 | TARGET="0 1 2 3 4"
40 |
41 | # Final output directory (relative to current directory where this script running from)
42 | RELEASE_DIR="${WORKING_DIR}/${TMP}/output"
43 |
44 | # Icons and other resources
45 | OSX_RESOURCE_ICNS="../build/resources/osx/gisto.icns"
46 | WIN_RESOURCE_ICO="../../app/icon.ico"
47 |
48 | # Date on the package archive as PkgName-YYYYMMDD-OS-architecture.zip
49 | DATE=$(date +"%Y%m%d")
50 |
51 | # Name of your package
52 | PKG_NAME="${USER}app"
53 |
54 | # Package version
55 | PKG_VERSION="1.0.0"
56 |
57 | CFBundleIdentifier="com.${PKG_NAME}"
58 |
59 | # Handle libudev on linux
60 | LIBUDEV_HANDLER=false
61 |
62 | # --------------------------------------------------------------------
63 | # Guess you should not need to edit bellow this comment block
64 | # Unless you really want/need to
65 | # --------------------------------------------------------------------
66 |
67 | ARR_OS[0]="linux-ia32"
68 | ARR_OS[1]="linux-x64"
69 | ARR_OS[2]="win-ia32"
70 | ARR_OS[3]="win-x64"
71 | ARR_OS[4]="osx-x64"
72 |
73 | ARR_DL_EXT[0]="tar.gz"
74 | ARR_DL_EXT[1]="tar.gz"
75 | ARR_DL_EXT[2]="zip"
76 | ARR_DL_EXT[3]="zip"
77 | ARR_DL_EXT[4]="zip"
78 |
79 | ARR_EXTRACT_COMMAND[0]="tar"
80 | ARR_EXTRACT_COMMAND[1]="tar"
81 | ARR_EXTRACT_COMMAND[2]="zip"
82 | ARR_EXTRACT_COMMAND[3]="zip"
83 | ARR_EXTRACT_COMMAND[4]="zip"
84 |
85 | TXT_BOLD="\e[1m"
86 | TXT_NORMAL="\e[1m"
87 | TXT_RED="\e[31m"
88 | TXT_BLUE="\e[34m"
89 | TXT_GREEN="\e[32m"
90 | TXT_YELLO="\e[93m"
91 | TXT_RESET="\e[0m"
92 | TXT_NOTE="\e[30;48;5;82m"
93 |
94 | usage() {
95 | cat < ./nwjs-build.sh \\
187 | --src=${HOME}/projects/${PKG_NAME}/src \\
188 | --build
189 |
190 | BUILD FOR ALL TARGETS:
191 |
192 | SHELL> ./nwjs-build.sh \\
193 | --src=${HOME}/projects/${PKG_NAME}/src \\
194 | --output-dir=${HOME}/${PKG_NAME} \\
195 | --name=${PKG_NAME} \\
196 | --win-icon=${HOME}/projects/resorses/icon.ico \\
197 | --osx-icon=${HOME}/projects/resorses/icon.icns \\
198 | --CFBundleIdentifier=com.bundle.name \\
199 | --target="0 1 2 3 4" \\
200 | --version="1.0.0" \\
201 | --libudev \\
202 | --nw=0.11.6 \\
203 | --build
204 |
205 | BUILD ONLY FOR WINDOWS 64 AND 32 BIT TARGETS:
206 |
207 | SHELL> ./nwjs-build.sh \\
208 | --src=${HOME}/projects/${PKG_NAME}/src \\
209 | --output-dir=${HOME}/${PKG_NAME} \\
210 | --name=${PKG_NAME} \\
211 | --win-icon=${HOME}/projects/resorses/icon.ico \\
212 | --target="2 3" \\
213 | --version="1.0.0" \\
214 | --build
215 |
216 | BUILD ONLY FOR OSX 64 BIT TARGET:
217 |
218 | SHELL> ./nwjs-build.sh \\
219 | --src=${HOME}/projects/${PKG_NAME}/src \\
220 | --output-dir=${HOME}/${PKG_NAME} \\
221 | --name=${PKG_NAME} \\
222 | --osx-icon=${HOME}/projects/resorses/icon.icns \\
223 | --target="4" \\
224 | --version="1.0.0" \\
225 | --build
226 |
227 | BUILD ONLY FOR ALL 64 BIT
228 |
229 | SHELL> ./nwjs-build.sh \\
230 | --src=${HOME}/projects/${PKG_NAME}/src \\
231 | --output-dir=${HOME}/${PKG_NAME} \\
232 | --name=${PKG_NAME} \\
233 | --osx-icon=${HOME}/projects/resorses/icon.icns \\
234 | --win-icon=${HOME}/projects/resorses/icon.ico \\
235 | --target="1 3 4 " \\
236 | --version="1.0.0" \\
237 | --libudev \\
238 | --build
239 |
240 | LICENSE
241 |
242 | MIT
243 |
244 | $(cat ${WORKING_DIR}/LICENSE)
245 |
246 | EOF
247 | }
248 |
249 | NOTE () {
250 | printf "\n";
251 | printf "${TXT_NOTE} ${1} ${TXT_RESET} "
252 | printf "\n";
253 | }
254 |
255 | upper_case_word() {
256 | word=${1}
257 | therest=$(tr '[a-z]' '[A-Z]'<<<"${word:0:1}")
258 | echo "${therest}${word:1}"
259 | }
260 |
261 | clean() {
262 | rm -rf ${WORKING_DIR}/${TMP};
263 | NOTE "Removed \"${WORKING_DIR}/${TMP}\" directory and it's content";
264 | }
265 |
266 | extractme() {
267 | if [[ ${1} = "zip" ]]; then
268 | unzip -qq ${2} -d ${3};
269 | else
270 | tar xzf ${2} -C ${3};
271 | fi
272 | }
273 |
274 | split_string() {
275 | #USAGE: `split_string $string ,` - the comma here is the separator. Also see `man cut`
276 | echo "$1" | cut -d"$2" -f1;
277 | }
278 |
279 | make_bins() {
280 | mkdir -p ${RELEASE_DIR}
281 | local make_os=`split_string "${1}" "-"`;
282 | if [[ ${make_os} = "linux" ]]; then
283 | mk_linux ${1};
284 | elif [[ ${make_os} = "win" ]]; then
285 | mk_windows ${1};
286 | elif [[ ${make_os} = "osx" ]]; then
287 | mk_osx ${1};
288 | else
289 | printf "\nNo such target\n";
290 | exit 1;
291 | fi
292 | }
293 |
294 | mk_linux() {
295 | cat ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/nw ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw > ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}
296 | rm ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw
297 | chmod +x ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}
298 | cp -R ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/* ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/
299 | cd ${WORKING_DIR}/${TMP}/${1}/latest-git
300 |
301 | if [[ ${LIBUDEV_HANDLER} = "true" ]];then
302 | #libudev handler here
303 | mv ${PKG_NAME} ${PKG_NAME}-bin
304 | cat << 'gisto_libudev_helper' >> ./${PKG_NAME}
305 | #!/bin/bash
306 | APP_WRAPPER="`readlink -f "${0}"`"
307 | HERE="`dirname "${APP_WRAPPER}"`"
308 | paths=(
309 | "/lib/x86_64-linux-gnu/libudev.so.1" # Ubuntu, Xubuntu, Mint
310 | "/usr/lib64/libudev.so.1" # SUSE, Fedora
311 | "/usr/lib/libudev.so.1" # Arch, Fedora 32bit
312 | "/lib/i386-linux-gnu/libudev.so.1" # Ubuntu 32bit
313 | )
314 |
315 | for i in "${paths[@]}"
316 | do
317 | if [ -f ${i} ]
318 | then
319 | mkdir ${HERE}/lib
320 | ln -sf "$i" ${HERE}/lib/libudev.so.0
321 | break
322 | fi
323 | done
324 | export LD_LIBRARY_PATH=$([ -n "$LD_LIBRARY_PATH" ] && echo "$HERE:$HERE/lib:$LD_LIBRARY_PATH" || echo "$HERE:$HERE/lib")
325 | exec -a "$0" "${HERE}/PACKAGE_NAME_PLACE_HOLDER-bin" "$@"
326 | gisto_libudev_helper
327 | replace PACKAGE_NAME_PLACE_HOLDER ${PKG_NAME} -- ${PKG_NAME}
328 | chmod +x ./${PKG_NAME}
329 | fi
330 |
331 | zip -qq -ry ${PKG_NAME}-${DATE}-${1}.zip *;
332 | mv ${PKG_NAME}-${DATE}-${1}.zip ${RELEASE_DIR};
333 | cd ${WORKING_DIR};
334 | }
335 |
336 | mk_windows() {
337 | cat ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/nw.exe ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw > ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe
338 | rm ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw
339 |
340 | if [[ -f "${WIN_RESOURCE_ICO}" ]];then
341 | cp ${WIN_RESOURCE_ICO} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/
342 | fi
343 | cp -R ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/* ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/
344 |
345 | cd ${WORKING_DIR}/${TMP}/${1}/latest-git
346 | zip -qq -r ${PKG_NAME}-${DATE}-${1}.zip *;
347 | mv ${PKG_NAME}-${DATE}-${1}.zip ${RELEASE_DIR};
348 | cd ${WORKING_DIR};
349 | }
350 |
351 | mk_osx() {
352 | cp -R ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/*.app ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app;
353 | cp -R ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Resources/app.nw;
354 | rm -r ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw
355 |
356 | # check if it is nwjs or node-webkit
357 | if [[ -d "${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/nwjs.app" ]]; then
358 | CFBundleExecutable="nwjs"
359 | else
360 | CFBundleExecutable="node-webkit"
361 | fi
362 |
363 | if [[ -f "${OSX_RESOURCE_ICNS}" ]];then
364 | cp -R ${OSX_RESOURCE_ICNS} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Resources/
365 | else
366 | OSX_RESOURCE_ICNS="${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/node-webkit.app/Contents/Resources/nw.icns"
367 | fi
368 | rm ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Info.plist
369 | cat << gisto_plist_helper >> ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Info.plist
370 |
371 |
372 |
373 |
374 | CFBundleDevelopmentRegion
375 | en
376 | CFBundleDisplayName
377 | $(upper_case_word ${PKG_NAME})
378 | CFBundleDocumentTypes
379 |
380 | CFBundleExecutable
381 | ${CFBundleExecutable}
382 | CFBundleIconFile
383 | $(echo "${OSX_RESOURCE_ICNS}" | rev | cut -d"/" -f1 | rev)
384 | CFBundleIdentifier
385 | ${CFBundleIdentifier}
386 | CFBundleInfoDictionaryVersion
387 | 6.0
388 | CFBundleName
389 | $(upper_case_word ${PKG_NAME})
390 | CFBundlePackageType
391 | APPL
392 | CFBundleShortVersionString
393 | ${PKG_VERSION}
394 | CFBundleVersion
395 | ${PKG_VERSION}
396 | LSFileQuarantineEnabled
397 |
398 | LSMinimumSystemVersion
399 | 10.6.0
400 | NSPrincipalClass
401 | NSApplication
402 | NSSupportsAutomaticGraphicsSwitching
403 |
404 | NSHumanReadableCopyright
405 | Copyright (c) $(date +"%Y") $(upper_case_word ${PKG_NAME})
406 | SCMRevision
407 | 175484
408 | UTExportedTypeDeclarations
409 |
410 |
411 |
412 | gisto_plist_helper
413 | cd ${WORKING_DIR}/${TMP}/${1}/latest-git
414 | zip -qq -ry ${PKG_NAME}-${DATE}-${1}.zip *;
415 | mv ${PKG_NAME}-${DATE}-${1}.zip ${RELEASE_DIR};
416 | cd ${WORKING_DIR};
417 | }
418 |
419 | build() {
420 | for i in ${TARGET}; do
421 | mkdir -p ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git;
422 | mkdir -p ${LOCAL_NW_ARCHIVES_PATH};
423 | NOTE 'WORKING';
424 | printf "Bulding ${TXT_BOLD}${TXT_YELLO}${PKG_NAME}${TXT_RESET} for ${TXT_BOLD}${TXT_YELLO}${ARR_OS[$i]}${TXT_RESET}\n"
425 | for DL_FILE in ${LOCAL_NW_ARCHIVES_PATH}/*-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]}; do
426 | if [[ -f "${DL_FILE}" || ${LOCAL_NW_ARCHIVES_MODE} = "TRUE" || ${LOCAL_NW_ARCHIVES_MODE} = "true" || ${LOCAL_NW_ARCHIVES_MODE} = "1" ]]; then
427 | NOTE 'NOTE';
428 | printf "File ${TXT_YELLO}nwjs-${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]}${TXT_RESET} is in the download cache\n- no need to re-download\n"
429 | cp ${LOCAL_NW_ARCHIVES_PATH}/*-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]} ${WORKING_DIR}/${TMP};
430 | else
431 | wget -O ${LOCAL_NW_ARCHIVES_PATH}/nwjs-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]} ${DL_URL}/v${NW_VERSION}/node-webkit-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]} || wget -O ${LOCAL_NW_ARCHIVES_PATH}/nwjs-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]} ${DL_URL}/v${NW_VERSION}/nwjs-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]};
432 | fi
433 | extractme "${ARR_EXTRACT_COMMAND[$i]}" "${DL_FILE}" "${WORKING_DIR}/${TMP}/${ARR_OS[$i]}";
434 | mv ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/*-v${NW_VERSION}-${ARR_OS[$i]} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs;
435 |
436 | if [[ `split_string "${ARR_OS[$i]}" "-"` = "osx" ]]; then
437 | cp -R ${PKG_SRC} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw;
438 | else
439 | cd ${PKG_SRC};
440 | zip -qq -ry ${PKG_NAME}.zip *;
441 | mv ${PKG_NAME}.zip ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw;
442 | cd ${WORKING_DIR};
443 | fi
444 | # Build binaries
445 | make_bins "${ARR_OS[$i]}";
446 | done
447 | done
448 | NOTE "DONE";
449 | printf "You will find your '${PKG_NAME}' builds in '${RELEASE_DIR}' directory\n";
450 | }
451 |
452 | ### Arguments
453 | while true; do
454 | case $1 in
455 | -h | --help )
456 | clear > /dev/null;
457 | usage | less;
458 | exit 0
459 | ;;
460 | --nw=* )
461 | NW_VERSION="${1#*=}";
462 | shift
463 | ;;
464 | --name=* )
465 | PKG_NAME="${1#*=}";
466 | shift
467 | ;;
468 | --version=* )
469 | PKG_VERSION="${1#*=}";
470 | shift
471 | ;;
472 | --output-dir=* )
473 | RELEASE_DIR="${1#*=}";
474 | shift
475 | ;;
476 | --src=* )
477 | PKG_SRC="${1#*=}"
478 | shift
479 | ;;
480 | --target=* )
481 | TARGET="${1#*=}"
482 | shift
483 | ;;
484 | --osx-icon=* )
485 | OSX_RESOURCE_ICNS="${1#*=}"
486 | shift
487 | ;;
488 | --CFBundleIdentifier=* )
489 | CFBundleIdentifier="${1#*=}"
490 | shift
491 | ;;
492 | --win-icon=* )
493 | WIN_RESOURCE_ICO="${1#*=}"
494 | shift
495 | ;;
496 | --clean )
497 | clean;
498 | exit 0
499 | ;;
500 | --local )
501 | LOCAL_NW_ARCHIVES_MODE=true
502 | shift
503 | ;;
504 | --libudev )
505 | LIBUDEV_HANDLER=true
506 | shift
507 | ;;
508 | --build )
509 | build;
510 | exit 0
511 | ;;
512 | -- )
513 | shift;
514 | break
515 | ;;
516 | -* )
517 | printf 'Hmmm, unknown option: "%s".\n' "${1}";
518 | exit 0
519 | ;;
520 | * )
521 | usage;
522 | break
523 | ;;
524 | esac
525 | done
526 |
--------------------------------------------------------------------------------
/pack.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Exit on error
4 | set -e
5 |
6 | BUILD_DIR=`pwd`
7 | WORKING_DIR="${BUILD_DIR}/TMP"
8 | RELEASE_DIR="${BUILD_DIR}/releases"
9 | CONFIG_FILE="${BUILD_DIR}/config.json"
10 |
11 | if [[ "${2}" =~ "--config" ]]; then
12 | CONFIG_FILE="${2#*=}";
13 | fi
14 |
15 | get_value_by_key() {
16 | JSON_FILE=${CONFIG_FILE}
17 | KEY=${1}
18 | REGEX="(?<=\"${KEY}\":.\")[^\"]*"
19 | JSON_VALUE=$(cat ${JSON_FILE} | grep -Po ${REGEX})
20 | echo ${JSON_VALUE}
21 | }
22 |
23 | # Name of your package
24 | PKG_NAME=$(get_value_by_key name)
25 |
26 | if [[ ! -f "${WORKING_DIR}" ]]; then
27 | mkdir -p TMP
28 | fi
29 |
30 | architechture="ia32 x64"
31 | architechtureMacos="x64"
32 |
33 | usage() {
34 | clear && cat < config.json
95 | {
96 | "name": "${CONF_NAME}",
97 | "description": "${CONF_DESCRIPTION}",
98 | "version": "${CONF_VERSION}",
99 | "nwjsVersion": "${CONF_NW_VERSION}",
100 | "src": "${CONF_SRC}",
101 | "iconPath": "${CONF_ICON_PNG}",
102 | "windowsIconPath": "${CONF_ICON_WIN}",
103 | "osxIconPath": "${CONF_ICON_OSX}",
104 | "osxBgPath": "${CONF_osxBgPath}",
105 | "CFBundleIdentifier": "${CONF_CFBundleIdentifier}",
106 | "license": "${CONF_LICENSE}"
107 | }
108 | create_conf
109 | }
110 |
111 | check_dependencies() {
112 | # Check if NSIS is present
113 | if [[ "`makensis`" =~ "MakeNSIS" && "`convert`" =~ "Version: ImageMagick" ]]; then
114 | echo 'OK';
115 | else
116 | echo 'NO';
117 | fi
118 | }
119 |
120 | pack_linux () {
121 | for arch in ${architechture[@]}; do
122 | cd ${WORKING_DIR}
123 | cp -R ${BUILD_DIR}/resources/linux/PKGNAME-VERSION-Linux ${BUILD_DIR}/TMP/$(get_value_by_key name)-$(get_value_by_key version)-Linux-${arch}
124 | PKG_MK_DIR=${BUILD_DIR}/TMP/$(get_value_by_key name)-$(get_value_by_key version)-Linux-${arch}
125 | mv ${PKG_MK_DIR}/PKGNAME ${PKG_MK_DIR}/$(get_value_by_key name)
126 | mv ${PKG_MK_DIR}/$(get_value_by_key name)/PKGNAME ${PKG_MK_DIR}/$(get_value_by_key name)/$(get_value_by_key name)
127 | # replaces
128 | sed -i "s/PKGNAME/$(get_value_by_key name)/gi" {PKG_MK_DIR}/README
129 | sed -i "s/PKGDESCRIPTION/$(get_value_by_key description)/gi" {PKG_MK_DIR}/README
130 | sed -i "s/PKGNAME/$(get_value_by_key name)/gi" ${PKG_MK_DIR}/$(get_value_by_key name)/$(get_value_by_key name)
131 | sed -i "s/PKGNAME/$(get_value_by_key name)/gi" ${PKG_MK_DIR}/setup
132 | # app file
133 | mkdir ${PKG_MK_DIR}/share/pixmaps
134 | cp $(get_value_by_key iconPath) ${PKG_MK_DIR}/share/pixmaps/$(get_value_by_key name).png
135 | convert ${PKG_MK_DIR}/share/pixmaps/$(get_value_by_key name).png ${PKG_MK_DIR}/share/pixmaps/$(get_value_by_key name).xpm
136 | cp -R ${BUILD_DIR}/TMP/linux-${arch}/latest-git/* ${PKG_MK_DIR}/$(get_value_by_key name)/
137 | mv ${PKG_MK_DIR}/$(get_value_by_key name)/$(get_value_by_key name) ${PKG_MK_DIR}/$(get_value_by_key name)/$(get_value_by_key name)-bin
138 | # application
139 | mv ${PKG_MK_DIR}/share/applications/PKGNAME.desktop ${PKG_MK_DIR}/share/applications/$(get_value_by_key name).desktop
140 | sed -i "s/PKGNAME/$(get_value_by_key name)/gi" ${PKG_MK_DIR}/share/applications/$(get_value_by_key name).desktop
141 | sed -i "s/PKGVERSION/$(get_value_by_key version)/gi" ${PKG_MK_DIR}/share/applications/$(get_value_by_key name).desktop
142 | # menu
143 | mv ${PKG_MK_DIR}/share/menu/PKGNAME ${PKG_MK_DIR}/share/menu/$(get_value_by_key name)
144 | sed -i "s/PKGNAME/$(get_value_by_key name)/gi" ${PKG_MK_DIR}/share/menu/$(get_value_by_key name)
145 | # make the tar
146 | tar -C ${WORKING_DIR} -czf $(get_value_by_key name)-$(get_value_by_key version)-Linux-${arch}.tar.gz $(get_value_by_key name)-$(get_value_by_key version)-Linux-${arch}
147 | mv ${WORKING_DIR}/$(get_value_by_key name)-$(get_value_by_key version)-Linux-${arch}.tar.gz ${RELEASE_DIR}
148 | printf "\nDone Linux ${arch}\n"
149 | done;
150 | }
151 |
152 | pack_osx () {
153 | for arch in ${architechtureMacos[@]}; do
154 | cd ${WORKING_DIR}
155 | if [[ ! -d "${WORKING_DIR}/bomutils" ]]; then
156 | git clone https://github.com/hogliux/bomutils && cd bomutils && make && cd ${WORKING_DIR}
157 | fi
158 | if [[ ! -d "${WORKING_DIR}/xar-xar-1.5.2" ]]; then
159 | wget https://github.com/mackyle/xar/archive/xar-1.5.2.tar.gz && tar -zxvf ./xar-1.5.2.tar.gz && cd xar-xar-1.5.2 && ./autogen.sh && make && cd ${WORKING_DIR}
160 | fi
161 |
162 | mkdir -p ${WORKING_DIR}/build_osx/flat/base.pkg
163 | mkdir -p ${WORKING_DIR}/build_osx/flat/Resources/en.lproj
164 | mkdir -p ${WORKING_DIR}/build_osx/root/Applications
165 | cp -R "${WORKING_DIR}/osx-${arch}/latest-git/$(get_value_by_key name).app" ${WORKING_DIR}/build_osx/root/Applications/
166 | ( cd ${WORKING_DIR}/build_osx/root/Applications && chmod -R a+xr $(get_value_by_key name).app )
167 | local COUNT_FILES=$(find ${WORKING_DIR}/build_osx/root | wc -l)
168 | local INSTALL_KB_SIZE=$(du -k -s ${WORKING_DIR}/build_osx/root | awk '{print $1}')
169 | ( cd ${WORKING_DIR}/build_osx/root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > ${WORKING_DIR}/build_osx/flat/base.pkg/Payload
170 |
171 | cat << osx_packageinfo_helper > ${WORKING_DIR}/build_osx/flat/base.pkg/PackageInfo
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 | osx_packageinfo_helper
184 |
185 | local BG=$(get_value_by_key osxBgPath)
186 | if [[ -f ${BG} ]];then
187 | cp "${BG}" "${WORKING_DIR}/build_osx/flat/Resources/en.lproj/background"
188 | local BG_NODE=''
189 | fi
190 |
191 | cat << osx_distribution_helper > ${WORKING_DIR}/build_osx/flat/Distribution
192 |
193 |
194 | ${PKG_NAME} $(get_value_by_key version)
195 |
196 | ${BG_NODE}
197 |
198 |
199 |
209 |
210 |
211 |
212 |
213 |
214 |
215 | #base.pkg
216 |
217 | osx_distribution_helper
218 |
219 | ${WORKING_DIR}/bomutils/build/bin/mkbom -u 0 -g 80 ${WORKING_DIR}/build_osx/root ${WORKING_DIR}/build_osx/flat/base.pkg/Bom
220 | ( cd ${WORKING_DIR}/build_osx/flat/ && ${WORKING_DIR}/xar-xar-1.5.2/src/xar --compression none -cf "${RELEASE_DIR}/${PKG_NAME}-$(get_value_by_key version)-OSX-${arch}.pkg" * )
221 | printf "\nDone OSX ${arch}\n"
222 | done;
223 | }
224 |
225 | pack_windows() {
226 | for arch in ${architechture[@]}; do
227 | cd ${WORKING_DIR}
228 | cp -R ${BUILD_DIR}/resources/windows/app.nsi ${WORKING_DIR}
229 | cp -R $(get_value_by_key windowsIconPath) ${BUILD_DIR}/TMP/win-${arch}/latest-git/
230 | # Replce paths and vars in nsi script
231 | replace \
232 | NWJS_APP_REPLACE_APPNAME "$(get_value_by_key name)" \
233 | NWJS_APP_REPLACE_DESCRIPTION "$(get_value_by_key description)" \
234 | NWJS_APP_REPLACE_LICENSE $(get_value_by_key license) \
235 | NWJS_APP_REPLACE_VERSION $(get_value_by_key version) \
236 | NWJS_APP_REPLACE_EXE_NAME $(get_value_by_key name)-$(get_value_by_key version)-Windows-${arch}.exe \
237 | NWJS_APP_REPLACE_INC_FILES_locales ${BUILD_DIR}/TMP/win-${arch}/latest-git/locales \
238 | NWJS_APP_REPLACE_INC_FILES_swiftshader ${BUILD_DIR}/TMP/win-${arch}/latest-git/swiftshader \
239 | NWJS_APP_REPLACE_INC_FILES_APP ${BUILD_DIR}/TMP/win-${arch}/latest-git/$(get_value_by_key name).exe \
240 | NWJS_APP_REPLACE_INC_FILES_credits.html ${BUILD_DIR}/TMP/win-${arch}/latest-git/credits.html \
241 | NWJS_APP_REPLACE_INC_FILES_d3dcompiler_47.dll ${BUILD_DIR}/TMP/win-${arch}/latest-git/d3dcompiler_47.dll \
242 | NWJS_APP_REPLACE_INC_FILES_ffmpeg.dll ${BUILD_DIR}/TMP/win-${arch}/latest-git/ffmpeg.dll \
243 | NWJS_APP_REPLACE_INC_FILES_icon.ico ${BUILD_DIR}/TMP/win-${arch}/latest-git/icon.ico \
244 | NWJS_APP_REPLACE_INC_FILES_icudtl.dat ${BUILD_DIR}/TMP/win-${arch}/latest-git/icudtl.dat \
245 | NWJS_APP_REPLACE_INC_FILES_libEGL.dll ${BUILD_DIR}/TMP/win-${arch}/latest-git/libEGL.dll \
246 | NWJS_APP_REPLACE_INC_FILES_libGLESv2.dll ${BUILD_DIR}/TMP/win-${arch}/latest-git/libGLESv2.dll \
247 | NWJS_APP_REPLACE_INC_FILES_natives_blob.bin ${BUILD_DIR}/TMP/win-${arch}/latest-git/natives_blob.bin \
248 | NWJS_APP_REPLACE_INC_FILES_natives_blob.bin ${BUILD_DIR}/TMP/win-${arch}/latest-git/natives_blob.bin \
249 | NWJS_APP_REPLACE_INC_FILES_nw.dll ${BUILD_DIR}/TMP/win-${arch}/latest-git/nw.dll \
250 | NWJS_APP_REPLACE_INC_FILES_nw.exe ${BUILD_DIR}/TMP/win-${arch}/latest-git/nw.exe \
251 | NWJS_APP_REPLACE_INC_FILES_nw_100_percent.pak ${BUILD_DIR}/TMP/win-${arch}/latest-git/nw_100_percent.pak \
252 | NWJS_APP_REPLACE_INC_FILES_nw_200_percent.pak ${BUILD_DIR}/TMP/win-${arch}/latest-git/nw_200_percent.pak \
253 | NWJS_APP_REPLACE_INC_FILES_nw_elf.dll ${BUILD_DIR}/TMP/win-${arch}/latest-git/nw_elf.dll \
254 | NWJS_APP_REPLACE_INC_FILES_resources.pak ${BUILD_DIR}/TMP/win-${arch}/latest-git/resources.pak \
255 | NWJS_APP_REPLACE_INC_FILES_snapshot_blob.bin ${BUILD_DIR}/TMP/win-${arch}/latest-git/snapshot_blob.bin \
256 | NWJS_APP_REPLACE_ICO_FILE_NAME $(basename $(get_value_by_key windowsIconPath)) \
257 | NWJS_APP_REPLACE_INC_FILE_ICO $(get_value_by_key windowsIconPath) -- app.nsi;
258 | makensis app.nsi
259 | # Clean a bit
260 | rm -rf ${WORKING_DIR}/$(get_value_by_key name).nsi;
261 | mv ${WORKING_DIR}/$(get_value_by_key name)-$(get_value_by_key version)-Windows-${arch}.exe ${RELEASE_DIR}
262 | printf "\nDone Windows ${arch}\n"
263 | done
264 | }
265 |
266 | build() {
267 | if [[ `check_dependencies` = "NO" ]]; then
268 | printf "\nNOTE! NSIS or ImageMagick is missing in the system\n\n";
269 | exit 1;
270 | fi
271 | if [[ ! -d "${RELEASE_DIR}" ]]; then
272 | mkdir ${RELEASE_DIR}
273 | fi
274 | ${BUILD_DIR}/nwjs-build.sh \
275 | --src=$(get_value_by_key src) \
276 | --name=$(get_value_by_key name) \
277 | --nw=$(get_value_by_key nwjsVersion) \
278 | --win-icon=$(get_value_by_key windowsIconPath) \
279 | --osx-icon=$(get_value_by_key osxIconPath) \
280 | --CFBundleIdentifier=$(get_value_by_key CFBundleIdentifier) \
281 | --target="${1}" \
282 | --version=$(get_value_by_key version) \
283 | --libudev \
284 | --build
285 | cd ${BUILD_DIR}
286 | }
287 |
288 | # Execute hooks
289 | hook() {
290 | printf "\nNOTE! \"${1}\" hook executed\n\n";
291 | case "$1" in
292 | before)
293 | ${BUILD_DIR}/hooks/before.sh
294 | ;;
295 | after)
296 | ${BUILD_DIR}/hooks/after.sh
297 | ;;
298 | after_build)
299 | ${BUILD_DIR}/hooks/after_build.sh
300 | ;;
301 | esac
302 | }
303 |
304 | clean() {
305 | if [[ ${1} = "all" ]];then
306 | rm -rf ${RELEASE_DIR}; printf "\nCleaned ${RELEASE_DIR}\n\n";
307 | fi
308 | rm -rf ${WORKING_DIR}; printf "\nCleaned ${WORKING_DIR}\n\n";
309 | }
310 |
311 | # TODO maybe deal with cmd switches or leave it all in the config.json file
312 |
313 | if [[ ${1} = "--help" || ${1} = "-h" ]]; then
314 | usage;
315 | elif [[ ${1} = "init" ]]; then
316 | init_config_file;
317 | elif [[ ${1} = "--clean" ]]; then
318 | clean ${2};
319 | elif [[ ${1} = "--linux" ]]; then
320 | clean;
321 | hook "before";
322 | build "0 1";
323 | hook "after_build";
324 | pack_linux;
325 | hook "after";
326 | elif [[ ${1} = "--osx" ]]; then
327 | clean;
328 | hook "before";
329 | build "4";
330 | hook "after_build";
331 | pack_osx;
332 | hook "after";
333 | elif [[ ${1} = "--windows" ]]; then
334 | clean;
335 | hook "before";
336 | build "2 3";
337 | hook "after_build";
338 | pack_windows;
339 | hook "after";
340 | elif [[ ${1} = "--all" ]]; then
341 | clean;
342 | hook "before";
343 | build "0 1 2 3 4";
344 | hook "after_build";
345 | pack_osx;
346 | pack_linux;
347 | pack_windows;
348 | hook "after";
349 | else
350 | usage;
351 | fi
352 |
--------------------------------------------------------------------------------
/resources/linux/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nwutils/nwjs-shell-builder/cb2ab70a1fec0ead3f53e09ed11d6fe077d16693/resources/linux/.gitkeep
--------------------------------------------------------------------------------
/resources/linux/PKGNAME-VERSION-Linux/PKGNAME/PKGNAME:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | APP_WRAPPER="`readlink -f "$0"`"
3 | HERE="`dirname "$APP_WRAPPER"`"
4 |
5 | # Always use our versions of ffmpeg libs.
6 | # This also makes RPMs find our library symlinks.
7 | export LD_LIBRARY_PATH=$([ -n "$LD_LIBRARY_PATH" ] && echo "$HERE:$HERE/lib:$LD_LIBRARY_PATH" || echo "$HERE:$HERE/lib")
8 |
9 | exec -a "$0" "$HERE/PKGNAME-bin" "$@"
--------------------------------------------------------------------------------
/resources/linux/PKGNAME-VERSION-Linux/README:
--------------------------------------------------------------------------------
1 | ------------------------------------------------------------
2 | PKGNAME - PKGDESCRIPTION
3 | ------------------------------------------------------------
4 |
5 | ------------------------------------------------------------
6 | INSTALL
7 | ------------------------------------------------------------
8 |
9 | To install PKGNAME run "sudo ./setup" in terminal.
10 |
11 | ------------------------------------------------------------
12 | UNINSTALL
13 | ------------------------------------------------------------
14 |
15 | To remove all PKGNAME components run "sudo ./setup --uninstall" in terminal.
16 |
17 | ------------------------------------------------------------
18 | LICENSE
19 | ------------------------------------------------------------
20 |
21 | The MIT License
22 |
23 | Copyright (c) 2015
24 |
25 | Permission is hereby granted, free of charge, to any person obtaining a copy
26 | of this software and associated documentation files (the "Software"), to deal
27 | in the Software without restriction, including without limitation the rights
28 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29 | copies of the Software, and to permit persons to whom the Software is
30 | furnished to do so, subject to the following conditions:
31 |
32 | The above copyright notice and this permission notice shall be included in
33 | all copies or substantial portions of the Software.
34 |
35 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
41 | THE SOFTWARE.
42 |
--------------------------------------------------------------------------------
/resources/linux/PKGNAME-VERSION-Linux/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | is_root() {
4 | if [[ $EUID -ne 0 ]]; then
5 | printf "\n\n\n\e[41m \e[0m Hi \e[1;37m$USER\e[0m, please run \e[1;37mPKGNAME\e[0m script as \e[1;37mroot\e[0m or with \e[1;37msudo\e[0m\n\e[41m\e[0m\n\n\n"
6 | exit 1
7 | fi
8 | }
9 |
10 | greet () {
11 | printf "\n\n\n\e[44m \e[0m Hi, This will install \e[1;37mPKGNAME\e[0m on your computer.\n\n\n"
12 | }
13 |
14 | remove_previous_version () {
15 | if [[ -f "/usr/bin/nw.pak" ]]; then
16 | /bin/rm -rf /usr/bin/PKGNAME /usr/bin/nw.pak /usr/share/applications/PKGNAME.desktop usr/share/menu/PKGNAME /usr/share/pixmaps/PKGNAME.png /usr/share/pixmaps/PKGNAME.xpm > /dev/null 2>&1
17 | fi
18 | }
19 |
20 | check_dependencies_and_run () {
21 |
22 | printf "\n\n\n\e[43m \e[0m Checking for dependencies.\n\n\n"
23 |
24 | for i in `find /bin /usr/bin -name "gconftool*"`; do
25 | if [[ ${i} =~ "gconf" ]]; then
26 | DEPS='OK'
27 | fi
28 | done;
29 |
30 | if [[ $DEPS = 'OK' ]]; then
31 | remove_previous_version;
32 | install_app;
33 | else
34 | printf "\n\n\n\e[41m \e[0m It seems you mising \e[1;37mgconf\e[0m. Please advise your package manager\n\n\n"
35 | fi
36 | }
37 |
38 | install_app () {
39 | printf "\e[42m \e[0m It seems that all dependencies met, Install? [y/n]"
40 | read INST
41 | if [ $INST = 'y' -o $INST = 'Y' ]; then
42 | printf "\n\n\n\e[43m \e[0m INSTALLING...\n\n\n"
43 | /bin/cp -rv PKGNAME /opt
44 | /bin/cp -rv share /usr
45 | /bin/ln -s /opt/PKGNAME/PKGNAME /usr/bin/PKGNAME
46 |
47 | paths=(
48 | "/lib/x86_64-linux-gnu/libudev.so.1" # Ubuntu, Xubuntu, Mint
49 | "/usr/lib64/libudev.so.1" # SUSE, Fedora
50 | "/usr/lib/libudev.so.1" # Arch, Fedora 32bit
51 | "/lib/i386-linux-gnu/libudev.so.1" # Ubuntu 32bit
52 | )
53 |
54 | for i in "${paths[@]}"
55 | do
56 | if [ -f $i ]
57 | then
58 | mkdir /opt/PKGNAME/lib
59 | ln -sf "$i" /opt/PKGNAME/lib/libudev.so.0
60 | break
61 | fi
62 | done
63 |
64 | printf "\n\n\n\e[42m \e[0m Congrats! You can now find \e[1;37mPKGNAME\e[0m in your menu.\n\n\n"
65 | fi
66 | }
67 |
68 | is_root;
69 |
70 | if [ "${1}" = "--uninstall" ]; then
71 | /bin/rm -rf /opt/PKGNAME /usr/share/applications/PKGNAME.desktop usr/share/menu/PKGNAME /usr/bin/PKGNAME > /dev/null 2>&1
72 | printf '\n\n\n\e[44m \e[0m Congrats! PKGNAME removed from your machine.\n\n\n'
73 | exit 1
74 | fi
75 |
76 | # RUN ALL
77 | greet;
78 | check_dependencies_and_run;
--------------------------------------------------------------------------------
/resources/linux/PKGNAME-VERSION-Linux/share/applications/PKGNAME.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=PKGNAME
3 | GenericName=PKGNAME
4 | Comment=Browse, manage, create, tag, delete gist snippets
5 | Exec=/usr/bin/PKGNAME
6 | Terminal=false
7 | Icon=/opt/PKGNAME/pixmaps/PKGNAME.xpm
8 | Type=Application
9 | Categories=Network;Devel;
10 | Version=PKGVERSION
11 | Name[en_US]=PKGNAME
12 |
--------------------------------------------------------------------------------
/resources/linux/PKGNAME-VERSION-Linux/share/menu/PKGNAME:
--------------------------------------------------------------------------------
1 | ?package(PKGNAME): needs="X11" \
2 | section="Applications/Network" \
3 | title="PKGNAME" \
4 | command="/opt/PKGNAME/bin/PKGNAME" \
5 | icon="/opt/PKGNAME/pixmaps/PKGNAME.xpm"
6 |
--------------------------------------------------------------------------------
/resources/osx/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nwutils/nwjs-shell-builder/cb2ab70a1fec0ead3f53e09ed11d6fe077d16693/resources/osx/.gitkeep
--------------------------------------------------------------------------------
/resources/windows/app.nsi:
--------------------------------------------------------------------------------
1 | ;;; Define your application name
2 | !define APPNAME "NWJS_APP_REPLACE_APPNAME"
3 | !define APPNAMEANDVERSION "${APPNAME} NWJS_APP_REPLACE_VERSION"
4 |
5 | ;;; Main Install settings
6 | Name "${APPNAMEANDVERSION}"
7 | InstallDir "$APPDATA\${APPNAME}"
8 | InstallDirRegKey HKLM "Software\${APPNAME}" ""
9 | OutFile "NWJS_APP_REPLACE_EXE_NAME"
10 |
11 | ;;; Modern interface settings
12 | !include "MUI.nsh"
13 | !define MUI_ICON "NWJS_APP_REPLACE_INC_FILE_ICO"
14 | !define MUI_ABORTWARNING
15 | !define MUI_FINISHPAGE_RUN "$INSTDIR\${APPNAME}.exe"
16 |
17 | !insertmacro MUI_PAGE_WELCOME
18 | !insertmacro MUI_PAGE_LICENSE "NWJS_APP_REPLACE_LICENSE"
19 | !insertmacro MUI_PAGE_DIRECTORY
20 | !insertmacro MUI_PAGE_INSTFILES
21 | !insertmacro MUI_PAGE_FINISH
22 |
23 | !insertmacro MUI_UNPAGE_CONFIRM
24 | !insertmacro MUI_UNPAGE_INSTFILES
25 |
26 | ;;; Set languages (first is default language)
27 | !insertmacro MUI_LANGUAGE "English"
28 | !insertmacro MUI_RESERVEFILE_LANGDLL
29 |
30 | Section "${APPNAME}" Section1
31 |
32 | ;;; Set Section properties
33 | SetOverwrite on
34 |
35 | ;;; Set Section Files and Shortcuts
36 | SetOutPath "$INSTDIR\"
37 | File "NWJS_APP_REPLACE_INC_FILES_locales"
38 | File "NWJS_APP_REPLACE_INC_FILES_swiftshader"
39 | File "NWJS_APP_REPLACE_INC_FILES_APP"
40 | File "NWJS_APP_REPLACE_INC_FILES_credits.html"
41 | File "NWJS_APP_REPLACE_INC_FILES_d3dcompiler_47.dll"
42 | File "NWJS_APP_REPLACE_INC_FILES_ffmpeg.dll"
43 | File "NWJS_APP_REPLACE_INC_FILES_icon.ico"
44 | File "NWJS_APP_REPLACE_INC_FILES_icudtl.dat"
45 | File "NWJS_APP_REPLACE_INC_FILES_libEGL.dll"
46 | File "NWJS_APP_REPLACE_INC_FILES_libGLESv2.dll"
47 | File "NWJS_APP_REPLACE_INC_FILES_natives_blob.bin"
48 | File "NWJS_APP_REPLACE_INC_FILES_node.dll"
49 | File "NWJS_APP_REPLACE_INC_FILES_nw.dll"
50 | File "NWJS_APP_REPLACE_INC_FILES_nw.exe"
51 | File "NWJS_APP_REPLACE_INC_FILES_nw_100_percent.pak"
52 | File "NWJS_APP_REPLACE_INC_FILES_nw_200_percent.pak"
53 | File "NWJS_APP_REPLACE_INC_FILES_nw_elf.dll"
54 | File "NWJS_APP_REPLACE_INC_FILES_resources.pak"
55 | File "NWJS_APP_REPLACE_INC_FILES_snapshot_blob.bin"
56 | File "NWJS_APP_REPLACE_INC_FILE_ICO"
57 |
58 | CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" $INSTDIR\NWJS_APP_REPLACE_ICO_FILE_NAME" 0
59 | CreateDirectory "$SMPROGRAMS\${APPNAME}"
60 | CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" $INSTDIR\NWJS_APP_REPLACE_ICO_FILE_NAME" 0
61 | CreateShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" $INSTDIR\NWJS_APP_REPLACE_ICO_FILE_NAME" 0
62 |
63 | SectionEnd
64 |
65 | Section -FinishSection
66 |
67 | WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
68 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
69 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
70 | WriteUninstaller "$INSTDIR\uninstall.exe"
71 |
72 | SectionEnd
73 |
74 | ;;; Modern install component descriptions
75 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
76 | !insertmacro MUI_DESCRIPTION_TEXT ${Section1} ""
77 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
78 |
79 | ;;; Uninstall section
80 | Section Uninstall
81 |
82 | ;;; Remove from registry...
83 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
84 | DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
85 |
86 | ;;; Delete self
87 | Delete "$INSTDIR\uninstall.exe"
88 |
89 | ;;; Delete Shortcuts
90 | Delete "$DESKTOP\${APPNAME}.lnk"
91 | Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
92 | Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
93 |
94 | ;;; Clean up ${APPNAME}
95 | RMDir /r /REBOOTOK $INSTDIR
96 | RMDir "$SMPROGRAMS\${APPNAME}"
97 |
98 | SectionEnd
99 |
100 | BrandingText "NWJS_APP_REPLACE_DESCRIPTION"
101 |
102 | ;;; eof
103 |
--------------------------------------------------------------------------------