Skip to content

Commit 023d0e7

Browse files
authored
Merge pull request #2 from outscale-mgo/master
appimage
2 parents 2a437d7 + 28f6147 commit 023d0e7

File tree

7 files changed

+65
-2
lines changed

7 files changed

+65
-2
lines changed

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11

2+
include config.mk
3+
4+
CFLAGS+="-std=c99"
5+
CFLAGS+=$(JSON_C_CFLAGS)
6+
LDFLAGS+=$(JSON_C_LDFLAGS)
7+
28
json-search: json-search.o
3-
$(CC) -ljson-c -std=c99 -Wall -Wextra json-search.o -o json-search
9+
$(CC) -ljson-c $(JSON_C_LDFLAGS) -std=c99 -Wall -Wextra json-search.o -o json-search
10+
11+
appimagetool-x86_64.AppImage:
12+
wget https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
13+
chmod +x appimagetool-x86_64.AppImage
14+
15+
json-search-x86_64.AppImage: json-search appimagetool-x86_64.AppImage
16+
mkdir -p json-search.AppDir/usr/
17+
mkdir -p json-search.AppDir/usr/bin/
18+
mkdir -p json-search.AppDir/usr/lib/
19+
cp json-search json-search.AppDir/usr/bin/
20+
./cp_json-c.sh
21+
./appimagetool-x86_64.AppImage json-search.AppDir
422

523
clean:
624
rm json-search.o

config.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
JSON_C_CFLAGS=-I/usr/include/json-c

configure

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
DIR=$PWD
4+
NO_RECOMPILE=1
5+
6+
echo "" > config.mk
7+
echo '#!/bin/bash' > ./cp_json-c.sh
8+
chmod +x ./cp_json-c.sh
9+
10+
for arg in $@; do
11+
echo $( echo "$arg" | cut -d '=' -f 1)
12+
if [ "--compile-json-c" = $arg ]; then
13+
git clone https://github.com/json-c/json-c.git
14+
mkdir json-c-build
15+
cd json-c-build
16+
cmake3 ../json-c/
17+
make
18+
cd -
19+
NO_RECOMPILE=0
20+
echo 'JSON_C_CFLAGS=-I./json-c -I./json-c-build' >> config.mk
21+
echo 'JSON_C_LDFLAGS="-L./json-c-build"' >> config.mk
22+
echo "cp json-c-build/libjson-c.so* json-search.AppDir/usr/lib/" >> ./cp_json-c.sh
23+
fi
24+
if [ "--help" = $arg ]; then
25+
echo "--compile-json-c: clone and compile json-c"
26+
fi
27+
done
28+
29+
if [ $NO_RECOMPILE -eq 1 ]; then
30+
echo JSON_C_CFLAGS=$(pkg-config --cflags json-c) >> config.mk
31+
echo "cp \$(ldd json-search | grep json | cut -d ' ' -f 3) json-search.AppDir/usr/lib/" >> ./cp_json-c.sh
32+
fi

json-search.AppDir/AppRun

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
LD_LIBRARY_PATH=${APPDIR}/usr/lib/ "${APPDIR}/usr/bin/json-search" "$@"
263 KB
Loading
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=json-search
4+
Exec=json-search
5+
Comment=grep into like, and format print
6+
Categories=Development;
7+
Terminal=true
8+
Icon=appimage-logo

json-search.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <stdio.h>
1919
#include <stdlib.h>
2020
#include <string.h>
21-
#include <json-c/json.h>
21+
#include "json.h"
2222

2323
#define panic(...) \
2424
do { \

0 commit comments

Comments
 (0)