33 lines
2.0 KiB
Bash
Executable File
33 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# 交叉编译 DuiLib 多皮肤壳 → shell64_dui.dll
|
||
# 用法: DUILIB_DIR=/tmp/duilib ./build-duilib.sh [源码] (默认 shell9_v6.cpp)
|
||
#
|
||
# 前置:先编 libduilib.a(老 DuiLib,mingw)。必须做的改动:
|
||
# - 排除 UIWebBrowser(ExDisp.h 不存在)/ UIRichEdit(goto 跨初始化)/ UIActiveX(CActiveXUI 未定义)
|
||
# - UIlib.h 里注释掉这三个控件的 include,UIDlgBuilder.cpp 删对应 new CXxxUI 分支
|
||
# - stb_image.c 单独按 C 编(header-only,否则 stbi_load_from_memory 未定义)
|
||
# - UICombo::GetClassStyle 不要自递归;UIOption 的 goto Label_ForeImage 就地展开
|
||
# - Utils::GetAt 返回 NULL;UIManager 取不到 HFONT 时返回 NULL
|
||
# - 链接入口是 WinMain 时不要加 -municode(否则链接器找 wWinMain)
|
||
set -euo pipefail
|
||
|
||
DIR=$(cd "$(dirname "$0")" && pwd)
|
||
SRC=${1:-$DIR/shell9_v6.cpp}
|
||
DUILIB_DIR=${DUILIB_DIR:-/tmp/duilib}
|
||
OUTDIR=${2:-$DIR/out}
|
||
LIBDUILIB=${LIBDUILIB:-$DUILIB_DIR/libduilib.a}
|
||
|
||
[ -f "$LIBDUILIB" ] || { echo "缺少 $LIBDUILIB:先按上面注释里的步骤编 libduilib.a,或用 LIBDUILIB=... 指定"; exit 1; }
|
||
mkdir -p "$OUTDIR"
|
||
|
||
# 导入表按实测产物取:ADVAPI32/bcrypt/COMCTL32/GDI32/gdiplus/KERNEL32/msvcrt/ole32/SHELL32/USER32/WINHTTP
|
||
x86_64-w64-mingw32-g++ -std=c++17 -O2 -shared -s \
|
||
-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN32_LEAN_AND_MEAN \
|
||
-I"$DUILIB_DIR/shim" -I"$DUILIB_DIR" -I"$DUILIB_DIR/DuiLib" -I"$DUILIB_DIR/DuiLib/Core" -I"$DUILIB_DIR/DuiLib/Control" -I"$DUILIB_DIR/DuiLib/Layout" -I"$DUILIB_DIR/DuiLib/Utils" -include "$DUILIB_DIR/shim/compat.h" -fpermissive -w \
|
||
-o "$OUTDIR/shell64_dui.dll" "$SRC" "$LIBDUILIB" \
|
||
-static -lcomctl32 -lgdiplus -lole32 -loleaut32 -luuid -lshlwapi -limm32 -lwinmm -lversion \
|
||
-lgdi32 -luser32 -lwinhttp -ladvapi32 -lbcrypt -Wl,--kill-at
|
||
|
||
echo "生成 $OUTDIR/shell64_dui.dll($(stat -c%s "$OUTDIR/shell64_dui.dll") 字节)"
|
||
echo "皮肤用 XML 字符串内嵌,theme 从壳 cfg 读;加壳任务侧用 shell_theme 选择,非法值请在校验层挡掉。"
|