Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5242f32
Added Scheme level binding for mdb_del.
0-8-15 Jul 29, 2018
a66dca9
Merge branch 'master' of github.com:part-cw/lambdanative
0-8-15 Aug 4, 2018
3271306
Merge branch 'master' of github.com:0-8-15/lambdanative
0-8-15 May 7, 2019
dde5b32
Update gambit to version 4.9.2
May 15, 2019
133e66b
Merge branch 'master' of ssh://github.com/part-cw/lambdanative
May 15, 2019
28170f6
update experimental libgamit
0-8-15 May 19, 2019
caa20a2
Merge branch 'master' of ssh://github.com/0-8-15/lambdanative
May 19, 2019
42754eb
Merge branch 'master' of ssh://github.com/part-cw/lambdanative
0-8-15 May 29, 2019
f802f9f
Do not treat syntax-case module special anymore.
0-8-15 May 21, 2019
cc258f0
Include unistd.h to silence warning wrt readlink on Linux.
0-8-15 Jun 4, 2019
5d8868a
Merge branch 'master' of ssh://github.com/part-cw/lambdanative into m…
0-8-15 Jul 11, 2019
500f290
Merge branch 'master' of ssh://github.com/part-cw/lambdanative into m…
0-8-15 Jul 11, 2019
b63b2a5
Add support for libmagic.
0-8-15 Jul 13, 2019
1aa159f
Merge branch 'add-libmagic' into master-updates
0-8-15 Jul 13, 2019
ea4b93b
Add support for libmagic.
0-8-15 Jul 13, 2019
4fa3909
Update openssl to 1.1.c
0-8-15 Jul 13, 2019
9131bda
Merge branch 'update-openssl' into master-updates
0-8-15 Jul 13, 2019
220cf6a
Minor improvements to build process.
0-8-15 Jul 13, 2019
093af12
exclude devcryptoeng for macosx
0-8-15 Jul 16, 2019
8c4f3c8
merged upstream changes
0-8-15 Jul 16, 2019
cde9100
Merge branch 'master-updates' of ssh://github.com/0-8-15/lambdanative…
0-8-15 Jul 16, 2019
fa61df7
Merge remote-tracking branch 'upstream/master' into master-updates
0-8-15 Jul 18, 2019
a933c5d
allow libiconv cross-compile for win32 on linux using mingw32
0-8-15 Aug 6, 2019
ae22ff0
Merge branch 'master' of ssh://github.com/part-cw/lambdanative into m…
0-8-15 Aug 8, 2019
6968521
Compare string in sh with '=' not '=='
0-8-15 Aug 15, 2019
e883722
Merge branch 'master' of https://github.com/part-cw/lambdanative into…
0-8-15 Aug 15, 2019
7871d11
Avoid building engines not available on wingw
0-8-15 Aug 15, 2019
554df3c
Overwrite make-thread with make-safe-thread
0-8-15 Aug 15, 2019
8845ccc
At least produce a debug log entry when quirc failes to decode.
0-8-15 Aug 15, 2019
86dcebc
merged upstream
0-8-15 Aug 16, 2019
9d3e141
Merge branch 'master' of ssh://github.com/part-cw/lambdanative into m…
0-8-15 Aug 19, 2019
79398d7
Handle compilation and permissions for ANDROIDAPI>22.
0-8-15 Aug 29, 2019
6a2bcdc
Do not break syntax highlighting by `ifdef` alike trick.
0-8-15 Aug 29, 2019
78a1cd1
Merge branch 'master' of ssh://github.com/part-cw/lambdanative into m…
0-8-15 Sep 2, 2019
8dd4432
Name mutex's to ease debugging.
0-8-15 Sep 4, 2019
e4a9372
Err on usability wrt. clipboard content.
0-8-15 Sep 5, 2019
b936245
Enable use of cond-expand depending on SYS_PLATFORM.
0-8-15 Sep 6, 2019
2e8d26b
LN_STORE: Name mutex with the symbol they are bound to. (#262)
0-8-15 Sep 7, 2019
7e63385
Disable vpx on win32 since it did not build with it.
0-8-15 Sep 22, 2019
c4dddb9
Changes to windows build.
0-8-15 Sep 22, 2019
3366268
add patch for win32
0-8-15 Sep 22, 2019
9189dfa
was the EMBED file forgotton?
0-8-15 Sep 22, 2019
e460673
Add support for libmagic.
0-8-15 Sep 22, 2019
bfcdab2
libpcre: enable compile with clang
0-8-15 Sep 22, 2019
f8f278c
Use embedded magic.mgc by default
0-8-15 Sep 22, 2019
dccce2d
Load embedded magic.mgc if called with #t
0-8-15 Sep 26, 2019
b1230e2
Merge branch 'libmagic' into add-libmagic
0-8-15 Sep 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libraries/libmagic/LIB_DEPENDS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libpcre
76 changes: 76 additions & 0 deletions libraries/libmagic/make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
PKGURL=https://github.com/threatstack/libmagic/archive/5.18.tar.gz
PKGHASH=ce734a1cc24bddbfd8b21f4ffdfe721ab74eeed9

package_download $PKGURL $PKGHASH
package_patch

EXTRACONF=

if [ "$SYS_PLATFORM" != "$SYS_HOSTPLATFORM" ]; then
EXTRACONF="$EXTRACONF --host=$SYS_ARCH"
fi

# pretend libgnurx exists by masking libpcre

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.

rmifexists $SYS_PREFIX/lib/libgnurx.a
rmifexists $SYS_PREFIX/lib/libgnurx
mkdir $SYS_PREFIX/lib/libgnurx
( cd $SYS_PREFIX/lib/libgnurx
mkdir a
cd a
$SYS_AR -x ../../libpcre.a
cd ..
mkdir b
cd b
$SYS_AR -x ../../libpcreposix.a
cd ..
$SYS_AR rc ../libgnurx.a a/*.o b/*.o
)

rm -r $SYS_PREFIX/lib/libgnurx

if [ `file --version|head -1` != file-5.18 ]; then
if [ ! -f $SYS_HOSTPREFIX/bin/file ]; then
./configure --enable-static --disable-shared 'CFLAGS=-fPIC -O3 -DPCRE_STATIC'
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.

package_patch
fi
FILE_COMPILE=$SYS_HOSTPREFIX/bin/file
fi

# configure

if [ "$SYS_PLATFORM" != "$SYS_HOSTPLATFORM" -a "X$FILE_COMPILE" != "X" ]; then
echo patching magic/Makefile.in to use $FILE_COMPILE
sed -i -es%'@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file${EXEEXT}'%"@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = ${FILE_COMPILE}"% magic/Makefile.in
fi

package_configure --enable-static --disable-shared $EXTRACONF "'CFLAGS=-fPIC -O3 -DPCRE_STATIC'"


# build

package_make

# install

cp src/.libs/libmagic.a $SYS_PREFIX/lib
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.


# Cleanup the fooling
rm -f $SYS_PREFIX/lib/libgnurx.a $SYS_PREFIX/include/regex.h

package_cleanup

unset EXTRACONF

#eof
31 changes: 31 additions & 0 deletions libraries/libpcre/make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PKGURL=https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
PKGHASH=8f36ed69d3e938972fc511c19bfaa0ff27ff1d71

package_download $PKGURL $PKGHASH

package_patch

EXTRACONF="--enable-utf --enable-jit "

if [ "$SYS_PLATFORM" != "$SYS_HOSTPLATFORM" ]; then
EXTRACONF="$EXTRACONF --host=$SYS_ARCH"
fi

# configure

package_configure $EXTRACONF

# build

NOQUIET=yes package_make

# install

cp .libs/libpcre.a .libs/libpcreposix.a $SYS_PREFIX/lib || exit 1
cp pcre.h pcreposix.h pcrecpparg.h pcre_scanner.h pcre_stringpiece.h $SYS_PREFIX/include || exit 1

package_cleanup

unset EXTRACONF

#eof
1 change: 1 addition & 0 deletions modules/magic/LIBRARIES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libmagic
91 changes: 91 additions & 0 deletions modules/magic/magic.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#|
LambdaNative - a cross-platform Scheme framework
Copyright (c) 2009-2014, University of British Columbia
Copyright (c) 2019 by Joerg F. Wittenberger
All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.

* Neither the name of the University of British Columbia nor
the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

|#

;; minimal bindings to libmagic

(c-declare #<<EOF
#include <magic.h>
EOF
)

(define-macro (define-c-constant name type value)
`(define ,name ((c-lambda () ,type ,(string-append "___result = " value ";")))))

(define-c-constant MAGIC_NONE int "MAGIC_NONE")
(define-c-constant MAGIC_DEBUG int "MAGIC_DEBUG")
(define-c-constant MAGIC_SYMLINK int "MAGIC_SYMLINK")
(define-c-constant MAGIC_COMPRESS int "MAGIC_COMPRESS")
(define-c-constant MAGIC_DEVICES int "MAGIC_DEVICES")
(define-c-constant MAGIC_MIME int "MAGIC_MIME")
(define-c-constant MAGIC_CONTINUE int "MAGIC_CONTINUE")
(define-c-constant MAGIC_CHECK int "MAGIC_CHECK")
(define-c-constant MAGIC_PRESERVE_ATIME int "MAGIC_PRESERVE_ATIME")
(define-c-constant MAGIC_RAW int "MAGIC_RAW")
(define-c-constant MAGIC_ERROR int "MAGIC_ERROR")

(define magic-open
(c-lambda (int) (pointer void) "magic_open"))

(define magic-load
(c-lambda ((pointer void) char-string) int "magic_load"))

(define magic-error
(c-lambda ((pointer void)) char-string "magic_error"))

(define magic-file
(c-lambda ((pointer void) char-string) char-string "magic_file"))

(define (magic-buffer ptr u8data)
((c-lambda
((pointer void) scheme-object int)
char-string
"___result = (char*)magic_buffer(___arg1, ___BODY_AS(___arg2,___tSUBTYPED), ___arg3);")
ptr u8data (u8vector-length u8data)))

(define magic-close
(c-lambda ((pointer void)) void "magic_close"))

(define magic-setflags
(c-lambda ((pointer void) int) int "magic_setflags"))

(define magic-errno
(c-lambda ((pointer void)) int "magic_errno"))

;; eof