Definitions

Here are the detailed explanation for the definitions section of the LFS template:

SUMMARY Add a one line description of the package
VER Add the version number of the application
THISAPP Add a program name (replaces progname)
DL_FILE no changes are needed
DL_FROM no changes are needed
DIR_APP no changes are needed
TARGET no changes are needed
SUP_ARCH Supported architectures - supports building for multiple architectures 1.
Note: Remove this line if there are no parameters
PROG The same as THISAPP minus the version number.
Note: Remove this line for core packages
PAK_VER This number increases every time a new version of the addon is created or if something has changed within the install or config logic of the pak.
Note: Remove this line for core packages
DEPS A space-separated list of addon dependencies required to be installed for this package.
Note: Remove this line for core packages
SERVICES A space separated list of initscripts that are provided by this addon and which are actual services.
Note: One-shot initscripts, where no daemon is started, should be excluded from this list.
Note: Remove this line for core packages


Top-level Rules

objects no changes are needed
$(DL_FILE) no changes are needed
$(DL_FILE)_BLAKE2 blake2 checksum of the downloaded file.
Run: b2sum foo2zjs.tar.gz
install no changes are needed
check no changes are needed
download no changes are needed
b2 no changes are needed
dist $(PAK) no changes are needed


Downloading, checking, b2sum

No changes are needed


Installation Details

$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) You will need to adjust several lines:
  • adjust the archive unpacking line
  • you may have a different compression z/gz/bz2/. . .
  • and/or archiver tar/zip/7z/arc/...
  • add (if needed) the configuration line
  • adjust (if needed) the compile line (e.g., make all ...)
  • add any needed compilation steps
  • add any needed post-installation hooks
  • make sure initscripts are installed
    • Use the INSTALL_INITSCRIPTS function for this and simply pass the $(SERVICES) variable defined earlier to install all service initscripts in one go. You can add more initscripts (that are not services) by just adding them on that line.


Template

A generic LFS template is as follows:

###############################################################################
#                                                                             #
# IPFire.org - A linux based firewall                                         #
# Copyright (C) 2023  IPFire Team  <info@ipfire.org>                          #
#                                                                             #
# This program is free software: you can redistribute it and/or modify        #
# it under the terms of the GNU General Public License as published by        #
# the Free Software Foundation, either version 3 of the License, or           #
# (at your option) any later version.                                         #
#                                                                             #
# This program is distributed in the hope that it will be useful,             #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
# GNU General Public License for more details.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
#                                                                             #
###############################################################################

###############################################################################
# Definitions
###############################################################################

include Config

SUMMARY    = one-line description of addon

VER        = 1.0.0

THISAPP    = progname-$(VER)
DL_FILE    = $(THISAPP).tar.gz
DL_FROM    = $(URL_IPFIRE)
DIR_APP    = $(DIR_SRC)/$(THISAPP)
TARGET     = $(DIR_INFO)/$(THISAPP)
SUP_ARCH   = 

PROG       = progname
PAK_VER    = 1

DEPS       =

SERVICES   =

###############################################################################
# Top-level Rules
###############################################################################

objects = $(DL_FILE)

$(DL_FILE) = $(DL_FROM)/$(DL_FILE)

$(DL_FILE)_BLAKE2 = 0123456

install : $(TARGET)

check : $(patsubst %,$(DIR_CHK)/%,$(objects))

download :$(patsubst %,$(DIR_DL)/%,$(objects))

b2 : $(subst %,%_BLAKE2,$(objects))

dist:
    @$(PAK)

###############################################################################
# Downloading, checking, b2sum
###############################################################################

$(patsubst %,$(DIR_CHK)/%,$(objects)) :
    @$(CHECK)

$(patsubst %,$(DIR_DL)/%,$(objects)) :
    @$(LOAD)

$(subst %,%_BLAKE2,$(objects)) :
    @$(B2SUM)

###############################################################################
# Installation Details
###############################################################################

$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
    @$(PREBUILD)
    @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
    cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE)
    cd $(DIR_APP) && make install
    @rm -rf $(DIR_APP)
    @$(POSTBUILD)