Skip to content

Commit

Permalink
Install docs (#455)
Browse files Browse the repository at this point in the history
* Install docs

* Don't check failed when config file not exists
  • Loading branch information
Riey committed Apr 12, 2021
1 parent 6b3d8b7 commit ed3edcb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
5 changes: 3 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ llvmPackages_11.stdenv.mkDerivation {
nativeBuildInputs = deps.kimeNativeBuildInputs ++ [ rustPlatform.cargoSetupHook ];
version = kimeVersion;
cargoDeps = rustPlatform.fetchCargoTarball {
src = ./Cargo.lock;
sha256 = "1ykyd097pwz5xbqxlsq0845pg06g394g1jqwv7ipr6dpbh7r3xqa";
src = gis.gitIgnoreSource ./.;
sha256 = "0ian6jkay9a1pprxd09ky2sslgg7r5lrclfdzjzksakidfsqqil4";
};
LIBCLANG_PATH = "${pkgs.llvmPackages_11.libclang}/lib";
dontUseCmakeConfigure = true;
Expand All @@ -30,6 +30,7 @@ llvmPackages_11.stdenv.mkDerivation {
KIME_INCLUDE_DIR=include \
KIME_ICON_DIR=share/icons \
KIME_LIB_DIR=lib \
KIME_DOC_DIR=share/doc/kime \
KIME_QT5_DIR=lib/qt-${pkgs.qt5.qtbase.version} \
bash scripts/install.sh "$out"
'';
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
### Breaking

* Change config file layout
* Default config is no more installed just in the doc folder

### Improve

* Add `--kill` flag in kime daemon
* Install docs

## 2.4.0

Expand Down
4 changes: 4 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ cp $TARGET_DIR/kime $KIME_OUT || true

cp src/engine/cffi/kime_engine.h $KIME_OUT
cp src/engine/cffi/kime_engine.hpp $KIME_OUT
cp docs/CHANGELOG.md $KIME_OUT
cp LICENSE $KIME_OUT
cp NOTICE.md $KIME_OUT
cp README.md $KIME_OUT
cp README.ko.md $KIME_OUT
cp -R res/* $KIME_OUT

mkdir -pv build/cmake
Expand Down
25 changes: 20 additions & 5 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ if [ -z "$KIME_INSTALL_HEADER" ]; then
KIME_INSTALL_HEADER=0
fi

if [ -z "$KIME_INSTALL_DOC" ]; then
KIME_INSTALL_DOC=1
fi

PREFIX=$1

if [ -z "$KIME_BIN_DIR" ]; then
Expand All @@ -21,8 +25,8 @@ if [ -z "$KIME_INCLUDE_DIR" ]; then
KIME_INCLUDE_DIR=usr/include
fi

if [ -z "$KIME_CONFIG_DIR" ]; then
KIME_CONFIG_DIR=etc/xdg/kime
if [ -z "$KIME_DOC_DIR" ]; then
KIME_DOC_DIR=usr/share/doc/kime
fi

if [ -z "$KIME_ICON_DIR" ]; then
Expand Down Expand Up @@ -69,19 +73,30 @@ install_bin () {
install_if $1 755 -t "$KIME_BIN_DIR"
}

install_doc () {
install -Dm644 $KIME_OUT/$1 -t "$PREFIX/$KIME_DOC_DIR"
}

install_bin kime-check
install_bin kime-indicator
install_bin kime-xim
install_bin kime-wayland
install_bin kime

if [ $KIME_INSTALL_HEADER -eq "1" ]; then
if [ "${KIME_INSTALL_HEADER}" -eq "1" ]; then
install -Dm644 $KIME_OUT/kime_engine.h -t "$PREFIX/$KIME_INCLUDE_DIR"
install -Dm644 $KIME_OUT/kime_engine.hpp -t "$PREFIX/$KIME_INCLUDE_DIR"
fi

install -Dm644 $KIME_OUT/default_config.yaml -T "$PREFIX/$KIME_CONFIG_DIR/config.yaml"
install -Dm644 $KIME_OUT/default_daemon.yaml -T "$PREFIX/$KIME_CONFIG_DIR/daemon.yaml"
if [ "${KIME_INSTALL_DOC}" -eq "1" ]; then
install_doc default_config.yaml
install_doc LICENSE
install_doc NOTICE.md
install_doc README.md
install_doc README.ko.md
install_doc CHANGELOG.md
fi

install -Dm644 $KIME_OUT/*.desktop -t "$PREFIX/$KIME_AUTOSTART_DIR"
install -Dm644 $KIME_OUT/icons/64x64/*.png -t "$PREFIX/$KIME_ICON_DIR/hicolor/64x64/apps"
install -Dm755 $KIME_OUT/libkime_engine.so -t "$PREFIX/$KIME_LIB_DIR"
Expand Down
6 changes: 5 additions & 1 deletion src/tools/check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ impl Check {
let dirs = xdg::BaseDirectories::with_prefix("kime").expect("Load xdg dirs");
let config_path = match dirs.find_config_file("config.yaml") {
Some(path) => path,
_ => return CondResult::Fail("Can't find config.yaml".into()),
_ => {
return CondResult::Ignore(
"User config not exists will use default config".into(),
)
}
};

println!("Loading config path: {}", config_path.display());
Expand Down

0 comments on commit ed3edcb

Please sign in to comment.