Skip to content

Commit

Permalink
Fixed windows build script building nw.js and then an nsis installer,…
Browse files Browse the repository at this point in the history
… then zip it and put it in place with the right filename
  • Loading branch information
SchizoDuckie committed Jul 9, 2015
1 parent 7457edc commit ed3edd2
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 47 deletions.
2 changes: 2 additions & 0 deletions build/build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#./nwjs-build.sh --src=/var/www/deploy/browseraction --output-dir=/var/www/deploy/binaries --name=DuckieTV --win-icon=/var/www/DuckieTV/img/favicon.ico --osx-icon=/var/www/DuckieTV/build/duckietv.icns --CFBundleIdentifier=tv.duckie --target="0" --version="1.1.2" --libudev --nw=0.12.2 --build
./nwjs-build.sh --src=/var/www/deploy/browseraction --output-dir=/var/www/deploy/binaries --name=DuckieTV --win-icon=/var/www/DuckieTV/img/favicon.ico --osx-icon=/var/www/DuckieTV/build/duckietv.icns --CFBundleIdentifier=tv.duckie --target="1" --version="1.1.2" --libudev --nw=0.12.2 --build
2 changes: 1 addition & 1 deletion build/build_mac.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

#./nwjs-build.sh --src=/var/www/deploy/browseraction --output-dir=/var/www/deploy/binaries --name=DuckieTV --win-icon=/var/www/DuckieTV/img/favicon.ico --osx-icon=/var/www/DuckieTV/build/duckietv.icns --CFBundleIdentifier=tv.duckie --target="4" --version="1.1.2" --libudev --nw=0.12.2 --build
./nwjs-build.sh --src=/var/www/deploy/browseraction --output-dir=/var/www/deploy/binaries --name=DuckieTV --win-icon=/var/www/DuckieTV/img/favicon.ico --osx-icon=/var/www/DuckieTV/build/duckietv.icns --CFBundleIdentifier=tv.duckie --target="4" --version="1.1.2" --libudev --nw=0.12.2 --build


BUILD_DIR="/var/www/deploy/TMP/osx-ia32/latest-git"
Expand Down
34 changes: 23 additions & 11 deletions build/build_windows.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/bash

./nwjs-build.sh --src=/var/www/deploy/browseraction --output-dir=/var/www/deploy/binaries --name=DuckieTV --win-icon=/var/www/DuckieTV/img/favicon.ico --osx-icon=/var/www/DuckieTV/build/duckietv.icns --CFBundleIdentifier=tv.duckie --target="2" --version="1.1.2" --libudev --nw=0.12.2 --build
#./build/nwjs-build.sh --src=/var/www/deploy/browseraction --output-dir=/var/www/deploy/binaries --name=DuckieTV --win-icon=/var/www/DuckieTV/img/favicon.ico --osx-icon=/var/www/DuckieTV/build/duckietv.icns --CFBundleIdentifier=tv.duckie --target="3" --version="1.1.2" --libudev --nw=0.12.2 --build
APPNAME="DuckieTV"
VERSION="1.1.2"
BASE_DIR="/var/www/deploy/browseraction/"
BUILD_DIR="/var/www/deploy/binaries/win/"
ICON="/var/www/DuckieTV/img/favicon.ico"

BUILD_DIR="/var/www/deploy/binaries/win"
OUTPUT_DIR="/var/www/deploy/binaries"
ICON="/var/www/DuckieTV/img/favicon-inverted.ico"
DATE=$(date +"%Y%m%d")
PLATFORM_INDICATOR="win-ia32"

rm -rf /var/www/deploy/TMP/win-ia32/
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"

./nwjs-build.sh --src=$BASE_DIR --output-dir=$OUTPUT_DIR --name=$APPNAME --win-icon=$ICON --target="2" --version=$VERSION --libudev --nw=0.12.2 --build


cat <<EOF > $BUILD_DIR/$APPNAME.nsi
;;; Define your application name
!define APPNAME "${APPNAME}"
Expand Down Expand Up @@ -82,15 +89,15 @@ Section Uninstall
;;; Remove from registry...
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\\${APPNAME}"
;;; Delete self
Delete "\$INSTDIR\uninstall.exe"
;;; Delete Shortcuts
Delete "\$DESKTOP\${APPNAME}.lnk"
Delete "\$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
Delete "\$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
Delete "\$DESKTOP\\${APPNAME}.lnk"
Delete "\$SMPROGRAMS\\${APPNAME}\\${APPNAME}.lnk"
Delete "\$SMPROGRAMS\\${APPNAME}\Uninstall.lnk"
;;; Clean up DuckieTV
Delete "\$INSTDIR\d3dcompiler_47.dll"
Expand All @@ -105,7 +112,7 @@ Section Uninstall
RMDir "\$INSTDIR\locales"
;;; Remove remaining directories
RMDir "\$SMPROGRAMS\${APPNAME}"
RMDir "\$SMPROGRAMS\\${APPNAME}"
RMDir "\$INSTDIR\"
SectionEnd
Expand All @@ -114,6 +121,11 @@ BrandingText "The TV Show Tracker You've been waiting for"
EOF

