Skip to content

Commit

Permalink
AppImage initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Jun 7, 2022
1 parent 1463145 commit ecda07a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ all: cognac-completion.bash cognac
cognac: main.c osc_sdk.h osc_sdk.c
gcc -Wall -Wextra main.c osc_sdk.c $(CURL_LD) $(JSON_C_LDFLAGS) $(CURL_CFLAGS) $(JSON_C_CFLAGS) -o cognac

appimagetool-x86_64.AppImage:
wget https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage

cognac-x86_64.AppImage: cognac cognac-completion.bash appimagetool-x86_64.AppImage
mkdir -p cognac.AppDir/usr/
mkdir -p cognac.AppDir/usr/bin/
mkdir -p cognac.AppDir/usr/lib/
cp cognac cognac.AppDir/usr/bin/
cp cognac-completion.bash cognac.AppDir/usr/bin/
LD_LIBRARY_PATH="$(LD_LIB_PATH)" ./cp-lib.sh cognac ./cognac.AppDir/usr/lib/
./appimagetool-x86_64.AppImage cognac.AppDir

main.c: osc-api.json call_list arguments-list.json config.sh
./cognac_gen.sh main_tpl.c main.c c

Expand Down
5 changes: 4 additions & 1 deletion cognac-completion-tpl.bash
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ _cognac()
}

complete -F _cognac cognac
# this one is for debug
complete -F _cognac cognac-x86_64.AppImage

# thoses one are for debug
complete -F _cognac ./cognac
complete -F _cognac ./cognac-x86_64.AppImage
11 changes: 11 additions & 0 deletions cognac.AppDir/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

for opt in "$@"
do
if [ "${opt}" == "--bash-completion" ]; then
cat "${APPDIR}/usr/bin/cognac-completion.bash"
exit 0
fi
done

LD_LIBRARY_PATH=${APPDIR}/usr/lib/ "${APPDIR}/usr/bin/cognac" "$@"
Binary file added cognac.AppDir/appimage-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions cognac.AppDir/cognac.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=cognac
Exec=cognac
Comment=CLI-of Outscale Granting Net Accessible Calls
Categories=Development;Network;
Terminal=true
Icon=appimage-logo
6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ SED_ALIAS=''
JSON_C_CFLAGS='-I/usr/include/json-c/'
JSON_C_LDFLAGS='-ljson-c'
HAVE_RECOMPILE_JSON_C=0
LD_CURLLIB_PATH=''
LD_JSONCLIB_PATH=''

for arg in $@; do
if [ "--help" = $arg ]; then
Expand Down Expand Up @@ -44,17 +46,20 @@ EOF
cd -
JSON_C_CFLAGS='-I./json-c -I./json-c-build'
JSON_C_LDFLAGS='-L./json-c-build -ljson-c'
LD_JSONCLIB_PATH="./json-c-build"
HAVE_RECOMPILE_JSON_C=1
elif [ "--yq-go" = $arg ]; then
YQ_ARG="-o json"
elif [ "--gnu-sed-alias" = $arg ]; then
SED_ALIAS="'alias sed=gsed'"
elif [ "--curl-path" = $( echo "$arg" | cut -d '=' -f 1) ]; then
CURL_PATH=$( echo $arg | cut -f 2 -d '=' )
LD_CURLLIB_PATH="$CURL_PATH/lib/.libs/"
CURL_LD="-lcurl -L$CURL_PATH/lib/.libs/"
CURL_CFLAGS="-I$CURL_PATH/include/"
elif [ "--curl-install-path" = $( echo "$arg" | cut -d '=' -f 1) ]; then
CURL_PATH=$( echo $arg | cut -f 2 -d '=' )
LD_CURLLIB_PATH="$CURL_PATH/lib/"
CURL_LD="-lcurl -L$CURL_PATH/lib/"
CURL_CFLAGS="-I$CURL_PATH/include/"
fi
Expand All @@ -74,6 +79,7 @@ if [ $HAVE_RECOMPILE_JSON_C == 0 ]; then
fi

echo JSON_SEARCH=$JSON_SEARCH > config.mk
echo LD_LIB_PATH="$LD_CURLLIB_PATH:$LD_JSONCLIB_PATH" >> config.mk
echo YQ_ARG=$YQ_ARG >> config.mk
echo CURL_LD=$CURL_LD >> config.mk
echo CURL_CFLAGS=$CURL_CFLAGS >> config.mk
Expand Down
3 changes: 3 additions & 0 deletions cp-lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

cp -v $(ldd $1 | grep '=>' | cut -d ' ' -f 3 | grep -v -e libm -e libc.so* -e libdl -e ld-linux-x86-64 -e libpthread -e librt) $2

0 comments on commit ecda07a

Please sign in to comment.