问题
For almost as long as I've been using vim and have known enough C, I've customised the installed vim to remove a 'feature' that annoys me. When I switched to using a Mac with macports, I achieved this by uninstalling any previous vim port, fetching the source, manually editing the source and then having Macports continue the installation, using my freshly customised source.
sh> sudo port uninstall vim
sh> sudo port fetch vim
sh> sudo /usr/bin/vim /opt/local/wherever/port/put/the/source/file.c
sh> sudo port install vim
Now[1] when I try this, the port install
command re-fetches the code from the server, completely ignoring my source edits, builds vim with the 'official' source and the annoying 'feature' is still there.
I have looked for checksums for the source, ways to edit the checksums and command line switches to ignore them but without luck.
I have tried port patch
rather than port install
before editing the code but that made no difference.
I have even found myself reading the port
source but my tcl is way too rusty to get far.
Any ideas about how to achieve this? Thank you.
[1] Macports 2.0.3. I do not know for which version this used to work.
回答1:
I would advise to create a local portfile for vim and add your changes as a patch that is applied during the build process.
- Create a local portfile repository: howto
- Copy the vim portfile directory (a directory called "vim" containing the file "Portfile" and directory "files") into your local portfile repository
- Create a patch with your changes of the vim source code and add it to the "files" directory.
- Edit your local vim Portfile to include the line
patchfiles yourpatch.diff
- Run
portindex
again in your local portfile repository - Install vim with
port install -s vim
I hope this can help.
来源:https://stackoverflow.com/questions/10690159/sneaky-patching-source-with-macports