lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Tue, Jan 12, 2016 at 7:13 PM, Ross Berteig <> wrote:
> On 1/12/2016 12:59 AM, Jonathan Goble wrote:
>> ....
>> Creating and applying patches is something I have no clue how to do on
>> Windows. I do have an Ubuntu machine on which I could figure it out,
>> but it mostly just acts as a server for bot scripts to run on. My
>> Windows 10 computer with Visual Studio 2015 Community Edition is what
>> I do my code development on.
> A patch is primarily the output of one of many versions of the diff(1)
> command. If you already use Git, you will almost certainly have a flavor of
> diff that will do the job as part of Git.
> Outside of Git, diff(1) and patch(1) have reasonable Windows ports that work
> just fine at the Windows command prompt (i.e., not requiring the heavy
> burden of a fake Unix emulation layer like Cygwin). One source is the stale
> but still workable GnuWin32 project.
> diff:
> patch:
> If you go down that path, you might want to pick up Gnu Make and any other
> classic Unix tools like grep. See the full list of packages they've ported
> here:
>> How would I go about creating and applying patches in Windows? If I
>> can figure that out, then I'll work on the rock later this week. The
>> script to extract the code is something I can figure out on my own.
> The usual recipe to create a patch is to compare source folders with "diff
> -uNr path/to/old path/to/new >patch.txt". The -u option formats the
> differences as a "unified" diff which provides context for each change in a
> way that allows patch to be confident that it is making valid changes. The
> -N option treats a missing file as "empty", so that a new file will get
> included in a patch verbatim. The -r option recurses down the directory
> tree.
> You will want to review the patch file itself to make sure it doesn't
> contain any surprises before you publish it.
> The patch utility will consume a source tree and a patch file and make all
> the edits. It works startlingly well.

Thank you for that help! And thanks to Nagaev and Tom for their input
this evening as well.

I checked, and GNU's diffutils and patch are included in my copy of
Git for Windows and available through Git Bash, so those will work
here. I know documentation will be available online, so I'll figure it
out from there. I'll also look into embedding the patch into the
rockspec as suggested by Nagaev and automating as much as possible by

My last question for now is, how do I go about setting up my code for
compilation on Unix? I have absolutely zero experience with compiling
my own C code on Unix, and Makefiles are a completely foreign language
to me. The "builtin" back-end provided by LuaRocks looks like it might
work, but how do I test the code in the first place?