Skip to contentSkip to conversation

Windows: introduce fiobuild.cmd and fiopkg.cmd

PATCH In review Rebecca Cran 2 participants 2 messages Nov 16, 2020 – Nov 22, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Windows: introduce fiobuild.cmd and fiopkg.cmd

fiobuild.cmd automates the building process to pass the correct arguments to configure to build fio for use on any x86 or x64 processor by using --disable-native.

fiopkg.cmd optionally signs the binaries, builds the installer and signs that too.

dobuild.cmd was misnamed, but is now used by CI. Keep it around, but update it to just call fiopkg.cmd.

---
 os/windows/_domake.sh   | 17 +++++++++++++
 os/windows/dobuild.cmd  | 53 +----------------------------------------
 os/windows/fiobuild.cmd | 17 +++++++++++++
 os/windows/fiopkg.cmd   | 52 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 87 insertions(+), 52 deletions(-)
 create mode 100755 os/windows/_domake.sh
 create mode 100644 os/windows/fiobuild.cmd
 create mode 100644 os/windows/fiopkg.cmd
os/windows/_domake.sh new file +17 -0
new file mode 100755
index 00000000..05625ff4
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+set -e
+
+cd "$2"
+cd ../..
+if [ -e "fio.exe" ]; then
+  make clean
+fi
+
+if [ "$1" = "x86" ]; then
+  ./configure --disable-native --build-32bit-win
+else
+  ./configure --disable-native
+fi
+
+make -j
os/windows/dobuild.cmd +1 -52

54 lines not on this page · raw message

os/windows/fiobuild.cmd new file +17 -0
new file mode 100644
index 00000000..4a4171a2
@@ -0,0 +1,17 @@
+@echo off
+setlocal enabledelayedexpansion
+
+if "%1"=="x86" set FIO_ARCH=x86
+if "%1"=="x64" set FIO_ARCH=x64
+
+if not defined FIO_ARCH (
+  echo Error: must specify the architecture.
+  echo Usage: fiobuild x86
+  echo Usage: fiobuild x64
+  goto end
+)
+
+C:\Cygwin64\bin\bash -l %cd%/_domake.sh %FIO_ARCH% %cd%
+
+
+:end
\ No newline at end of file
os/windows/fiopkg.cmd new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.29.2
#1 lore raw

Some minor comments otherwise looks good!

Quoted 28 lines · Rebecca Cran

fiobuild.cmd automates the building process to pass the correct arguments to configure to build fio for use on any x86 or x64 processor by using --disable-native.

fiopkg.cmd optionally signs the binaries, builds the installer and signs that too.

dobuild.cmd was misnamed, but is now used by CI. Keep it around, but update it to just call fiopkg.cmd.

---
 os/windows/_domake.sh   | 17 +++++++++++++
 os/windows/dobuild.cmd  | 53 +----------------------------------------
 os/windows/fiobuild.cmd | 17 +++++++++++++
 os/windows/fiopkg.cmd   | 52 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 87 insertions(+), 52 deletions(-)
 create mode 100755 os/windows/_domake.sh
 create mode 100644 os/windows/fiobuild.cmd
 create mode 100644 os/windows/fiopkg.cmd
os/windows/_domake.sh new file +0 -0
new file mode 100755
index 00000000..05625ff4

os/windows/_domake.sh line 1

Quoted 1 line
os/windows/_domake.sh new file +1 -0
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash

We use /bin/bash everywhere else so I think we should do so here for consistency.

<snip>

Quoted 10 lines
os/windows/fiobuild.cmd new file +4 -0
new file mode 100644
index 00000000..4a4171a2
@@ -0,0 +1,17 @@
+@echo off
+setlocal enabledelayedexpansion
+
+if "%1"=="x86" set FIO_ARCH=x86

os/windows/fiobuild.cmd line 14

Quoted 10 lines
os/windows/fiobuild.cmd new file +10 -0
+if "%1"=="x64" set FIO_ARCH=x64
+
+if not defined FIO_ARCH (
+  echo Error: must specify the architecture.
+  echo Usage: fiobuild x86
+  echo Usage: fiobuild x64
+  goto end
+)
+
+C:\Cygwin64\bin\bash -l %cd%/_domake.sh %FIO_ARCH% %cd%

Could you just call bash so you work in msys2 environments too?

Quoted 52 lines
os/windows/fiobuild.cmd new file +3 -0
+
+
+:end
\ No newline at end of file
os/windows/fiopkg.cmd new file +42 -0
new file mode 100644
index 00000000..08df3e87
@@ -0,0 +1,52 @@
+@echo off
+setlocal enabledelayedexpansion
+set /a counter=1
+for /f "tokens=3" %%i in (..\..\FIO-VERSION-FILE) do (
+ if "!counter!"=="1" set FIO_VERSION=%%i
+ set /a counter+=1
+)
+
+for /f "tokens=2 delims=-" %%i in ("%FIO_VERSION%") do (
+ set FIO_VERSION_NUMBERS=%%i
+)
+
+if not defined FIO_VERSION_NUMBERS (
+  echo Could not find version numbers in the string '%FIO_VERSION%'
+  echo Expected version to follow format 'fio-^([0-9]+.[0-9.]+^)'
+  goto end
+)
+
+if "%1"=="x86" set FIO_ARCH=x86
+if "%1"=="x64" set FIO_ARCH=x64
+
+if not defined FIO_ARCH (
+  echo Error: must specify the architecture.
+  echo Usage: dobuild x86
+  echo Usage: dobuild x64
+  goto end
+)
+
+if defined SIGN_FIO (
+  signtool sign /n "%SIGNING_CN%" /t http://timestamp.digicert.com ..\..\fio.exe
+  signtool sign /as /n "%SIGNING_CN%" /tr http://timestamp.digicert.com /td sha256 /fd sha256 ..\..\fio.exe
+
+  signtool sign /n "%SIGNING_CN%" /t http://timestamp.digicert.com ..\..\t\*.exe
+  signtool sign /as /n "%SIGNING_CN%" /tr http://timestamp.digicert.com /td sha256 /fd sha256 ..\..\t\*.exe
+)
+
+if exist ..\..\fio.pdb (
+  set FIO_PDB=true
+) else (
+  set FIO_PDB=false
+)
+

os/windows/fiopkg.cmd line 52

Quoted 10 lines
os/windows/fiopkg.cmd new file +10 -0
+"%WIX%bin\candle" -nologo -arch %FIO_ARCH% -dFioVersionNumbers="%FIO_VERSION_NUMBERS%" -dFioPDB="%FIO_PDB%" install.wxs
+@if ERRORLEVEL 1 goto end
+"%WIX%bin\candle" -nologo -arch %FIO_ARCH% examples.wxs
+@if ERRORLEVEL 1 goto end
+"%WIX%bin\light" -nologo -sice:ICE61 install.wixobj examples.wixobj -ext WixUIExtension -out %FIO_VERSION%-%FIO_ARCH%.msi
+:end
+
+if defined SIGN_FIO (
+  signtool sign /n "%SIGNING_CN%" /tr http://timestamp.digicert.com /td sha256 /fd sha256 %FIO_VERSION%-%FIO_ARCH%.msi
+)

Will it try to sign even if there was a packaging error?

Quoted 4 lines

--
2.29.2

Signature · 1 line
Sitsofe | http://sucs.org/~sits/