Skip to content

Commit

Permalink
Build on windows: use MinGW libs where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
amolenaar committed Nov 15, 2019
1 parent 34db71d commit 7f82c50
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
9 changes: 2 additions & 7 deletions .azure/msys2-install.sh
Expand Up @@ -15,13 +15,8 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-gobject-introspection \
mingw-w64-$MSYS2_ARCH-python3 \
mingw-w64-$MSYS2_ARCH-python3-lxml \
mingw-w64-$MSYS2_ARCH-python3-importlib-metadata \
mingw-w64-$MSYS2_ARCH-python3-gobject \
mingw-w64-$MSYS2_ARCH-python3-cairo \
mingw-w64-$MSYS2_ARCH-python3-pip \
mingw-w64-$MSYS2_ARCH-python3-setuptools \
mingw-w64-$MSYS2_ARCH-python3-zope.interface \
mingw-w64-$MSYS2_ARCH-python3-coverage \
mingw-w64-$MSYS2_ARCH-python3-pytest
mingw-w64-$MSYS2_ARCH-python3-pip

source venv
./venv -S
9 changes: 7 additions & 2 deletions README.md
Expand Up @@ -105,14 +105,19 @@ To setup a development environment in Windows:
```bash
$ pacman -Suy
$ pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-python3-gobject mingw-w64-x86_64-python3-cairo
$ pacman -S mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-setuptools
$ pacman -S mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-lxml
```
Install git if it isn't already installed in msys2 with `pacman -S git`

Ensure `/mingw64/bin` is added to your `PATH`:
```bash
$ export PATH=/mingw64/bin:$PATH
```

[Clone the repository](https://help.github.com/en/articles/cloning-a-repository).
```bash
$ cd gaphor
$ source ./venv
$ source ./venv -S
$ poetry run gaphor
```

Expand Down
15 changes: 13 additions & 2 deletions venv
Expand Up @@ -18,6 +18,12 @@ brew --version >/dev/null 2>&1 && {
export PKG_CONFIG_PATH="${libffi_path}:${PKG_CONFIG_PATH:-}"
}

echo "Are we on MSys (Windows)?"
uname -a | grep -q MSYS_NT && {
export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
export PATH="/mingw64/bin:${PATH}"
}

(
# Do the whole installation process in a sub-shell, so we can safely fail when
# this file is sourced in the parent shell.
Expand All @@ -30,12 +36,17 @@ brew --version >/dev/null 2>&1 && {

NO_FORCE_INSTALL=true

while getopts 'fh' OPTION
while getopts 'fSh' OPTION
do
case "$OPTION" in
f)
NO_FORCE_INSTALL=false
;;
S)
VENV_OPTS="--system-site-packages"
;;
h) echo "Usage: $0 [-f] [-S] [-h] # -f = force install, -S = Use system site packages, -h = this message"
exit 0
esac
done

Expand All @@ -53,7 +64,7 @@ brew --version >/dev/null 2>&1 && {

test -d .venv || {
echo "Setting up a virtual env for Gaphor..."
python3 -m venv --prompt Gaphor .venv
python3 -m venv --prompt Gaphor ${VENV_OPTS:-} .venv
}

source .venv/bin/activate
Expand Down

0 comments on commit 7f82c50

Please sign in to comment.