lua-users home
lua-l archive

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


On Mon, Mar 4, 2013 at 10:00 PM, Hisham <h@hisham.hm> wrote:
> On 4 March 2013 19:45, Rena <hyperhacker@gmail.com> wrote:
>>> I'll update it to embed the install path in the executable as well.
>
> You shouldn't need to. Just load the other scripts using require() and
> install them into /usr/local/share/lua/5.1/.
>
> What actually may require editing is the hash-bang line, as in some
> systems it's "#!/usr/bin/env lua" and others use variants such as
> "lua5.1" or "lua51" (or 5.2, if it's the case). Unfortunately there's
> no easy way around this, AFAIK.
>
>>> I like the idea of the actual "executable" being a symlink and putting
>>> all of the app's actual scripts in one directory.
>
> That's fine, but it complicates things a little more than necessary.
> For example, distro packagers often install to a temporary sandbox
> directory and then move files around when creating the package. If you
> use an absolute symlink it will require editing it.
>
>>> The one thing I don't like about this method is you can change
>>> INSTALLDIR on the command line, but not where the executable itself is
>>> placed. That's easy enough to fix, but I wonder what to call that
>>> variable... no doubt there's standards I'm not aware of for that, too.
>
> Here's a document I wrote a while ago collecting recommendations for
> Makefiles based on feedback from project authors when submitting
> packages to LuaRocks. Most of it deals with handling C code, but I
> guess some parts may still apply:
>
> http://luarocks.org/en/Recommended_practices_for_Makefiles
>
> (Suggestions, criticism and requests for clarifications are welcome.)
>
>> Whoops, I should have made sure the installed program actually worked
>> after running that script.
>> PROGRAM=imgview
>> INSTALLDIR=/usr/local/share/$(PROGRAM)
>> PWD=$(shell pwd)
>> .PHONY: all install uninstall
>>
>> all:
>>         @echo This program does not need to be compiled, just run \`make install\`.
>>
>> install:
>>         mkdir -p $(INSTALLDIR)
>>         ln -fs $(PWD)/$(PROGRAM).lua /usr/local/bin/$(PROGRAM)
>
> You're making a symbolic link that's hardcoded from the location of
> your sources to /usr/local/bin. When a user unpacks your tarball, runs
> make install and then delete the directory with the unpacked tarball,
> you'll end up with a broken symbolic link. (In general, you shouldn't
> depend on $PWD like that when installing.)
>
> Hope that helps,
>
> -- Hisham
> http://hisham.hm/
>

Yeah, I forgot to mention I'm just symlinking them all during
development. I'd change it to actually copying them for a release
version. Thanks for all the advice.

-- 
Sent from my Game Boy.