mirror of
https://github.com/ip7z/7zip.git
synced 2026-04-21 06:03:40 +00:00
**Arquivos-Chave** [CompressDialog.cpp](c:/Users/ferna/DEV/CPP/7zip/CPP/7zip/UI/GUI/CompressDialog.cpp), [CompressDialog.h](c:/Users/ferna/DEV/CPP/7zip/CPP/7zip/UI/GUI/CompressDialog.h), [CompressDialog.rc](c:/Users/ferna/DEV/CPP/7zip/CPP/7zip/UI/GUI/CompressDialog.rc), [UpdateGUI.cpp](c:/Users/ferna/DEV/CPP/7zip/CPP/7zip/UI/GUI/UpdateGUI.cpp), [Update.h](c:/Users/ferna/DEV/CPP/7zip/CPP/7zip/UI/Common/Update.h), [LangUtils.cpp](c:/Users/ferna/DEV/CPP/7zip/CPP/7zip/UI/FileManager/LangUtils.cpp), [Build.mak](c:/Users/ferna/DEV/CPP/7zip/CPP/Build.mak), [makefile](c:/Users/ferna/DEV/CPP/7zip/CPP/7zip/Bundles/Fm/makefile), [7zipUninstall.c](c:/Users/ferna/DEV/CPP/7zip/C/Util/7zipUninstall/7zipUninstall.c), [7zipInstall.c](c:/Users/ferna/DEV/CPP/7zip/C/Util/7zipInstall/7zipInstall.c) **English** Suggested title: `Support multiple output archives, per-item packaging flow, and packaging/uninstall hardening` This PR extends the fork’s compression flow to support multiple output archives and, when the operation starts from multiple selected items, to execute per-item packaging with isolated destinations. The change is carried from the UI down to the options/execution layer, with safe initialization of the new state so the legacy behavior remains intact when the feature is not used. - The data model was extended to carry multiple destinations and item→archive mappings through `ArcPaths`, `SeparateItemMode`, `SeparateItemPaths`, `SeparateItemArchivePaths`, `ItemPaths`, `ItemOutputItemPaths`, and `ItemArcPaths`. - The compression dialog was reworked to accept up to 5 output paths, with an output-count selector, extra combo boxes, dynamic layout resizing, and per-item groups when multiple items are selected. - Archive name and extension handling was hardened: when the format or SFX state changes, the code removes the previous extension before appending the new one, preventing outputs such as `.7z.zip` or `.exe.exe`, while preserving `KeepName` formats and hash-based handlers. - Dialog finalization now validates empty and duplicate paths, normalizes final output paths, and blocks unsafe combinations with `Delete after compression`, especially when the same source item could feed more than one output. - The update pipeline no longer assumes a single `CUpdateArchiveCommand`. `UpdateGUI` now accepts multiple targets, recomputes `WorkingDir` per archive path, and, in separate-item mode, calls `UpdateArchive()` once per item/destination so failures stay isolated and the item-to-output mapping remains explicit. - Input items are now collected from the `censor` with explicit deduplication, keeping the actual UI selection aligned with the execution layer. - Language lookup and packaging were adapted for redistributed layouts: `LangUtils.cpp` now searches parent directories for `Lang`, while the File Manager bundle makefile copies language files into the relevant output folders. - The makefiles were hardened with explicit dependencies for the new resources, and `Build.mak` stops passing `$**` to `rc`, using only the target `.rc` file as the actual resource compiler input. - The uninstaller was strengthened for real Windows shell scenarios: it removes stale shell-extension CLSIDs first, tries to unload `7-zip.dll` and `7-zip32.dll` from `explorer.exe`, clears `read-only` attributes, removes `.tmp*` variants, schedules locked files for deletion after reboot, notifies shell association changes, and self-elevates with `runas`. - The installer now writes fork-specific uninstall metadata (`DisplayName`, `DisplayVersion`, `Publisher`), making it easier to distinguish the fork from the official build in Windows “Programs and Features”. Upstream note: the code already contains groundwork for a text-based output-path editor, but the corresponding UI entry point is currently hidden; the visible behavior today is the inline multi-output/per-item layout. The current `AboutDialog.*` files do not show a semantic diff and look like line-ending-only changes, so I would keep them out of the functional PR. Se quiser, eu também posso transformar isso no formato exato de corpo de PR do GitHub, com seções como `Summary`, `Motivation`, `Implementation Details`, `Risks` e `Validation`, já pronto para colar. **Português** Título sugerido: `Support multiple output archives, per-item packaging flow, and packaging/uninstall hardening` Este PR amplia o fluxo de compressão do fork para suportar múltiplos arquivos de saída e, quando a operação parte de múltiplos itens selecionados, executar um empacotamento item a item com isolamento de destino. A mudança foi propagada da UI até a camada de opções/execução, com inicialização segura dos novos estados para preservar o comportamento legado quando o recurso não é utilizado. - A estrutura de dados foi estendida para transportar múltiplos destinos e mapeamentos item→arquivo com `ArcPaths`, `SeparateItemMode`, `SeparateItemPaths`, `SeparateItemArchivePaths`, `ItemPaths`, `ItemOutputItemPaths` e `ItemArcPaths`. - A janela de compressão foi reestruturada para aceitar até 5 caminhos de saída, com contador de destinos, combos adicionais, redimensionamento dinâmico do layout e grupos por item quando há multi-seleção. - O tratamento de nomes e extensões foi endurecido: ao trocar formato ou SFX, o código remove a extensão anterior antes de anexar a nova, evitando resultados como `.7z.zip` ou `.exe.exe`, sem quebrar formatos `KeepName` ou handlers baseados em hash. - O fechamento do diálogo agora valida caminhos vazios e duplicados, normaliza caminhos finais e bloqueia combinações inseguras com `Delete after compression`, especialmente quando o mesmo item poderia alimentar múltiplos outputs. - O pipeline de update deixou de assumir um único `CUpdateArchiveCommand`. O `UpdateGUI` agora aceita vários destinos, recompõe `WorkingDir` por arquivo de saída e, em modo separado, executa `UpdateArchive()` individualmente por item/destino para isolar erros e preservar o vínculo entre item selecionado e arquivo gerado. - A coleta dos itens de entrada passou a ser feita a partir do `censor`, com deduplicação explícita, garantindo consistência entre a seleção real da UI e a execução. - O suporte a idiomas e empacotamento foi ajustado para layouts redistribuídos: `LangUtils.cpp` agora procura a pasta `Lang` subindo a árvore de diretórios, enquanto o bundle do File Manager copia os arquivos de idioma para os diretórios de saída relevantes. - Os makefiles foram fortalecidos com dependências explícitas dos novos recursos, e `Build.mak` deixou de passar `$**` ao `rc`, usando apenas o `.rc` alvo como entrada efetiva do compilador de recursos. - O desinstalador foi reforçado para cenários reais do Windows: remoção prévia de CLSIDs da shell extension, tentativa de descarregar `7-zip.dll` e `7-zip32.dll` do `explorer.exe`, limpeza de arquivos `read-only`, remoção de variantes `.tmp*`, agendamento para exclusão após reboot quando o arquivo está travado, notificação de alteração de associações e autoelevação com `runas`. - O instalador também passou a gravar metadados próprios do fork no registro de desinstalação (`DisplayName`, `DisplayVersion`, `Publisher`), facilitando a distinção entre o fork e a build oficial no painel “Programs and Features”. Nota para a equipe upstream: a infraestrutura de um editor textual de caminhos de saída já existe no código, mas a entrada visual correspondente permanece oculta; hoje, o comportamento efetivamente exposto é o layout inline com múltiplos destinos e o fluxo por item em multi-seleção. Os arquivos `AboutDialog.*` não exibem diff semântico no estado atual e parecem ser apenas normalização de fim de linha, então eu os separaria da PR funcional.
252 lines
5 KiB
Makefile
252 lines
5 KiB
Makefile
LIBS = $(LIBS) oleaut32.lib ole32.lib
|
|
|
|
# CFLAGS = $(CFLAGS) -DZ7_NO_UNICODE
|
|
!IFNDEF MY_NO_UNICODE
|
|
# CFLAGS = $(CFLAGS) -DUNICODE -D_UNICODE
|
|
!ENDIF
|
|
|
|
!IF "$(CC)" != "clang-cl"
|
|
# for link time code generation:
|
|
# CFLAGS = $(CFLAGS) -GL
|
|
!ENDIF
|
|
|
|
!IFNDEF O
|
|
!IFDEF PLATFORM
|
|
O=$(PLATFORM)
|
|
!ELSE
|
|
O=o
|
|
!ENDIF
|
|
!ENDIF
|
|
|
|
!IF "$(CC)" != "clang-cl"
|
|
# CFLAGS = $(CFLAGS) -FAsc -Fa$O/asm/
|
|
!ENDIF
|
|
|
|
# LFLAGS = $(LFLAGS) /guard:cf
|
|
|
|
|
|
!IF "$(PLATFORM)" == "x64"
|
|
MY_ML = ml64 -WX
|
|
#-Dx64
|
|
!ELSEIF "$(PLATFORM)" == "arm64"
|
|
MY_ML = armasm64
|
|
!ELSEIF "$(PLATFORM)" == "arm"
|
|
MY_ML = armasm -WX
|
|
!ELSE
|
|
MY_ML = ml -WX
|
|
# -DABI_CDECL
|
|
!ENDIF
|
|
|
|
# MY_ML = "$(MY_ML) -Fl$O\asm\
|
|
|
|
|
|
!IFDEF UNDER_CE
|
|
RFLAGS = $(RFLAGS) -dUNDER_CE
|
|
!IFDEF MY_CONSOLE
|
|
LFLAGS = $(LFLAGS) /ENTRY:mainACRTStartup
|
|
!ENDIF
|
|
!ELSE
|
|
!IFDEF OLD_COMPILER
|
|
LFLAGS = $(LFLAGS) -OPT:NOWIN98
|
|
!ENDIF
|
|
!IF "$(PLATFORM)" != "arm" && "$(PLATFORM)" != "arm64"
|
|
CFLAGS = $(CFLAGS) -Gr
|
|
!ENDIF
|
|
LIBS = $(LIBS) user32.lib advapi32.lib shell32.lib
|
|
!ENDIF
|
|
|
|
!IF "$(PLATFORM)" == "arm"
|
|
COMPL_ASM = $(MY_ML) $** $O/$(*B).obj
|
|
!ELSEIF "$(PLATFORM)" == "arm64"
|
|
COMPL_ASM = $(MY_ML) $** $O/$(*B).obj
|
|
!ELSE
|
|
COMPL_ASM = $(MY_ML) -c -Fo$O/ $**
|
|
!ENDIF
|
|
|
|
!IFDEF OLD_COMPILER
|
|
CFLAGS_WARN_LEVEL = -W4
|
|
!ELSE
|
|
CFLAGS_WARN_LEVEL = -Wall
|
|
!ENDIF
|
|
|
|
CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ $(CFLAGS_WARN_LEVEL) -WX -EHsc -Gy -GR- -GF
|
|
|
|
!IF "$(CC)" == "clang-cl"
|
|
|
|
CFLAGS = $(CFLAGS) \
|
|
-Werror \
|
|
-Wall \
|
|
-Wextra \
|
|
-Weverything \
|
|
-Wfatal-errors \
|
|
|
|
!ENDIF
|
|
|
|
# !IFDEF MY_DYNAMIC_LINK
|
|
!IF "$(MY_DYNAMIC_LINK)" != ""
|
|
CFLAGS = $(CFLAGS) -MD
|
|
!ELSE
|
|
!IFNDEF MY_SINGLE_THREAD
|
|
CFLAGS = $(CFLAGS) -MT
|
|
!ENDIF
|
|
!ENDIF
|
|
|
|
|
|
CFLAGS = $(CFLAGS_COMMON) $(CFLAGS)
|
|
|
|
|
|
!IFNDEF OLD_COMPILER
|
|
|
|
CFLAGS = $(CFLAGS) -GS- -Zc:wchar_t
|
|
!IFDEF VCTOOLSVERSION
|
|
!IF "$(VCTOOLSVERSION)" >= "14.00"
|
|
!IF "$(CC)" != "clang-cl"
|
|
CFLAGS = $(CFLAGS) -Zc:throwingNew
|
|
!ENDIF
|
|
!ENDIF
|
|
!ELSE
|
|
# -Zc:forScope is default in VS2010. so we need it only for older versions
|
|
CFLAGS = $(CFLAGS) -Zc:forScope
|
|
!ENDIF
|
|
|
|
!IFNDEF UNDER_CE
|
|
!IF "$(CC)" != "clang-cl"
|
|
MP_NPROC = 16
|
|
!IFDEF NUMBER_OF_PROCESSORS
|
|
!IF $(NUMBER_OF_PROCESSORS) < $(MP_NPROC)
|
|
MP_NPROC = $(NUMBER_OF_PROCESSORS)
|
|
!ENDIF
|
|
!ENDIF
|
|
CFLAGS = $(CFLAGS) -MP$(MP_NPROC)
|
|
!ENDIF
|
|
!IFNDEF PLATFORM
|
|
# CFLAGS = $(CFLAGS) -arch:IA32
|
|
!ENDIF
|
|
!ENDIF
|
|
|
|
!ENDIF
|
|
|
|
|
|
!IFDEF MY_CONSOLE
|
|
CFLAGS = $(CFLAGS) -D_CONSOLE
|
|
!ENDIF
|
|
|
|
!IFNDEF UNDER_CE
|
|
!IF "$(PLATFORM)" == "arm"
|
|
CFLAGS = $(CFLAGS) -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
|
|
!ENDIF
|
|
!ENDIF
|
|
|
|
!IF "$(PLATFORM)" == "x64"
|
|
CFLAGS_O1 = $(CFLAGS) -O1
|
|
!ELSE
|
|
CFLAGS_O1 = $(CFLAGS) -O1
|
|
!ENDIF
|
|
CFLAGS_O2 = $(CFLAGS) -O2
|
|
|
|
LFLAGS = $(LFLAGS) -nologo -OPT:REF -OPT:ICF -INCREMENTAL:NO
|
|
|
|
!IFNDEF UNDER_CE
|
|
LFLAGS = $(LFLAGS) /LARGEADDRESSAWARE
|
|
!ENDIF
|
|
|
|
!IFDEF DEF_FILE
|
|
LFLAGS = $(LFLAGS) -DLL -DEF:$(DEF_FILE)
|
|
!ELSE
|
|
!IF defined(MY_FIXED) && "$(PLATFORM)" != "arm" && "$(PLATFORM)" != "arm64"
|
|
LFLAGS = $(LFLAGS) /FIXED
|
|
!ELSE
|
|
LFLAGS = $(LFLAGS) /FIXED:NO
|
|
!ENDIF
|
|
# /BASE:0x400000
|
|
!ENDIF
|
|
|
|
!IF "$(PLATFORM)" == "arm64"
|
|
# we can get better compression ratio with ARM64 filter if we change alignment to 4096
|
|
# LFLAGS = $(LFLAGS) /FILEALIGN:4096
|
|
!ENDIF
|
|
|
|
|
|
|
|
# !IF "$(PLATFORM)" == "x64"
|
|
|
|
!IFDEF SUB_SYS_VER
|
|
|
|
MY_SUB_SYS_VER=5.02
|
|
|
|
!IFDEF MY_CONSOLE
|
|
LFLAGS = $(LFLAGS) /SUBSYSTEM:console,$(MY_SUB_SYS_VER)
|
|
!ELSE
|
|
LFLAGS = $(LFLAGS) /SUBSYSTEM:windows,$(MY_SUB_SYS_VER)
|
|
!ENDIF
|
|
|
|
!ENDIF
|
|
|
|
|
|
!IF "$(PLATFORM)" == "arm64"
|
|
CLANG_FLAGS_TARGET = --target=arm64-pc-windows-msvc
|
|
!ENDIF
|
|
|
|
COMPL_CLANG_SPEC=clang-cl $(CLANG_FLAGS_TARGET)
|
|
COMPL_ASM_CLANG = $(COMPL_CLANG_SPEC) -nologo -c -Fo$O/ $(CFLAGS_WARN_LEVEL) -WX $**
|
|
# COMPL_C_CLANG = $(COMPL_CLANG_SPEC) $(CFLAGS_O2)
|
|
|
|
|
|
PROGPATH = $O\$(PROG)
|
|
|
|
COMPL_O1 = $(CC) $(CFLAGS_O1) $**
|
|
COMPL_O2 = $(CC) $(CFLAGS_O2) $**
|
|
COMPL_PCH = $(CC) $(CFLAGS_O1) -Yc"StdAfx.h" -Fp$O/a.pch $**
|
|
COMPL = $(CC) $(CFLAGS_O1) -Yu"StdAfx.h" -Fp$O/a.pch $**
|
|
COMPLB = $(CC) $(CFLAGS_O1) -Yu"StdAfx.h" -Fp$O/a.pch $<
|
|
COMPLB_O2 = $(CC) $(CFLAGS_O2) $<
|
|
# COMPLB_O2 = $(CC) $(CFLAGS_O2) -Yu"StdAfx.h" -Fp$O/a.pch $<
|
|
|
|
CFLAGS_C_ALL = $(CFLAGS_O2) $(CFLAGS_C_SPEC)
|
|
|
|
CCOMPL_PCH = $(CC) $(CFLAGS_C_ALL) -Yc"Precomp.h" -Fp$O/a.pch $**
|
|
CCOMPL_USE = $(CC) $(CFLAGS_C_ALL) -Yu"Precomp.h" -Fp$O/a.pch $**
|
|
CCOMPLB_USE = $(CC) $(CFLAGS_C_ALL) -Yu"Precomp.h" -Fp$O/a.pch $<
|
|
CCOMPL = $(CC) $(CFLAGS_C_ALL) $**
|
|
CCOMPLB = $(CC) $(CFLAGS_C_ALL) $<
|
|
|
|
!IF "$(CC)" == "clang-cl"
|
|
COMPL = $(COMPL) -FI StdAfx.h
|
|
COMPLB = $(COMPLB) -FI StdAfx.h
|
|
CCOMPL_USE = $(CCOMPL_USE) -FI Precomp.h
|
|
CCOMPLB_USE = $(CCOMPLB_USE) -FI Precomp.h
|
|
!ENDIF
|
|
|
|
all: $(PROGPATH)
|
|
|
|
clean:
|
|
-del /Q $(PROGPATH) $O\*.exe $O\*.dll $O\*.obj $O\*.lib $O\*.exp $O\*.res $O\*.pch $O\*.asm
|
|
|
|
$O:
|
|
if not exist "$O" mkdir "$O"
|
|
$O/asm:
|
|
if not exist "$O/asm" mkdir "$O/asm"
|
|
|
|
!IF "$(CC)" != "clang-cl"
|
|
# for link time code generation:
|
|
# LFLAGS = $(LFLAGS) -LTCG
|
|
!ENDIF
|
|
|
|
$(PROGPATH): $O $O/asm $(OBJS) $(DEF_FILE)
|
|
link $(LFLAGS) -out:$(PROGPATH) $(OBJS) $(LIBS)
|
|
|
|
!IFNDEF NO_DEFAULT_RES
|
|
$O\resource.res: $(*B).rc
|
|
rc $(RFLAGS) -fo$@ $(@B).rc
|
|
!ENDIF
|
|
$O\StdAfx.obj: $(*B).cpp
|
|
$(COMPL_PCH)
|
|
|
|
predef: empty.c
|
|
$(CCOMPL) /EP /Zc:preprocessor /PD
|
|
predef2: A.cpp
|
|
$(COMPL) -EP -Zc:preprocessor -PD
|
|
predef3: A.cpp
|
|
$(COMPL) -E -dM
|
|
predef4: A.cpp
|
|
$(COMPL_O2) -E
|