Hi Hisham.

(That user was me by the way.)

A month ago, before I looked into using LuaRocks, I was writing my own
very minimalist in-app package manager. This is the relevant portion
of the Makefile I used for the modules I wrote:

    OBJCFILES = hotkey.m

    CFLAGS  += -Wall -Wextra
    CFLAGS  += -fobjc-arc
    LDFLAGS += -dynamiclib -undefined dynamic_lookup

    OFILES  := $(OBJCFILES:m=o)
    SOFILES := $(OBJCFILES:m=so)

    $(SOFILES): $(OFILES)
        $(CC) $(OFILES) $(CFLAGS) $(LDFLAGS) -o $@

That all boils down to this simple command:

    cc -Wall -Wextra -fobjc-arc -dynamiclib -undefined dynamic_lookup
hotkey.o -o hotkey.so

Note:

* The "-fobjc-arc" flag is all that's needed to enable ARC on the given file.

* The "-dynamiclib -undefined dynamic_lookup" flags were taken right
from the lua-users wiki, I'm pretty sure.

* The "-Wall -Wextra" flags are only there for my own sanity, they're
not strictly necessary at all.

This worked fine, and produced libraries that my app's users were able
to install and run without issue.

I don't know all the variables and settings and flags you use in
LuaRocks to compile modules on OS X. But just this should be
sufficient. What other flags do you set when compiling, and what is
the motivation for them? Is there a flag I can use when running
`luarocks make` to print out the commands it runs internally?

Why is the minimim-os-version exported as part of the CC variable?

Also, /usr/bin/cc defaults on OS X to the compiler Apple Developer
Tools provides. In fact, these days Apple is very good about setting
most things to sane/portable defaults when compiling. Makefiles I
write for my OS X apps are usually just a CFLAGS and/or LDFLAGS and a
single build-rule for my executable that makes use of built-in Make
rules. See this one for example:
https://github.com/sdegutis/hydra-cli/blob/master/Makefile

Also, personally I vote for posting a copy of that email in lua-l.

-Steven

On Thu, Sep 4, 2014 at 12:07 PM, Hisham <h...@hisham.hm> wrote:
> Once again, we have a user is having issues with MACOSX_DEPLOYMENT_TARGET:
>
> https://github.com/keplerproject/luarocks/pull/281
>
> Is anyone knowledgeable about the pros and cons of setting this
> variable and OSX+compiler+runtime version (in)compatibilities, and
> could point us in a direction that's the least headache-inducing as
> possible?
>
> (Perhaps I should post a version of this at lua-l to reach a wider audience?)
>
> Thanks!
>
> -- Hisham
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Luarocks-developers mailing list
> Luarocks-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/luarocks-developers

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to