Sneaky patching source with Macports

和自甴很熟 提交于 2019-12-19 03:44:11

问题


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.

  1. Create a local portfile repository: howto
  2. Copy the vim portfile directory (a directory called "vim" containing the file "Portfile" and directory "files") into your local portfile repository
  3. Create a patch with your changes of the vim source code and add it to the "files" directory.
  4. Edit your local vim Portfile to include the line patchfiles yourpatch.diff
  5. Run portindex again in your local portfile repository
  6. Install vim with port install -s vim

I hope this can help.



来源:https://stackoverflow.com/questions/10690159/sneaky-patching-source-with-macports

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!