[ZTE Axon 7 ROMs, Kernels, Recoveries, & Other Deve] tprfd:
Basically I just followed these instructions with a few little changes: https://wiki.lineageos.org/devices/axon7/build

I used Debian Stretch to build but it should be the same for Ubuntu or other Debian/dpkg based distros.

Start in your home directory.

Get the latest platform tools:

wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip

Unzip them:

unzip platform-tools-latest-linux.zip -d ~

Add adb and fastboot as well as ~/bin to your path by editing ~/.profile and adding these lines (~/bin may already be there):

# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

Update your env. by running

source ~/.profile

Install the required packages:

apt-get install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev openjdk-8-jdk

Create some directories:

mkdir -p ~/bin
mkdir -p ~/android/lineage

Install repo command

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Now to initialise the Lineage repo:

cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-15.1

Now sync the repo (this will take a looooooonng time so once you run this, go have a nap, each lunch or do something else). I am not sure of the bandwidth usage here but it may be a lot in case you have limits.

repo sync

Prepare Axon 7 specific code:

source build/envsetup.sh
breakfast axon7

Run the following command (you may want to also add it to ~./bashrc) to speed up subsequent builds. If you're only doing this once, maybe you can skip this step.

export USE_CCACHE=1

Run the following command (only needed once - subsequent builds will just use the same setting)

ccache -M 30G

Run the following command (again you may want to add this one to ~/.bashrc)

export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"

Here is where we need to do some additional work. The command 'breakfast axon7' will have downloaded some device specific configuration and specifically, a file called roomservice.xml which is used to specify specific repositories for the build scripts. Basically you need to change the roomservice.xml to point to Unjustified Devs device tree and vendor files instead of the 'official' ones. By default, the breakfast axon7 command will also NOT include vendor blobs in roomservice.xml so we need to tell the build scripts where they are.

Edit the file ~/android/lineage/.repo/ local_manifests/roomservice.xml to look like the following

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="C457/android_device_zte_axon7" path="device/zte/axon7" remote="github" revision="lineage-15.1" />
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="LineageOS/android_kernel_zte_msm8996" path="kernel/zte/msm8996" remote="github" />
<project name="LineageOS/android_packages_apps_FlipFlap" path="packages/apps/FlipFlap" remote="github" />
<project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" />
<project name="C457/proprietary_vendor_zte" path="vendor/zte" remote="github" revision="lineage-15.1" />
</manifest>

In the above file, the device tree and vendor blobs are linked to Unjustified Devs repo (C457). It may be wise to fork those in case he changes/deletes them. If you fork, just update where it says 'C457' to your own repo. The rest are stock lineage.

I haven't tried it but it may be possible to use Ordenkrieger's, king1990s or deegas (king1990's kernel with a patch for 50% battery bug) kernel by changing the reference to the kernel package to OrdenKrieger/android_kernel_zte_msm8996 or baddar90/android_kernel_zte_msm8996-1 or bubblegutz/android_kernel_zte_msm8996-1 instead of LineageOS/android_kernel_zte_msm8996. Again I have not tried these so I have no idea if they will work on 15.1.

Now re-sync to get the above changes. This will not take nearly as long as the first sync.

This command is the important part if you wish to continually build in the months to come. Just re-sync to grab the latest source from Lineage:

repo sync --force-sync

Now one more command to run to set up makefiles.

cd ~/android/lineage/device/zte/axon7
./setup-makefiles.sh

Now finally start the build:

croot
brunch axon7

When the build finally completes, the lineage-15.1-XXXXXXXX-UNOFFICIAL-axon7.zip file (X's will be the date), along with vendor.img, kernel build will be in the following directory: ~/android/lineage/out/target/product/axon7

cd ~/android/lineage/out/target/product/axon7

Flash the above zip in twrp (at your own risk of course).

If you want to rebuild again in April for the April patches, just cd to the lineage directory, run 'make clean' and then start from the command 'source build/envsetup.sh'