Skip to content

Commit

Permalink
build: mark all PE files as wine builtins
Browse files Browse the repository at this point in the history
This allows libmono to load extra libraries (notably win-iconv) from
system_dllpath.

For example, Fedora's wine-mono is built against a shared win-iconv
installed in system_dllpath, but wine will not search there unless it's
explicitly instructed to do so since wine commit bfbccf1a (ntdll: Prevent
loading Wine system dependencies in place of identically named application
DLLs.).

https://gitlab.winehq.org/wine/wine/-/merge_requests/7077
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54573
  • Loading branch information
mochaaP committed Jan 4, 2025
1 parent e7370bd commit f2d4798
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ define MINGW_TEMPLATE =

ifeq (1,$(ENABLE_DEBUG_SYMBOLS))
ifeq (1,$(PREFER_DWARF_SYMBOLS))
INSTALL_PE_$(1)=do_install () { $$(MINGW_ENV) $$(MINGW_$(1))-objcopy --only-keep-debug "$$$$1" "$$$$(printf %s "$$$$2"|sed -e 's/\....$$$$/.dbg/')"; $$(MINGW_ENV) $$(MINGW_$(1))-objcopy --strip-all "$$$$1" "$$$$2"; $$(MINGW_ENV) $$(MINGW_$(1))-objcopy --add-gnu-debuglink="$$$$(printf %s "$$$$2"|sed -e 's/\....$$$$/.dbg/')" "$$$$2"; }; do_install
INSTALL_PE_$(1)=do_install () { $$(MINGW_ENV) $$(MINGW_$(1))-objcopy --only-keep-debug "$$$$1" "$$$$(printf %s "$$$$2"|sed -e 's/\....$$$$/.dbg/')"; $$(MINGW_ENV) $$(MINGW_$(1))-objcopy --strip-all "$$$$1" "$$$$2"; $$(MINGW_ENV) $$(MINGW_$(1))-objcopy --add-gnu-debuglink="$$$$(printf %s "$$$$2"|sed -e 's/\....$$$$/.dbg/')" "$$$$2"; tools/mark-wine-builtin.sh "$$$$2"; }; do_install
PDB_CFLAGS_$(1)=-gdwarf-4 -g
PDB_LDFLAGS_$(1)=
else
INSTALL_PE_$(1)=do_install () { cp "$$$$(printf %s "$$$$1"|sed -e 's/\....$$$$/.pdb/')" "$$$$(printf %s "$$$$2"|sed -e 's/\....$$$$/.pdb/')"; cp "$$$$1" "$$$$2"; $$(MINGW_ENV) $$(MINGW_$(1))-strip "$$$$2"; }; do_install
INSTALL_PE_$(1)=do_install () { cp "$$$$(printf %s "$$$$1"|sed -e 's/\....$$$$/.pdb/')" "$$$$(printf %s "$$$$2"|sed -e 's/\....$$$$/.pdb/')"; cp "$$$$1" "$$$$2"; $$(MINGW_ENV) $$(MINGW_$(1))-strip "$$$$2"; tools/mark-wine-builtin.sh "$$$$2"; }; do_install
PDB_CFLAGS_$(1)=-gcodeview -g
PDB_LDFLAGS_$(1)=-Wl,-pdb=
endif
else
INSTALL_PE_$(1)=do_install () { cp "$$$$1" "$$$$2"; $$(MINGW_ENV) $$(MINGW_$(1))-strip "$$$$2"; }; do_install
INSTALL_PE_$(1)=do_install () { cp "$$$$1" "$$$$2"; $$(MINGW_ENV) $$(MINGW_$(1))-strip "$$$$2"; tools/mark-wine-builtin.sh "$$$$2"; }; do_install
endif

# installinf.exe
Expand Down
3 changes: 3 additions & 0 deletions tools/mark-wine-builtin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

printf 'Wine builtin DLL\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' | dd if=/dev/stdin of="$1" bs=1 seek=64 count=32 conv=notrunc

0 comments on commit f2d4798

Please sign in to comment.