cat $BUILD_DIR/$APPNAME.nsi

cd $BUILD_DIR
#cp "${OUTPUT_DIR}/${APPNAME}-${DATE}-${PLATFORM_INDICATOR}.zip" .
unzip "${OUTPUT_DIR}/${APPNAME}-${DATE}-${PLATFORM_INDICATOR}.zip"
makensis "${APPNAME}.nsi"

zip -qq -m "${OUTPUT_DIR}/${APPNAME}-${VERSION}-win-x32.zip" "${APPNAME}-${VERSION}-setup.exe";
#cd $OUTPUT_DIR
#rm -rf $BUILD_DIR
70 changes: 35 additions & 35 deletions build/nwjs-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ DL_URL="http://dl.nwjs.io"

# Temporary directory where all happens (relative to current directory where this script running from)
# This directory will be auto created
TMP="../deploy/TMP"
TMP="/var/www/deploy/TMP"

# Sorces directory path
PKG_SRC="../../dist"
PKG_SRC="/var/www/deploy/browseraction"

# Build target(s)
# 0 - linux-ia32
Expand All @@ -47,7 +47,7 @@ PKG_SRC="../../dist"
TARGET="0 1 2 3 4 5"

# Final output directory (relative to current directory where this script running from)
RELEASE_DIR="${WORKING_DIR}/${TMP}/output"
RELEASE_DIR="/var/www/deploy/"

# Icons and other resources
OSX_RESOURCE_ICNS="../build/resources/osx/gisto.icns"
Expand Down Expand Up @@ -271,8 +271,8 @@ upper_case_word() {
}

clean() {
rm -rf ${WORKING_DIR}/${TMP};
NOTE "Removed \"${WORKING_DIR}/${TMP}\" directory and it's content";
rm -rf ${TMP};
NOTE "Removed \"${TMP}\" directory and it's content";
}

extractme() {
Expand Down Expand Up @@ -304,11 +304,11 @@ make_bins() {
}

mk_linux() {
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}
rm ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw
chmod +x ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}
cp ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/{icudtl.dat,nw.pak} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/
cd ${WORKING_DIR}/${TMP}/${1}/latest-git
cat ${TMP}/${ARR_OS[$i]}/nwjs/nw ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw > ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}
rm ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw
chmod +x ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}
cp ${TMP}/${ARR_OS[$i]}/nwjs/{icudtl.dat,nw.pak} ${TMP}/${ARR_OS[$i]}/latest-git/
cd ${TMP}/${1}/latest-git

if [[ ${LIBUDEV_HANDLER} = "true" ]];then
#libudev handler here
Expand Down Expand Up @@ -340,56 +340,56 @@ gisto_libudev_helper
chmod +x ./${PKG_NAME}
fi

zip -qq -r ${PKG_NAME}-${DATE}-${1}.zip *;
zip -qq -r -m ${PKG_NAME}-${DATE}-${1}.zip *;
mv ${PKG_NAME}-${DATE}-${1}.zip ${RELEASE_DIR};
cd ${WORKING_DIR};
}

