Skip to content

Instantly share code, notes, and snippets.

@axxx007xxxz
Last active April 5, 2024 17:20
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save axxx007xxxz/60fea50f4b123e0163f972d1709068c2 to your computer and use it in GitHub Desktop.
Save axxx007xxxz/60fea50f4b123e0163f972d1709068c2 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $UID != "0" ]; then
echo "ERROR: You must run this script as root!"
exit 1
fi
dnf install \
@development-tools \
android-tools \
automake \
bison \
bzip2 \
bzip2-libs \
ccache \
curl \
dpkg-dev \
gcc \
gcc-c++ \
gperf \
libstdc++.i686 \
libxml2-devel \
lz4-libs \
lzop \
make \
maven \
ncurses-compat-libs \
openssl-devel \
pngcrush \
python \
python3 \
python3-mako \
python-mako \
python-networkx \
schedtool \
squashfs-tools \
syslinux-devel \
zip \
zlib-devel \
zlib-devel.i686
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo && chmod +x /usr/bin/repo
@danpawlik
Copy link

I suggest to add ImageMagick-devel.x86_64 ImageMagick-c++-devel.x86_64

@axxx007xxxz
Copy link
Author

axxx007xxxz commented Dec 28, 2017

@dduuch: Thanks for the tip!
ImageMagick isn't strictly necessary for building, so I prefer not to add it; I may also remove 'optipng' and 'pngcrush'.

@leleobhz
Copy link

For F30:

python3-networkx.noarch : Creates and Manipulates Graphs and Networks

@axxx007xxxz
Copy link
Author

I removed Java as it comes prebuilt with Android 10 source.
GCC can also be removed for the same reason but I'm keeping it for now.

@tdrkDev
Copy link

tdrkDev commented Jun 21, 2020

Suggest to add ability to chose download Java or not, some people like me are building old Android versions, where Java wasn't prebuilt.

Add this to the top of the script (after root check) (first variant):

echo "Install Java 8 for Android versions lower than Q? (y/N)"
echo -n "$0> "
read installJava
case "$installJava" in
y|Y) echo "Java 8 will be installed."
installJava="\
	java-1.8.0-openjdk"
;;
*) installJava=""
;;
esac

Add this to the top of the script (after root check) (second variant):

if [ -z "$1" ]; then
	echo "If you need Java to be installed (for lower than Android Q verisons), you can execute $0 with -java argument."
	installJava=""
elif [ "$1" = "-java" ]; then
	installJava="\
	java-1.8.0-openjdk"
	echo "Java 8 will be installed."
fi

Add this to the end of packages to install:
$installJava

Full dnf command will be:

dnf install \
	@development-tools \
	android-tools \
	automake \
	bison \
	bzip2 \
	bzip2-libs \
	ccache \
	curl \
	dpkg-dev \
	gcc \
	gcc-c++ \
	gperf \
	libstdc++.i686 \
	libxml2-devel \
	lz4-libs \
	lzop \
	make \
	maven \
	ncurses-compat-libs \
	openssl-devel \
	pngcrush \
	python \
	python3 \
	python3-mako \
	python-mako \
	python-networkx \
	schedtool \
	squashfs-tools \
	syslinux-devel \
	zip \
	zlib-devel \
	zlib-devel.i686 $installJava

@chardinson
Copy link

chardinson commented Sep 14, 2023

The compilation stopped because the "openssl" command was not found, I had already installed openssl-devel and it didn't work, so I had to install openssl was the solution.

I also think you need to add the "git-lfs" package as mentioned in the Lineage guide: https://wiki.lineageos.org/devices/merlinx/build#install-the-build-packages and https://wiki.lineageos.org/devices/merlinx/build#configure-git

openssl
git-lfs
libxcrypt-compat

@SirRGB
Copy link

SirRGB commented Apr 3, 2024

https://divestos.org/pages/build#deps

Divest OS has a comprehensive guide for the setup, even works for A7. You can ignore the firejail setup though, at least I did.
If you dont go that old (aka A9/up) you can ignore
sudo ln -sf /usr/share/crypto-policies/LEGACY/java.txt /etc/crypto-policies/back-ends/java.config;
and
openjdk-8-jdk

For A8/below you also need to dig into update-alternatives (or just alternatives) and set up python2 -> python and java symlinks
https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives

For A10 I had to manually apply this fix
https://www.reddit.com/r/LineageOS/comments/18lej4b/if_your_build_is_failing_with_an_error_regarding

aka remove metadata_csum_seed and orhpan_file from /etc/mke2fs.conf

I did run into issues since qpr2 since symbol_inject is now source built
https://android-review.googlesource.com/c/platform/prebuilts/build-tools/+/2671917/2/linux-x86/bin/symbol_inject

FAILED: out/soong/.intermediates/frameworks/base/tools/aapt2/aapt2/linux_glibc_x86_64/e560d7b19ebf7276b3e850d3d346dec8/aapt2
out/host/linux-x86/bin/symbol_inject -i out/soong/.intermediates/frameworks/base/tools/aapt2/aapt2/linux_glibc_x86_64/e560d7b19ebf7276b3e850d3d346dec8/unversioned/aapt2 -o out/soong/.intermediates/frameworks/base/tools/aapt2/aapt2/linux_glibc_x86_64/e560d7b19ebf7276b3e850d3d346dec8/aapt2 -s soong_build_number -from 'SOONG BUILD NUMBER PLACEHOLDER' -v $(cat out/soong/build_number.txt)
flag needs an argument: -v
Usage of out/host/linux-x86/bin/symbol_inject:
  -dump
    	dump the symbol table for copying into a test
  -from string
    	optional existing value of the symbol for verification
  -i string
    	input file
  -o string
    	output file
  -s string
    	symbol to inject into
  -v string
    	value to inject into symbol

Id be happy to know that Im not the only one having this issue on fedora 39 when trying to build lineage os 21/crdroid 10.3, so lmk if anyone of yall can replicate it.

@SirRGB
Copy link

SirRGB commented Apr 5, 2024

I wasnt able to reproduce the error after a re-setup of fedora 39 on another PC without the legacy setup.
Needed to install libxcrypt-compat for a successful build tho.

https://support.gurobi.com/hc/en-us/articles/17316546307217-Error-while-loading-shared-libraries-libcrypt-so-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment