├── .gitignore ├── examples ├── epdfview.example ├── kqemu.example ├── qemu.example ├── vim.example ├── qt.example └── mplayer.example ├── README.md ├── customizepkg └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | PKGBUILD* 2 | *~ 3 | -------------------------------------------------------------------------------- /examples/epdfview.example: -------------------------------------------------------------------------------- 1 | # This is an example of config file for customizepkg 2 | # Copy this file in /etc/customizepkg.d/epdfview to use it 3 | # 4 | # syntax works like this: 5 | #ACTION CONTEXT PATTERN VALUE 6 | # 7 | #Action can be: remove, add or replace 8 | #Context can be: depends, conflicts, makedepends etc.. or global for matching regexp in the all PKGBUILD 9 | #Pattern can be any rexgexp 10 | #Value (optionnal) can be any string 11 | # 12 | remove#depends#libcups 13 | 14 | -------------------------------------------------------------------------------- /examples/kqemu.example: -------------------------------------------------------------------------------- 1 | # This is an example of config file for customizepkg 2 | # Copy this file in /etc/customizepkg.d/kqemu to use it 3 | # 4 | # syntax works like this: 5 | #ACTION CONTEXT PATTERN VALUE 6 | # 7 | #Action can be: remove, add or replace 8 | #Context can be: depends, conflicts, makedepends etc.. or global for matching regexp in the all PKGBUILD 9 | #Pattern can be any rexgexp 10 | #Value (optionnal) can be any string 11 | # 12 | replace#global#_kernver=.*#_kernver=`uname -r` 13 | -------------------------------------------------------------------------------- /examples/qemu.example: -------------------------------------------------------------------------------- 1 | # This is an example of config file for customizepkg 2 | # Copy this file in /etc/customizepkg.d/qemu to use it 3 | # 4 | # syntax works like this: 5 | #ACTION CONTEXT PATTERN VALUE 6 | # 7 | #Action can be: remove, add or replace 8 | #Context can be: depends, conflicts, makedepends etc.. or global for matching regexp in the all PKGBUILD 9 | #Pattern can be any rexgexp 10 | #Value (optionnal) can be any string 11 | # 12 | 13 | replace#global#.\\/configure#.\\/configure --enable-kqemu 14 | 15 | -------------------------------------------------------------------------------- /examples/vim.example: -------------------------------------------------------------------------------- 1 | # This is an example of config file for customizepkg 2 | # Copy this file in /etc/customizepkg.d/vim to use it 3 | # 4 | # syntax works like this: 5 | #ACTION CONTEXT PATTERN VALUE 6 | # 7 | #Action can be: remove, add or replace 8 | #Context can be: depends, conflicts, makedepends etc.. or global for matching regexp in the all PKGBUILD 9 | #Pattern can be any rexgexp 10 | #Value (optionnal) can be any string 11 | # 12 | 13 | replace#global#--with-x=no --disable-gui#--with-x=yes --enable-gui=gtk2 14 | add#conflicts#gvim 15 | add#replaces#gvim 16 | add#provides#gvim 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/qt.example: -------------------------------------------------------------------------------- 1 | # This is an example of config file for customizepkg 2 | # Copy this file in /etc/customizepkg.d/qt to use it 3 | # 4 | # syntax works like this: 5 | #ACTION CONTEXT PATTERN VALUE 6 | # 7 | #Action can be: remove, add or replace 8 | #Context can be: depends, conflicts, makedepends etc.. or global for matching regexp in the all PKGBUILD 9 | #Pattern can be any rexgexp 10 | #Value (optionnal) can be any string 11 | # 12 | 13 | 14 | #ACTION CONTEXT PATTERN VALUE 15 | remove#makedepends#mysql 16 | remove#makedepends#postgresql 17 | remove#makedepends#sqlite3 18 | remove#makedepends#unixodbc 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/mplayer.example: -------------------------------------------------------------------------------- 1 | # This is an example of config file for customizepkg 2 | # Copy this file in /etc/customizepkg.d/mplayer to use it 3 | # 4 | # syntax works like this: 5 | #ACTION CONTEXT PATTERN VALUE 6 | # 7 | #Action can be: remove, add or replace 8 | #Context can be: depends, conflicts, makedepends etc.. or global for matching regexp in the all PKGBUILD 9 | #Pattern can be any rexgexp 10 | #Value (optionnal) can be any string 11 | # 12 | remove#depends#smbclient 13 | remove#depends#dbus-glib 14 | remove#depends#jack-audio-connection-kit 15 | remove#depends#aalib 16 | remove#makedepends#lirc-utils 17 | remove#makedepends#libcaca 18 | add#conflicts#mplayer-svn 19 | remove#global#--enable-tv-v4l[0-9] 20 | remove#global#--enable-runtime-cpudetection 21 | replace#global#--enable-smb#--disable-smb 22 | replace#global#--enable-lirc#--disable-lirc 23 | replace#global#--enable-aa#--disable-aa 24 | replace#global#--language=all#--language=fr 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | customizepkg 2 | ============ 3 | 4 | A tool for Arch Linux package manager pacman to modify PKGBUILD automatically. 5 | 6 | # Usage: # 7 | 8 | Without any parameters, it will read ./PKGBUILD and show any modifications that would be done. 9 | Create config files with the same name as the package you want to modify, and place in either: 10 | `/etc/customizepkg.d/` or `~/.customizepkg/`. You can export the environment 11 | variable `$CUSTOMIZEPKG_CONFIG` to change the directory customizepkg will look 12 | for the config files in. 13 | 14 | customizepkg will also use the xdg-standardized directories to look for config files. 15 | This means that you can also put your config files in `~/.config/customizepkg` or `/etc/xdg/customizepkg` or configure 16 | those directories with `$XDG_CONFIG_HOME` or `$XDG_CONFIG_DIRS` 17 | 18 | The pacman wrapper "Yaourt" integrates with customizepkg by default 19 | 20 | # Configuration file Syntax: # 21 | 22 | ``` 23 | ACTION#CONTEXT#PATTERN#VALUE 24 | ``` 25 | 26 | - Action can be: remove, removeline, add, addline or replace 27 | - Context can be: depends, conflicts, makedepends etc.. or global for matching regexp in the whole PKGBUILD 28 | - Pattern can be any rexgexp 29 | - Value (only needed for replace) can be any string 30 | - Comments can be added by starting the line with `#` 31 | 32 | # Additional Files # 33 | 34 | You can add extra files to a PKGBUILD by placing them in `/etc/customizepkg.d/$PACKAGENAME.files/` 35 | They will be added automatically, including checksums 36 | 37 | # Run a script # 38 | 39 | If the configuration file has the executable flag set, it will be executed instead of parsed. 40 | Two parameters are passed to the script: 41 | 42 | - $1 is the original PKGBUILD 43 | - $2 is the custom PKGBUILD 44 | 45 | # Patch the source # 46 | 47 | Patch files can be applied to the source code using the following syntax: 48 | 49 | ``` 50 | patch#1#file.patch 51 | ``` 52 | 53 | - The context ("1" above) is the number of leading components to strip (i.e. `patch -p1`) 54 | - The path cannot contain variables 55 | - The patch file can be stored in the additional files directory, $PACKAGENAME.files 56 | 57 | You can also patch the PKGBUILD with the following syntax: 58 | 59 | ``` 60 | patch#pkgbuild#file.patch 61 | ``` 62 | -------------------------------------------------------------------------------- /customizepkg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # customizepkg => modify PKGBUILD before building 4 | # 5 | # This program is distributed in the hope that it will be useful, 6 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 7 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8 | # GNU General Public License for more details. 9 | # 10 | # You should have received a copy of the GNU General Public License 11 | # along with this program; if not, write to the Free Software 12 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 13 | # 14 | # 15 | # TODO: 16 | # PKGBUILD + file.install 17 | # 18 | 19 | NAME=$(basename $0) 20 | GLOBALCONFIGDIR="/etc/${NAME}.d" 21 | LOCALCONFIGDIR=${CUSTOMIZEPKG_CONFIG:-"${HOME}/.${NAME}"} 22 | XDGDIR=${XDG_CONFIG_HOME:-"${HOME}/.config"}"/"${NAME} 23 | XDGGLOBALDIRS=${XDG_CONFIG_DIRS:-"/etc/xdg"} 24 | 25 | # use colordiff if it's available 26 | [[ $(type -p colordiff) ]] && DIFFCMD="colordiff -ub" || DIFFCMD="diff -ub" 27 | 28 | usage() { 29 | echo -e "A tool for Arch Linux to modify PKGBUILDs automatically.\n\n" \ 30 | "usage: ${NAME}