diff --git a/.circleci/config.yml b/.circleci/config.yml index c7b8c2000..fba79b83d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,6 +42,7 @@ jobs: meson gcc gcab + mingw32-nsis mingw64-gcc mingw64-pkg-config mingw64-glib2 @@ -54,6 +55,13 @@ jobs: - run: name: "Build Win32" command: ./contrib/ci/build_windows.sh + - persist_to_workspace: + root: . + paths: + - "dist/setup/*.exe" + - "dist/VERSION" + - store_artifacts: + path: dist/setup build-snap: docker: @@ -125,6 +133,18 @@ jobs: echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg snapcraft push *.snap --release stable + publish-github-exe-release: + docker: + - image: circleci/golang:1.8 + steps: + - attach_workspace: + at: . + - run: + name: "Publish Release on GitHub" + command: | + go get github.com/tcnksm/ghr + VERSION=$(cat dist/VERSION) + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./dist/setup/ workflows: version: 2 main: @@ -147,6 +167,20 @@ workflows: ignore: /.*/ tags: only: /^\d+\.\d+\.\d+$/ + - build-windows: + filters: + branches: + ignore: /.*/ + tags: + only: /^\d+\.\d+\.\d+$/ + - publish-github-exe-release: + requires: + - build-windows + filters: + branches: + ignore: /.*/ + tags: + only: /^\d+\.\d+\.\d+$/ - publish-docs: requires: - build-ubuntu-x86_64 diff --git a/contrib/ci/build_windows.sh b/contrib/ci/build_windows.sh index 163559def..80e8c3172 100755 --- a/contrib/ci/build_windows.sh +++ b/contrib/ci/build_windows.sh @@ -3,11 +3,12 @@ set -e #prep export LC_ALL=C.UTF-8 export DESTDIR=`pwd`/dist -build=`pwd`/build +build=`pwd`/build-win32 rm -rf $DESTDIR $build #build -mkdir -p $build $target && cd $build +mkdir -p $build $DESTDIR && cd $build +echo $(../contrib/get-version.py) > $DESTDIR/VERSION meson .. \ --cross-file=../contrib/mingw64.cross \ --prefix=/ \ @@ -44,6 +45,10 @@ ninja -v ninja -v install cd $DESTDIR +# create a setup binary +mkdir -p $DESTDIR/setup +makensis -NOCD $build/contrib/setup-win32.nsi + #so that it's actually executable cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/*.dll . diff --git a/contrib/meson.build b/contrib/meson.build index f57ad92e8..b6c027407 100644 --- a/contrib/meson.build +++ b/contrib/meson.build @@ -1 +1,13 @@ subdir('firmware_packager') + +if host_machine.system() == 'windows' + con2 = configuration_data() + con2.set('FWUPD_VERSION', fwupd_version) + + # replace @FWUPD_VERSION@ + configure_file( + input : 'setup-win32.nsi', + output : 'setup-win32.nsi', + configuration : con2, + ) +endif diff --git a/contrib/setup-win32.nsi b/contrib/setup-win32.nsi new file mode 100644 index 000000000..319ce98fe --- /dev/null +++ b/contrib/setup-win32.nsi @@ -0,0 +1,92 @@ +#!Nsis Installer Command Script +# +# To build an installer from the script you would normally do: +# +# dnf install mingw32-nsis +# makensis setup-win32.nsi + +Name "" +OutFile "setup/fwupd-@FWUPD_VERSION@-setup-x86_64.exe" +InstallDir "$ProgramFiles\fwupd" +InstallDirRegKey HKLM SOFTWARE\fwupd "Install_Dir" +ShowInstDetails hide +ShowUninstDetails hide +XPStyle on +Page directory +Page instfiles + +ComponentText "Select which optional components you want to install." + +DirText "Please select the installation folder." + +Section "fwupd" + SectionIn RO + + SetOutPath "$INSTDIR\bin" + + # deps + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/iconv.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libarchive-13.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libbrotlicommon.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libbrotlidec.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libbz2-1.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libffi-6.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgio-2.0-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libglib-2.0-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgmodule-2.0-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgmp-10.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgnutls-30.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgnutls-30.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgobject-2.0-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgusb-2.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libhogweed-4.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libidn2-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libintl-8.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libjson-glib-1.0-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/liblzma-5.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libnettle-6.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libp11-kit-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpcre-1.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libpsl-5.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libsoup-2.4-1.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libsqlite3-0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libtasn1-6.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libunistring-2.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libusb-1.0.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libxml2-2.dll" + File "/usr/x86_64-w64-mingw32/sys-root/mingw/bin/zlib1.dll" + + # fwupd + File "dfu-tool.exe" + File "fwupd/fwupdtool.exe" + File "libfwupd-2.dll" + File "libfwupdplugin-1.dll" + File "libgcab-1.0-0.dll" + File "libxmlb-1.dll" + SetOutPath "$INSTDIR\fwupd-plugins-3" + File /r "fwupd-plugins-3/libfu_plugin_*.dll" + SetOutPath "$INSTDIR\etc\fwupd" + File "etc/fwupd/daemon.conf" + SetOutPath "$INSTDIR\etc\pki\fwupd" + File "etc/pki/fwupd/LVFS-CA.pem" + SetOutPath "$INSTDIR\share\fwupd\quirks.d" + File /r "share/fwupd/quirks.d/*.quirk" + + ReadEnvStr $0 COMSPEC + SetOutPath "$INSTDIR" +SectionEnd + +Section "Uninstall" + RMDir /rebootok /r "$SMPROGRAMS\fwupd" + RMDir /rebootok /r "$INSTDIR\bin" + RMDir /rebootok /r "$INSTDIR\etc" + RMDir /rebootok /r "$INSTDIR\lib" + RMDir /rebootok /r "$INSTDIR\share" + RMDir /rebootok "$INSTDIR" +SectionEnd + +Section -post + WriteUninstaller "$INSTDIR\Uninstall fwupd.exe" +SectionEnd diff --git a/meson.build b/meson.build index 63f2797ff..b1a523d24 100644 --- a/meson.build +++ b/meson.build @@ -442,3 +442,13 @@ endif if get_option('systemd') and build_daemon meson.add_install_script('meson_post_install.sh', systemdunitdir, localstatedir) endif + +makensis = find_program('makensis', required : false) +if makensis.found() + run_target( + 'makensis', + command: [ + makensis, + join_paths(meson.source_root(), 'contrib', 'setup-win32.nsi'), + ]) +endif