mk_windows() {
if [[ -f "${WIN_RESOURCE_ICO}" ]];then
cp ${WIN_RESOURCE_ICO} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/
cp ${WIN_RESOURCE_ICO} ${TMP}/${ARR_OS[$i]}/latest-git/
fi
# copy nw.exe to target
cp ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/nw.exe ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe
cp ${TMP}/${ARR_OS[$i]}/nwjs/nw.exe ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe
if [[ "$WINRESOURCER_AVAILABLE" = "true" ]];then
# Run winresourcer (requires wine 1.7 and mono)
winresourcer --operation=Update --exeFile=${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe --resourceType=Icongroup --resourceName:IDR_MAINFRAME --lang:1033 --resourceFile:${WIN_RESOURCE_ICO}
winresourcer --operation=Update --exeFile=${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe --resourceType=Icongroup --resourceName:IDR_MAINFRAME --lang:1033 --resourceFile:${WIN_RESOURCE_ICO}
# Remove iconfile
ICONFILENAME="${WIN_RESOURCE_ICO##*/}"
# cleanup now redundant icon
rm ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${ICONFILENAME}
rm ${TMP}/${ARR_OS[$i]}/latest-git/${ICONFILENAME}
fi
# append package.nw onto taget
cat ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw >> ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe
cp ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/{icudtl.dat,nw.pak,*.dll} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/
rm ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw
echo "Appendingpackage to exefile: ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw > ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe"
cat ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw >> ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.exe
cp ${TMP}/${ARR_OS[$i]}/nwjs/{icudtl.dat,nw.pak,*.dll} ${TMP}/${ARR_OS[$i]}/latest-git/
rm ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw

exit
cd ${WORKING_DIR}/${TMP}/${1}/latest-git
cd ${TMP}/${1}/latest-git
zip -qq -r ${PKG_NAME}-${DATE}-${1}.zip *;
mv ${PKG_NAME}-${DATE}-${1}.zip ${RELEASE_DIR};
cd ${WORKING_DIR};
}

mk_osx() {
cp -r ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/*.app ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app;
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;
rm -r ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw
cp -r ${TMP}/${ARR_OS[$i]}/nwjs/*.app ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app;
cp -r ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Resources/app.nw;
rm -r ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw

# check if it is nwjs or node-webkit
if [[ -d "${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/nwjs.app" ]]; then
if [[ -d "${TMP}/${ARR_OS[$i]}/nwjs/nwjs.app" ]]; then
CFBundleExecutable="nwjs"
else
CFBundleExecutable="node-webkit"
fi

if [[ -f "${OSX_RESOURCE_ICNS}" ]];then
cp -r ${OSX_RESOURCE_ICNS} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Resources/
cp -r ${OSX_RESOURCE_ICNS} ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Resources/
else
OSX_RESOURCE_ICNS="${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs/node-webkit.app/Contents/Resources/nw.icns"
OSX_RESOURCE_ICNS="${TMP}/${ARR_OS[$i]}/nwjs/node-webkit.app/Contents/Resources/nw.icns"
fi
rm ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Info.plist
cat << gisto_plist_helper >> ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Info.plist
rm ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Info.plist
cat << gisto_plist_helper >> ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.app/Contents/Info.plist
<?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">
<plist version="1.0">
Expand Down Expand Up @@ -433,35 +433,35 @@ cat << gisto_plist_helper >> ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PK
</dict>
</plist>
gisto_plist_helper
cd ${WORKING_DIR}/${TMP}/${1}/latest-git
cd ${TMP}/${1}/latest-git
zip -qq -r ${PKG_NAME}-${DATE}-${1}.zip *;
mv ${PKG_NAME}-${DATE}-${1}.zip ${RELEASE_DIR};
cd ${WORKING_DIR};
}

build() {
for i in ${TARGET}; do
mkdir -p ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git;
mkdir -p ${TMP}/${ARR_OS[$i]}/latest-git;
mkdir -p ${LOCAL_NW_ARCHIVES_PATH};
NOTE 'WORKING';
printf "Bulding ${TXT_BOLD}${TXT_YELLO}${PKG_NAME}${TXT_RESET} for ${TXT_BOLD}${TXT_YELLO}${ARR_OS[$i]}${TXT_RESET}\n"
for DL_FILE in ${LOCAL_NW_ARCHIVES_PATH}/*-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]}; do
if [[ -f "${DL_FILE}" || ${LOCAL_NW_ARCHIVES_MODE} = "TRUE" || ${LOCAL_NW_ARCHIVES_MODE} = "true" || ${LOCAL_NW_ARCHIVES_MODE} = "1" ]]; then
NOTE 'NOTE';
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"
cp ${LOCAL_NW_ARCHIVES_PATH}/*-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]} ${WORKING_DIR}/${TMP};
cp ${LOCAL_NW_ARCHIVES_PATH}/*-v${NW_VERSION}-${ARR_OS[$i]}.${ARR_DL_EXT[$i]} ${TMP};
else
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]};
fi
extractme "${ARR_EXTRACT_COMMAND[$i]}" "${DL_FILE}" "${WORKING_DIR}/${TMP}/${ARR_OS[$i]}";
mv ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/*-v${NW_VERSION}-${ARR_OS[$i]} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/nwjs;
extractme "${ARR_EXTRACT_COMMAND[$i]}" "${DL_FILE}" "${TMP}/${ARR_OS[$i]}";
mv ${TMP}/${ARR_OS[$i]}/*-v${NW_VERSION}-${ARR_OS[$i]} ${TMP}/${ARR_OS[$i]}/nwjs;

if [[ `split_string "${ARR_OS[$i]}" "-"` = "osx" ]]; then
cp -r ${PKG_SRC} ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw;
cp -r ${PKG_SRC} ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw;
else
cd ${PKG_SRC};
zip -qq -r ${PKG_NAME}.zip *;
mv ${PKG_NAME}.zip ${WORKING_DIR}/${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw;
mv ${PKG_NAME}.zip ${TMP}/${ARR_OS[$i]}/latest-git/${PKG_NAME}.nw;
cd ${WORKING_DIR};
fi
# Build binaries
Expand Down
Binary file added img/favicon-inverted.ico
Binary file not shown.

0 comments on commit ed3edd2

Please sign in to comment.