Difference between revisions of "Building Glimpse/Windows"

From GlimpseWiki
Jump to navigation Jump to search
(Updated config location)
(Added instructions for Visual Studio Code)
Line 49: Line 49:
   
 
Once the build is complete, you should be able to launch the application by typing <kbd>glimpse</kbd> into the same MSYS2 MinGW window. Your settings will be saved in the <kbd>%appdata%\Glimpse</kbd> folder by default.
 
Once the build is complete, you should be able to launch the application by typing <kbd>glimpse</kbd> into the same MSYS2 MinGW window. Your settings will be saved in the <kbd>%appdata%\Glimpse</kbd> folder by default.
  +
  +
=== Configure Visual Studio Code to use MSYS2 ===
  +
<ol>
  +
<li>Install the [https://marketplace.visualstudio.com/items?itemName=Tyriar.shell-launcher Shell launcher extension] and follow the provided instructions to set a keyboard shortcut for it.</li>
  +
<li>Navigate to '''File''' > '''Preferences''' > '''Settings''' > '''Extensions''' > '''Shell Launcher configuration''' and click on any link to edit <kbd>settings.json</kbd>.</li>
  +
<li>Add <kbd>"shellLauncher.shells.windows"</kbd> and the editor should autocomplete so the file looks similar to this (it will vary depending on which components you have already installed on your computer and your IDE settings):</li>
  +
<pre>{
  +
"shellLauncher.shells.windows": [
  +
{
  +
"shell": "C:\\Windows\\System32\\cmd.exe",
  +
"label": "cmd"
  +
},
  +
{
  +
"shell": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
  +
"label": "PowerShell"
  +
},
  +
{
  +
"shell": "C:\\Program Files\\Git\\bin\\bash.exe",
  +
"label": "Git bash"
  +
},
  +
{
  +
"shell": "C:\\Windows\\System32\\bash.exe",
  +
"label": "WSL Bash"
  +
}
  +
]
  +
}</pre>
  +
<li>Now add a new entry to the JSON array pointing at the MSYS2 shell executable path. Omit the <kbd>MSYS2_PATH_TYPE</kbd> variable if you do not want to inherit the <kbd>PATH</kbd> from the wider system:</li>
  +
<pre>{
  +
"shell": "C:\\msys64\\usr\\bin\\bash.exe",
  +
"label": "MSYS2",
  +
"args": ["--login", "-i"],
  +
"env": {
  +
"MSYSTEM": "MINGW64",
  +
"CHERE_INVOKING": "1",
  +
"MSYS2_PATH_TYPE": "inherit"
  +
}
  +
}</pre>
  +
<li>You should now be able to invoke the MSYS2 shell by using your keyboard shortcut and selecting it from the drop-down list.</li>
  +
[[File:Visual-studio-code-screenshot.jpg]]
  +
  +
</ol>
   
 
== Packaging ==
 
== Packaging ==

Revision as of 03:39, 23 September 2019

This page contains instructions specific to building the Glimpse source code locally on Windows systems.

Building

Build with MSYS2

  1. Download MSYS2 from https://www.msys2.org/ and then run the installer.
  2. Follow any other instructions presented on that download page to ensure key components managed by pacman are updated.
  3. Install the prerequisite build packages, selecting "default=all" when prompted. Replace x86-64 with i686 for each entry if you are running 32-bit Windows:
  4. pacman -S git base-devel \
    mingw-w64-x86_64-toolchain \
    mingw-w64-x86_64-asciidoc \
    mingw-w64-x86_64-drmingw \
    mingw-w64-x86_64-gexiv2 \
    mingw-w64-x86_64-ghostscript \
    mingw-w64-x86_64-glib-networking \
    mingw-w64-x86_64-graphviz \
    mingw-w64-x86_64-gtk2 \
    mingw-w64-x86_64-python2-pygtk \
    mingw-w64-x86_64-iso-codes \
    mingw-w64-x86_64-json-c \
    mingw-w64-x86_64-json-glib \
    mingw-w64-x86_64-lcms2 \
    mingw-w64-x86_64-lensfun \
    mingw-w64-x86_64-libheif \
    mingw-w64-x86_64-libraw \
    mingw-w64-x86_64-libspiro \
    mingw-w64-x86_64-libwebp \
    mingw-w64-x86_64-libwmf \
    mingw-w64-x86_64-openexr \
    mingw-w64-x86_64-poppler \
    mingw-w64-x86_64-SDL2 \
    mingw-w64-x86_64-suitesparse \
    mingw-w64-x86_64-vala \
    mingw-w64-x86_64-xpm-nox \
    mingw-w64-x86_64-gtk-doc
  5. Add the necessary environment variables in the C:\msys64\home\$USERNAME\.bash_profile file (omit ACLOCAL_FLAGS on 32-bit Windows):
  6. export PREFIX=`realpath ~/prefix`
    export PATH="$PREFIX/bin:$PATH"
    export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH"
    export LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH"
    export XDG_DATA_DIRS="$XDG_DATA_DIRS:$PREFIX/share:/usr/local/share/:/usr/share/"
    export ACLOCAL_FLAGS="-I/c/msys64/mingw64/share/aclocal"
  7. Reload your session with the environment variables you just set:
  8. source ~/.bash_profile
  9. Follow the build steps outlined in Building Glimpse, but append --prefix=$PREFIX to the end of each ./autogen.sh and ./configure command.
  10. The final Glimpse build step also needs the --disable-python flag to be set:
  11. ./autogen.sh --prefix=$PREFIX --disable-python
    make && make install

Once the build is complete, you should be able to launch the application by typing glimpse into the same MSYS2 MinGW window. Your settings will be saved in the %appdata%\Glimpse folder by default.

Configure Visual Studio Code to use MSYS2

  1. Install the Shell launcher extension and follow the provided instructions to set a keyboard shortcut for it.
  2. Navigate to File > Preferences > Settings > Extensions > Shell Launcher configuration and click on any link to edit settings.json.
  3. Add "shellLauncher.shells.windows" and the editor should autocomplete so the file looks similar to this (it will vary depending on which components you have already installed on your computer and your IDE settings):
  4. {
        "shellLauncher.shells.windows": [
            {
                "shell": "C:\\Windows\\System32\\cmd.exe",
                "label": "cmd"
            },
            {
                "shell": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "label": "PowerShell"
            },
            {
                "shell": "C:\\Program Files\\Git\\bin\\bash.exe",
                "label": "Git bash"
            },
            {
                "shell": "C:\\Windows\\System32\\bash.exe",
                "label": "WSL Bash"
            }
        ]
    }
  5. Now add a new entry to the JSON array pointing at the MSYS2 shell executable path. Omit the MSYS2_PATH_TYPE variable if you do not want to inherit the PATH from the wider system:
  6. {
        "shell": "C:\\msys64\\usr\\bin\\bash.exe",
        "label": "MSYS2",
        "args": ["--login", "-i"],
        "env": {
            "MSYSTEM": "MINGW64",
            "CHERE_INVOKING": "1",
            "MSYS2_PATH_TYPE": "inherit"
        }
    }
  7. You should now be able to invoke the MSYS2 shell by using your keyboard shortcut and selecting it from the drop-down list.
  8. Visual-studio-code-screenshot.jpg

Packaging

Package with WiX

TODO