Skip to content

Commit

Permalink
fix(CDEPS/tor): allow compiling under ArchLinux
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Feb 8, 2024
1 parent 2e43eea commit c28f409
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CDEPS/tor/004.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/configure.ac b/configure.ac
index b218a59ce2..b87adec9fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1294,10 +1294,10 @@ tor_cap_pkg_redhat="libcap"
tor_cap_devpkg_debian="libcap-dev"
tor_cap_devpkg_redhat="libcap-devel"

-AC_CHECK_LIB([cap], [cap_init], [],
- AC_MSG_NOTICE([Libcap was not found. Capabilities will not be usable.])
-)
-AC_CHECK_FUNCS(cap_set_proc)
+dnl AC_CHECK_LIB([cap], [cap_init], [],
+dnl AC_MSG_NOTICE([Libcap was not found. Capabilities will not be usable.])
+dnl )
+dnl AC_CHECK_FUNCS(cap_set_proc)

dnl ---------------------------------------------------------------------
dnl Now that we know about our major libraries, we can check for compiler
48 changes: 48 additions & 0 deletions internal/cmd/buildtool/android_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,16 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"AS=" + fakeBinPath + "/armv7a-linux-androideabi21-clang",
Expand Down Expand Up @@ -1794,6 +1804,8 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1842,6 +1854,16 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"AS=" + fakeBinPath + "/aarch64-linux-android21-clang",
Expand Down Expand Up @@ -1871,6 +1893,8 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1919,6 +1943,16 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"AS=" + fakeBinPath + "/i686-linux-android21-clang",
Expand Down Expand Up @@ -1948,6 +1982,8 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1996,6 +2032,16 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"AS=" + fakeBinPath + "/x86_64-linux-android21-clang",
Expand Down Expand Up @@ -2025,6 +2071,8 @@ func TestAndroidBuildCdepsTor(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down
4 changes: 4 additions & 0 deletions internal/cmd/buildtool/cdepstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func cdepsTorBuildMain(globalEnv *cBuildEnv, deps buildtoolmodel.Dependencies) {
must.Run(log.Log, "git", "apply", patch)
}

must.Run(log.Log, "autoreconf", "-vif")

envp := cBuildExportAutotools(globalEnv)

argv := runtimex.Try1(shellx.NewArgv("./configure"))
Expand All @@ -57,6 +59,8 @@ func cdepsTorBuildMain(globalEnv *cBuildEnv, deps buildtoolmodel.Dependencies) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
)
runtimex.Try0(shellx.RunEx(defaultShellxConfig(), argv, envp))

Expand Down
36 changes: 36 additions & 0 deletions internal/cmd/buildtool/ios_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,16 @@ func TestIOSBuildCdepsTor(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"AS=/Developer/SDKs/iphoneos/bin/as",
Expand Down Expand Up @@ -1199,6 +1209,8 @@ func TestIOSBuildCdepsTor(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1247,6 +1259,16 @@ func TestIOSBuildCdepsTor(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"AS=/Developer/SDKs/iphonesimulator/bin/as",
Expand Down Expand Up @@ -1277,6 +1299,8 @@ func TestIOSBuildCdepsTor(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down Expand Up @@ -1325,6 +1349,16 @@ func TestIOSBuildCdepsTor(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"AS=/Developer/SDKs/iphonesimulator/bin/as",
Expand Down Expand Up @@ -1355,6 +1389,8 @@ func TestIOSBuildCdepsTor(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down
12 changes: 12 additions & 0 deletions internal/cmd/buildtool/linuxcdeps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ func TestLinuxCdepsBuildMain(t *testing.T) {
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/003.patch",
},
}, {
Env: []string{},
Argv: []string{
"git", "apply", faketopdir + "/CDEPS/tor/004.patch",
},
}, {
Env: []string{},
Argv: []string{
"autoreconf", "-vif",
},
}, {
Env: []string{
"CFLAGS=-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -fPIC -fsanitize=bounds -fsanitize-undefined-trap-on-error -O2",
Expand All @@ -370,6 +380,8 @@ func TestLinuxCdepsBuildMain(t *testing.T) {
"--disable-systemd",
"--prefix=/",
"--disable-unittests",
"--disable-system-torrc",
"--disable-seccomp",
},
}, {
Env: []string{},
Expand Down

0 comments on commit c28f409

Please sign in to comment.