Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include rcedit for Windows builds #21

Closed
OverloadedOrama opened this issue Jun 25, 2020 · 4 comments
Closed

Include rcedit for Windows builds #21

OverloadedOrama opened this issue Jun 25, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@OverloadedOrama
Copy link
Contributor

OverloadedOrama commented Jun 25, 2020

Currently, Windows builds generated by godot-ci do not have an icon and the Windows preset options found in export_presets.cfg are ignored. To solve this, godot-ci needs to install rcedit (and possibly WINE), and include the paths to these binaries inside Godot's editor settings. See this for more information: https://docs.godotengine.org/en/stable/getting_started/workflow/export/changing_application_icon_for_windows.html

@abarichello abarichello added bug Something isn't working good first issue Good for newcomers labels Jun 25, 2020
@OverloadedOrama
Copy link
Contributor Author

OverloadedOrama commented Sep 5, 2020

As a workaround to this issue, I added an extra step before the rest of the steps for Windows builds in the workflow file, that downloads and sets up WINE and recedit.

The instructions are these:

      - name: Setup WINE and rcedit 🍷
        run: |
          dpkg --add-architecture i386 && apt-get update && apt-get install -y wine-stable && apt-get install -y wine32
          chown root:root -R ~
          wget https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe
          mkdir -v -p ~/.local/share/rcedit
          mv rcedit-x64.exe ~/.local/share/rcedit
          godot -q
          echo 'export/windows/wine = "/usr/bin/wine"' >> ~/.config/godot/editor_settings-3.tres
          echo 'export/windows/rcedit = "/github/home/.local/share/rcedit/rcedit-x64.exe"' >> ~/.config/godot/editor_settings-3.tres

It first downloads WINE. I'm not sure if wine-stable is needed, but if wine32 isn't installed, it complains. dpkg --add-architecture i386 is needed to download wine32. Then, it runs chown to change the owner of the home (~) directory. Otherwise WINE complains that ~ is not owned by us and refuses to create a configuration directory there.
It then downloads rcedit.x64 from GitHub, and places it in a new ~/.local/share/rcedit directory. I'm not sure if that's the best place for it to be, but it works.
godot -q runs Godot and quits immediately. We do this in order to create the editor_settings-3.tres file. And then we simply add the export/windows/wine and export/windows/rcedit paths to the editor settings.

This solution might not be the most optimized one, so feel free to suggest improvements. It does work properly though. You can see a full example here: https://github.com/Orama-Interactive/Pixelorama/blob/master/.github/workflows/dev-desktop-builds.yml

I tried writing these instructions inside a Dockerfile, but so far I didn't manage to make it work. The logic should be similar though. Is it best to do it in the workflow, or if this should be done in the Dockerfile itself?

@Xananax
Copy link

Xananax commented Oct 15, 2020

I add Imagemagick, Wine, and Rcedit to the docker.

Wine and RCEdit to integrate the icon, and imagemagick to generate it from a png image (as well as potentially generating the OSX icns with icnsutils, though I haven't gotten there yet)

I also generate inline a small script set-icon, which takes a png path and a godot exported exe, and sets the icon on it

example usage:

set-icon path/to/icon.png $(pwd)/build/windows/$EXPORT_NAME.exe

Here's the dockerfile:

FROM ubuntu:bionic
LABEL author="[email protected]"

ARG GODOT_VERSION=3.2.3

USER root

RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    git \
    python \
    python-openssl \
    unzip \
    wget \
    zip \
    wine-stable \
    wine64 \
    imagemagick \
    icnsutils \
    curl \
    --fix-missing \
    && rm -rf /var/lib/apt/lists/*

ENV GODOT_VERSION=$GODOT_VERSION
ENV WINEDEBUG -all

RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \
    && wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_export_templates.tpz \
    && mkdir ~/.cache \
    && mkdir -p ~/.config/godot \
    && mkdir -p ~/.local/share/godot/templates/${GODOT_VERSION}.stable \
    && unzip Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \
    && mv Godot_v${GODOT_VERSION}-stable_linux_headless.64 /usr/local/bin/godot \
    && unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz \
    && mv templates/* ~/.local/share/godot/templates/${GODOT_VERSION}.stable \
    && rm -f Godot_v${GODOT_VERSION}-stable_export_templates.tpz Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip

RUN wget https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe \
    && mkdir -p /opt/rcedit \
    && mkdir -p /opt/rcedit/bin \
    && mv rcedit-x64.exe /opt/rcedit

RUN mkdir -p /opt/butler
RUN wget -O /opt/butler/butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
RUN unzip /opt/butler/butler.zip -d /opt/butler
RUN rm -rf /opt/butler/butler.zip
RUN ls /opt/butler
RUN chmod +x /opt/butler/butler
RUN /opt/butler/butler -V

RUN echo "convert \$1 -define icon:auto-resize=256,128,64,48,32,16 /tmp/icon.ico && wine /opt/rcedit/rcedit-x64.exe \$2 --set-icon /tmp/icon.ico" > /opt/rcedit/bin/set-icon
RUN chmod +x /opt/rcedit/bin/set-icon

ENV PATH="/opt/butler/:/opt/rcedit/bin/:${PATH}"

I have the Godot version as an arg, so you can build the docker this way:

sudo docker build -t xananax/godot-ci:3.2.3 --build-arg GODOT_VERSION=3.2.3 .

Is there any interest in a PR?

@2shady4u
Copy link
Contributor

this would be nice to have yes :)

@abarichello abarichello added enhancement New feature or request and removed bug Something isn't working good first issue Good for newcomers labels Sep 21, 2021
@Calinou
Copy link
Collaborator

Calinou commented Jul 13, 2024

@Calinou Calinou closed this as completed Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants