Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for libmagic. #249

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open

Add support for libmagic. #249

wants to merge 47 commits into from

Conversation

0-8-15
Copy link
Contributor

@0-8-15 0-8-15 commented Jul 13, 2019

Not sure that this is the best implementation to use. I just needed
any.

TODO: Figure out how to rename the file upon package_download. The
basename "5.18.tar.gz" appears meaningless and may conflict.

0-8-15 and others added 16 commits July 29, 2018 15:34
This should be dealt with in a different way.  Simply recompiling each
time wasts too much developer time.  A better way needs to be figured out.
Not sure that this is the best implementation to use.  I just needed
any.

TODO: Figure out how to rename the file upon package_download.  The
basename "5.18.tar.gz" appears meaningless and may conflict.
Not sure that this is the best implementation to use.  I just needed
any.

TODO: Figure out how to rename the file upon package_download.  The
basename "5.18.tar.gz" appears meaningless and may conflict.
@0-8-15
Copy link
Contributor Author

0-8-15 commented Jul 13, 2019

It would be a good idea if the magic module would make sure the file installed under $SYS_PREFIX/etc/magic.mgc was embedded in the executable and found as the default for magic-load. I just did not yet understand how that would be done.

0-8-15 added 2 commits July 13, 2019 15:21
- avoid repeated check for xetex once it is found working
- tell _where_ a packages is compiled from to avoid confusion
package_make
cp src/file $SYS_HOSTPREFIX/bin || exit 1
package_cleanup
package_download $PKGURL $PKGHASH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it already be downloaded by this time (as in line 4)?

Copy link
Contributor Author

@0-8-15 0-8-15 Jul 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should. Reading package.sh again I now see that this package_download might be better replaced by a package_unpack. I just was not aware of the latter being available as a separate call.

@mgorges
Copy link
Contributor

mgorges commented Jul 15, 2019

Embedding of files can be done with the EMBED functionality, but I don't think this works for any path outside the app or module directory, as that is not what apps/packtool/main.scm does.


test -L $SYS_PREFIX/include/regex.h || ln -s pcreposix.h $SYS_PREFIX/include/regex.h

# Mabye instead of fooling the package, it should be patched
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure about this either. Why not include that library if you depend on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two reasons:

  1. At least I need pcre anyway and I see limited reasons to have two libraries implementing the same functionality.

  2. I'd guess there might be license compatibility issues when linking against a GPLed library and libgnurx is AFAIK.

cp src/magic.h $SYS_PREFIX/include
test -f src/file.exe && cp src/file.exe $SYS_PREFIX/bin
test -d $SYS_PREFIX/etc || mkdir $SYS_PREFIX/etc
cp magic/magic.mgc $SYS_PREFIX/etc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need this file embedded couldn't you compile it once and then include it in the module with an EMBED file? - Also does it need to be in the /etc folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. I don't really know where to put it. As you said: embedding might not be available from within the library directory. Hence we'll have to install it somewhere to be available for embedding later.

0-8-15 added 22 commits August 15, 2019 21:03
Overwriting should IMHO not cause any harm.  However doing so make it
much easier to use other libraries written for gambit as it and still
learn about exceptions.
So far I've been unable to get any useful results from quirc.  The
silent fail however is not nice when debugging.
Since Marshmallow permissions are not automatically granted as
specified in the Manifest.

As a consequence LN apps die when accessing the SDCard, e.g. when
unpacking embedded files.

This patch adds a fragile hack to enable an ifdef-alike trick to
exclude code portions when targeting older APIs and uses it to request
the permission at startup.  Plus create the system-directory if it
does not already exists.
On linux and wind32 the code does so far not know wheter or not the
clipboard has any content.

That's NOT changed by this patch.

However it's IMHO better to provide a false positive claiming
content (thus suggesting to the user to paste is even though that
would fail) than falsely claim nothing available thus preventing avail
content to be pasted.
This change allows to use things like
   (cond-expand
    (android ...code applicable on android targets only...)
    (linux ...code applicable on linux targets only...)
    (else ...code applicable on all other targets...))

NB:

1. According to SRFI-0 `cond-expand` is only mandatory on top level.
2. Most Scheme implementations (i.e., all I know of), including gambit
   allow the use of `cond-expand` everywhere.
3. With this change all uses of `app:android?` at runtime could
   eventually be replaced by compile time code expansion.
Not sure that this is the best implementation to use.  I just needed
any.

TODO: Figure out how to rename the file upon package_download.  The
basename "5.18.tar.gz" appears meaningless and may conflict.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants