macOS
brew install unifdeflocal Homebrew formula metadata
sudo port install unifdefMacPorts ports tree · devel/unifdef/Portfile · 来源: api.github.com
安装
brew install unifdeflocal Homebrew formula metadata
sudo port install unifdefMacPorts ports tree · devel/unifdef/Portfile · 来源: api.github.com
sudo apk add unifdefAlpine Linux edge package indexes · unifdef · 来源: dl-cdn.alpinelinux.org
sudo apt install unifdefDebian stable package indexes · unifdef · 来源: deb.debian.org
sudo dnf install unifdefFedora Rawhide package metadata · unifdef · 来源: dl.fedoraproject.org
nix profile install nixpkgs#unifdefnixpkgs package indexes · pkgs/by-name/un/unifdef/package.nix · 来源: api.github.com
sudo pacman -S unifdefArch Linux sync databases · unifdef · 来源: geo.mirror.pkgbuild.com
sudo zypper install unifdefopenSUSE Tumbleweed package metadata · unifdef · 来源: download.opensuse.org
概览
Selectively process conditional C preprocessor directives
历史
unifdef is a source-filtering utility that selectively removes C preprocessor conditionals. The official manual says it processes `#if`, `#ifdef`, `#ifndef`, `#elif`, `#else`, and `#endif` lines when command-line macro definitions are sufficient to decide whether a block should be kept or removed.
unifdef is much older than its GitHub mirror. The official manual states that the command appeared in 2.9BSD, and that ANSI C support was added in FreeBSD 4.7. It also credits the original implementation to Dave Yost and Tony Finch's rewrite for ANSI C support.
Tony Finch's official project page explains the modern motivation: understanding `xterm`'s heavily conditionalized pty-handling code. That places unifdef in the Unix source-reading and source-cleanup tradition rather than in general-purpose preprocessing.
The current project page publishes release archives, manual documentation, a browsable source repository, and a GitHub collaboration mirror. The GitHub README warns that GitHub release downloads are incomplete and points users back to the official dotat.at release files, which is useful context for packagers.
The official homepage gives a concrete high-profile adoption example: the Linux kernel uses unifdef to strip `#ifdef __KERNEL__` sections from headers exported to userland. It also notes use outside C, including LaTeX workflows.
The supplied package facts show broad distribution packaging across Homebrew, Debian/Ubuntu, Fedora/DNF, Alpine, Arch, MacPorts, Nix, openSUSE, and others. That matches the tool's age and purpose: it is small, portable, and useful in build and source-export pipelines.
unifdef is used by specifying macros with `-D`, `-U`, or a definitions file, then filtering input files so known conditional branches are removed while unknown conditionals are preserved. It can operate on stdin/stdout or modify files in place.
The manual also documents `unifdefall`, a script that uses `unifdef -s` and `cpp -dM` to derive macro information and remove all conditional directives from a file. This shows the tool's role as a controlled partial preprocessor rather than a full C preprocessor replacement.
unifdef is important in the package-nerd niche because it is both tiny and historically deep: a BSD-era tool still used for practical source filtering. It belongs in base-system and package-manager collections because build scripts and source-export tasks can depend on it without pulling in a large toolchain beyond normal C build support.
Its Linux-kernel header-export use case is exactly the kind of quiet infrastructure job package maintainers care about: remove implementation-only conditional sections, preserve line-oriented source structure, and keep generated user-facing source understandable.
安全态势
没有找到 unifdef 的匹配本地密钥处理 manifest。Nucleus 软件包元数据仍在此发布,以便未来覆盖拥有稳定的软件包 URL。
在无人值守的代理使用前,请检查该工具是否读取明文凭据、写入远程状态、发布制品或调用插件。
可执行文件
| 命令 | 类型 | 暴露范围 | 备注 |
|---|---|---|---|
unifdef | 可执行文件 | 已索引可执行文件 | 从本地可执行文件索引发现。 |
unifdefall | 可执行文件 | 已索引可执行文件 | 从本地可执行文件索引发现。 |
新鲜度
这些信号区分页生成时间、软件包管理器活动和上游发布比较。只有存在证据 URL 和可比较版本时,才会提示版本落后。
安装元数据
| 软件包键 | brew:unifdef |
|---|---|
| 版本 | 2.12 |
| 软件包管理器 | Homebrew |
| 主页 | https://dotat.at/prog/unifdef/ |
| 仓库 | https://github.com/fanf2/unifdef |
| Bottle | 未记录 |
| 服务 | 未声明 |
源数据库匹配
匹配项来自外部软件包管理器索引,并与本地 Automic Vault 软件包链接分开显示。
unifdef 2.12-1
Remove cpp '#ifdef' lines from files
sudo apt install unifdefunifdef
nix profile install nixpkgs#unifdefunifdef 2.12-1
Remove cpp '#ifdef' lines from files
sudo apt install unifdefunifdef 2.12-r4
Selectively remove C preprocessor conditionals
https://github.com/fanf2/unifdef
sudo apk add unifdefunifdef-doc 2.12-r4
Selectively remove C preprocessor conditionals (documentation)
https://github.com/fanf2/unifdef
sudo apk add unifdef-docunifdef 2.12-9.fc45
Selectively remove C preprocessor conditionals
https://dotat.at/prog/unifdef/
sudo dnf install unifdefunifdef 2.12-4
Remove #ifdef'ed lines
https://dotat.at/prog/unifdef/
sudo pacman -S unifdefunifdef 2.12-3.5
Removes ifdefs from C files
https://dotat.at/prog/unifdef/
sudo zypper install unifdefunifdef
sudo port install unifdef来源线索
此页面由 av-web 从 scripts/generate-pkg-sqlite.py 生成的私有软件包 SQLite 工件提供。
View the package source record on GitHub.