Skip to content

Instantly share code, notes, and snippets.

@jannson
Created July 28, 2023 09:40
Show Gist options
  • Save jannson/d0bc34ce9319c0c217343fccb820e720 to your computer and use it in GitHub Desktop.
Save jannson/d0bc34ce9319c0c217343fccb820e720 to your computer and use it in GitHub Desktop.
Themis makefile for openwrt
include $(TOPDIR)/rules.mk
# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=themis
PKG_VERSION:=1.0
PKG_RELEASE:=1
# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
SOURCE_DIR:=xxx/themis
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/themis
SECTION:=xiaoyao
CATEGORY:=Xiaoyao
TITLE:=Themis
DEPENDS+=+libopenssl
endef
# Package description; a more verbose description on what our package does
define Package/themis/description
Themis library
endef
# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp -rf $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef
# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/themis/install
$(CP) $(PKG_INSTALL_DIR)/libsoter.so* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/libthemis.so* $(1)/usr/lib/
endef
# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,themis))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment